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

Null function not behaving correctly #245

Open
alloka opened this issue Nov 7, 2024 · 2 comments
Open

Null function not behaving correctly #245

alloka opened this issue Nov 7, 2024 · 2 comments

Comments

@alloka
Copy link

alloka commented Nov 7, 2024

Hello All,

So I'm trying to use the null function to check the non-existence of a json entity in my data , but it is not behaving correctly:

My data is as follows:
[{"id":"0","labels":["Student"],"properties":{"id":20}},{"type":"stay","id":"1","labels":["Sport"],"properties":{"sport_id":100,"sport_name":"Tennis"}},{"type":"node","id":"2","labels":["Student"],"properties":{"name":"Venus Williams","id":10,"sport":100}}]

and my mappings are the following:
prefixes:
rr: http://www.w3.org/ns/r2rml#
foaf: http://xmlns.com/foaf/0.1/
xsd: http://www.w3.org/2001/XMLSchema#
rdfs: http://www.w3.org/2000/01/rdf-schema#
Airport: http://example.org/Airport/
ontology: http://data.sfgov.org/ontology/
grel: http://users.ugent.be/~bjdmeest/function/grel.ttl#
exfunc: http://example.com/idlab/function/
ex: http://www.example.org/
idlab-fn: https://w3id.org/imec/idlab/function#`

mappings:
episode:
sources:
- [data.json~jsonpath, "$.[*]"]
s: ex:$(id)
condition:
function: idlab-fn:isNull
parameters:
- [grel:valueParameter, $(type)]
po:
- p: a
o: ex:Node

The output is:

<http://www.example.org/0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.example.org/Node> . <http://www.example.org/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.example.org/Node> . <http://www.example.org/2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.example.org/Node> .

while the expected output should return only the first triple

Also, is there any way to use the not null function as well in RML?

Best regards,
Ali.

@bjdmeest
Copy link
Collaborator

Could your paste the RML mapping file and properly format the yarrrml code? hard to bugfix this.

For the not null function: you can nest the not function with the null function, for an example of a nesting in a condition, see https://github.com/RMLio/yarrrml-parser/blob/development/test/condition-on-mapping-nested/mapping.yarrrml

@alloka
Copy link
Author

alloka commented Nov 14, 2024

Dear @bjdmeest Ben,

so I attached both the yaml and mappings file as txt files:

bug_yaml.txt
mappings.txt

Best regards,
Ali.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants