-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
Issue type: 🐛 Bug
Description
I want to create an ordered list using rdf:first and rdf:rest from an array (the number of array elements is random). It works in Matey but doesn't work with the latest YARRRML parser.
Steps
{
"policies": [
{
"id": 1877588419,
"type": "http://www.w3.org/ns/odrl/2/Set",
"creator": null,
"description": null,
"issued": "2023-06-26",
"rules": {
"permissions": [
{
"id": 2049408449,
"policy_id": 1035993210,
"operand": "xone",
"first": 1658331773,
"logical_constraints": {
"and": [],
"or": [],
"andSequence": [],
"xone": [
{
"id": 1658331773,
"policy_id": 1035993210,
"left_operand": "http://www.w3.org/ns/odrl/2/absolutePosition",
"operator": "http://www.w3.org/ns/odrl/2/eq",
"valueType": "iri",
"right_operand_value_iri": "zefzfzef",
"right_operand_value_string": null,
"right_operand_value_duration": null,
"right_operand_value_date": null,
"right_operand_value_dateTime": null,
"right_operand_value_float": null,
"rule_id": 2049408449,
"next": 3045330922
},
{
"id": 3045330922,
"policy_id": 1035993210,
"left_operand": "http://www.w3.org/ns/odrl/2/absolutePosition",
"operator": "http://www.w3.org/ns/odrl/2/eq",
"valueType": "iri",
"right_operand_value_iri": "zefzfzef",
"right_operand_value_string": null,
"right_operand_value_duration": null,
"right_operand_value_date": null,
"right_operand_value_dateTime": null,
"right_operand_value_float": null,
"rule_id": 2049408449,
"next": null
}
]
}
}
]
}
}
]
}prefixes:
odrl: http://www.w3.org/ns/odrl/2/
xsd: http://www.w3.org/2001/XMLSchema#
rdfs: http://www.w3.org/2000/01/rdf-schema#
rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
occe: https://w3id.org/occe/
dpv: https://w3id.org/dpv#
obo: http://purl.obolibrary.org/obo/
dc-terms: http://purl.org/dc/terms/
dc-elements: http://purl.org/dc/elements/
this: https://example.com/
idlab-fn: http://example.com/idlab/function/
grel: http://users.ugent.be/~bjdmeest/function/grel.ttl#
sources:
parent:
access: data.json
referenceFormulation: jsonpath
iterator: "$"
permission:
access: data.json
referenceFormulation: jsonpath
iterator: "$.policies.[*].rules.permissions.[*]"
permission_constraint_xone:
access: data.json
referenceFormulation: jsonpath
iterator: "$.policies[*].rules.permissions.[*].logical_constraints.xone.[*]"
mappings:
permission:
sources:
- permission
s: this:policies/$(policy_id)/permissions/$(id)
po:
- p: odrl:constraint
o:
- value: this:policies/$(policy_id)/permissions/$(id)/constraints/xone
type: iri
condition:
function: equal
parameters:
- [grel:valueParameter, $(operand)] # From permission's constraint
- [grel:valueParameter2, "xone"] # From permission's constraint
permission_constraint_xone_parent:
sources:
- permission
s: this:policies/$(policy_id)/permissions/$(id)/constraints/xone
condition:
function: equal
parameters:
- [grel:valueParameter, $(operand)] # From permission's constraint
- [grel:valueParameter2, "xone"] # From permission's constraint
po:
- p: odrl:xone
o:
- mapping: permission_constraints_xone
condition:
function: equal
parameters:
- [str1, $(first)] # From permission's constraint
- [str2, $(id)] # From permission's constraint xone
permission_constraints_xone:
sources:
- permission_constraint_xone
s: null
po:
- [rdf:first, this:policies/$(policy_id)/permissions/$(rule_id)/logical_constraints/xone/$(id)~iri]
- p: rdf:rest
o:
- mapping: permission_constraints_xone
condition:
function: equal
parameters:
- [str1, $(next)]
- [str2, $(id)]
- value: rdf:nil
type: iri
condition:
function: idlab-fn:isNull
parameters:
- [idlab-fn:str, $(next)]The above snippet show produces the following RDF (which is wrong: the blank nodes for the objects are wrong, for the first triple, it should be rdf:rest _:1):
_:0 rdf:first <https://example.com/policies/1035993210/permissions/2049408449/logical_constraints/xone/1658331773>. # There is no reference to the next triple, i.e: rdf:rest _:1
_:1 rdf:first <https://example.com/policies/1035993210/permissions/2049408449/logical_constraints/xone/3045330922>;
rdf:rest rdf:nil .But with Matey, it produces a correct RDF:
_:b34_0 rdf:first <https://example.com/policies/1035993210/permissions/2049408449/logical_constraints/xone/1658331773> ;
rdf:rest _:b34_1 . # Here, this is a correct reference to the next triple.
_:b34_1 rdf:first <https://example.com/policies/1035993210/permissions/2049408449/logical_constraints/xone/3045330922> ;
rdf:rest rdf:nil.Please do note that removing the condition (in local) will output the same blank node as the subject, i.e: _:0 rdf:rest _:0 which is also wrong. But it works correcly in Matey.
Environment
Matey and latest yarrrml-parser 1.5.4
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels