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

Unable to query on Relationship. #1312

Open
jason-fox opened this issue Jan 13, 2025 · 1 comment
Open

Unable to query on Relationship. #1312

jason-fox opened this issue Jan 13, 2025 · 1 comment
Labels
core Relates to core API fix Something isn't working temporal Relates to temporal API

Comments

@jason-fox
Copy link
Contributor

Stellio 2.18.1

I have a number of Shelf entities like this:

 {
        "id": "urn:ngsi-ld:Shelf:unit001",
        "type": "Shelf",
        "stocks": {
            "type": "Relationship",
            "object": "urn:ngsi-ld:Product:001"
        },
       "numberOfItems": {
            "type": "Property",
            "value": 15
        }
}

Querying on the property retrieves the entity correctly ✅

curl -L 'http://localhost:8080/ngsi-ld/v1/entities/?type=Shelf&options=keyValues&q=numberOfItems%3E0' \
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
-H 'Accept: application/json'

Querying on the relationship returns an empty array ❌

curl -L 'http://localhost:8080/ngsi-ld/v1/entities/?type=Shelf&q=stocks%3D%3D%22urn%3Angsi-ld%3AProduct%3A001%22' \
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
-H 'Accept: application/json'

Querying on both the property and relationship also returns an empty array ❌

curl -L 'http://localhost:8080/ngsi-ld/v1/entities/?type=Shelf&options=keyValues&q=numberOfItems%3E0%3BlocatedIn%3D%3D%22urn%3Angsi-ld%3ABuilding%3Astore001%22%3Bstocks%3D%3D%22urn%3Angsi-ld%3AProduct%3A001%22' \
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
-H 'Accept: application/json'
@bobeal
Copy link
Member

bobeal commented Jan 13, 2025

this works:

http http://localhost:8080/ngsi-ld/v1/entities/?type=Shelf&q=stocks==urn:ngsi-ld:Product:001

but not this:

http http://localhost:8080/ngsi-ld/v1/entities/?type=Shelf&q=stocks=="urn:ngsi-ld:Product:001"

basically because, in the 2nd case, Stellio says it is a string, not an URI, so it does not match the object of the relationship.

will look at it.

@bobeal bobeal added fix Something isn't working core Relates to core API temporal Relates to temporal API labels Jan 13, 2025
@github-project-automation github-project-automation bot moved this to Short term in Roadmap Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Relates to core API fix Something isn't working temporal Relates to temporal API
Projects
Status: Short term
Development

No branches or pull requests

2 participants