Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VocabularyProperty not working as expected #1542

Open
jason-fox opened this issue Jan 24, 2024 · 1 comment
Open

VocabularyProperty not working as expected #1542

jason-fox opened this issue Jan 24, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@jason-fox
Copy link
Member

jason-fox commented Jan 24, 2024

ORION_LD 1.6.0-pre-1570

Create an Entity with a VocabularyProperty

url -s -X POST \
  'http://localhost:1026/ngsi-ld/v1/entities/' \
  -H 'Content-Type: application/ld+json' \
  -d '{
    "id": "urn:ngsi-ld:Building:store001",
    "type": "Building",
    "category": {"type": "VocabularyProperty", "vocab": "commercial"},
    "address": {
      "type": "Property", 
      "value": {"streetAddress": "Bornholmer Straße 65", "addressRegion": "Berlin", "addressLocality": "Prenzlauer Berg", "postalCode": "10439"},
      "verified": {"type": "Property", "value": true}
    },
    "location": {"type": "GeoProperty", "value": {"type": "Point", "coordinates": [13.3986, 52.5547]}
    },
    "name": {"type": "Property", "value": "Bösebrücke Einkauf"},
    "furniture": {
        "type": "Relationship",
        "object": [
          "urn:ngsi-ld:Shelf:unit001",
          "urn:ngsi-ld:Shelf:unit002",
          "urn:ngsi-ld:Shelf:unit003"
        ]
    },
    "@context": "http://context/ngsi-context.jsonld"
}'
  1. If I insert the vocab as an array of one item, it is returned as an array and not reduced.
"category": {"type": "VocabularyProperty", "vocab": ["commercial"]},
  1. Requesting as keyValues (also test options=simplified, format=simplified)
curl -L 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Building:store001/?options=keyValues'

Returns the category in Normalized format.

"category": {
        "type": "VocabularyProperty",
        "vocab": "commercial"
    },
  1. Requesting as concise (also test options=concisr, format=concise)
curl -L http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Building:store001/?options=concise

Causes the broker to crash.

  1. Insertion using an alternate context.
curl -L 'http://localhost:1026/ngsi-ld/v1/entities/' \
-H 'Content-Type: application/ld+json' \
--data-raw '{
    "id": "urn:ngsi-ld:Building:store005",
    "type": "ビル",
    "カテゴリー": {
    	"type": "VocabularyProperty",
        "vocab": "コマーシャル"
    },
    "住所": {
        "type": "Property",
        "value": {
            "streetAddress": "Eisenacher Straße 98",
            "addressRegion": "Berlin",
            "addressLocality": "Marzahn",
            "postalCode": "12685"
        }
    },
    "場所": {
        "type": "GeoProperty",
        "value": {
             "type": "Point",
             "coordinates": [13.5646, 52.5435]
        }
    },
    "名前": {
        "type": "Property",
        "value": "Yuusui-en"
    },
    "@context":"http://context/japanese-user-context.jsonld"
}'

Inserts successfully, but retrieval using another context.

curl -L 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Building:store005' \
-H 'Content-Type: application/json' \
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"'

causes the broker to crash.

All the @context files can be found here: https://github.com/FIWARE/tutorials.Working-with-Linked-Data/tree/feature/vocab/data-models

@kzangeli kzangeli mentioned this issue Jan 25, 2024
@kzangeli kzangeli self-assigned this Jan 25, 2024
@kzangeli kzangeli added the bug Something isn't working label Jan 25, 2024
kzangeli added a commit that referenced this issue Jan 26, 2024
Array reduction - part of multi-issue #1542
@jason-fox
Copy link
Member Author

jason-fox commented Feb 1, 2024

Further investigation. No crash occurs when running with

 -dbhost mongo-db -logLevel DEBUG -experimental 

However, the broker exits If I use:

 -dbhost mongo-db -logLevel DEBUG -experimental  -forwarding

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants