-
Notifications
You must be signed in to change notification settings - Fork 3
Add example mixing use of rml-views and gather maps #30
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
Comments
Fields is still in discussion. Indeed, in the joins task force, we are going to present the solution again and see if it covers all the requirements that we need. In any case, the issues that are labeled with |
This question was discussed during the meeting in Santiago de Compostela. Here is the solution that was agreed: Input document "source.json": {
"id": 1,
"a" : [ [1,2,3], [4,5,6] ]
} The expected output is to generate a list of lists, where the head node of the outer list has a URI:
The solution involves a logical source for the json file, and a logical view that declares fields: <LS>
a rml:LogicalSource ;
rml:source "source.json" ;
rml:referenceFormulation ql:JSONPath;
].
<LV>
a rml:LogicalView ;
rml:logicalSource <LS> ;
rml:field [
rml:fieldName "id" ;
rml:reference "$.id" ;
] ;
rml:field [
rml:fieldName "a_string" ;
rml:reference "$.a.*" ;
rml:field [
rml:fieldName "a_list" ;
# Reference "$.*" applies to the results produced by evaluating "$.a.*"
rml:reference "$.*" ;
rml:groupBy "a"
]
]
]. This reshapes the input document into a table with 2 lines:
Here, Now applying the following term map should generate the expected result: rr:subjectMap [
rr:template "http://my.list/{id}";
rml:gather ( [
rml:gather ( [
# "a_list" is multi-valued, it evaluates to the 3 terms in each arrays: first iteration: 1, 2, 3, then 4, 5, 6.
rml:reference "a_list" ;
rml:gatherAs rdf:List;
] )
] );
rml:gatherAs rdf:List;
] ; |
Hi @frmichel, Indeed! Only the object of the So the logical view would be defined as such: <LV>
a rml:LogicalView ;
rml:logicalSource <LS> ;
rml:field [
rml:fieldName "id" ;
rml:reference "$.id" ;
] ;
rml:field [
rml:fieldName "a_string" ;
rml:reference "$.a.*" ;
rml:field [
rml:fieldName "a_list" ;
# Reference "$.*" applies to the results produced by evaluating "$.a.*"
rml:reference "$.*" ;
rml:groupBy "a_string"
]
]
]. |
Yes you're right, sorry for the typo. I renamed a and a2 into a_string and a_list for clarification, but I forgot to change a in groupBy ;). |
Ok for me, I've also changed the label from pending to proposal |
This example should be added only when the fields specification is released.
Anyway, the issue does not prevent from releasing a first version of the specification.
See existing example: #10 (comment)
The text was updated successfully, but these errors were encountered: