RMLio / rmlmapper-java

The RMLMapper executes RML rules to generate high quality Linked Data from multiple originally (semi-)structured data sources
http://rml.io
MIT License
146 stars 61 forks source link

Dealing with lists in a json-formatted data #149

Closed huanyu-li closed 2 years ago

huanyu-li commented 2 years ago

Hi,

May I just ask a question about if RML supports to deal multiple lists from a JSON-formatted data in one triples map? For instance, my json response looks like: { "data":{ "id": "MY_ID", "A": [A0, A1, A2], "B": [B0, B1, B2] } } In my RDF graph, I want to have such triples: 'http://example.com/MY_ID/0' 'has_A' 'A0' 'http://example.com/MY_ID/0' 'has_B' 'B0' 'http://example.com/MY_ID/1' 'has_A' 'A1' 'http://example.com/MY_ID/1' 'has_B' 'B1' 'http://example.com/MY_ID/2' 'has_A' 'A2' 'http://example.com/MY_ID/2' 'has_B' 'B2'

And the lengths of lists for "A" may be different in different json responses, but they are always same as those for "B".

Thank you in advance. Best, Huanyu

DylanVanAssche commented 2 years ago

Hi @huanyu-li !

RML can deal with the lists but not like this I'm afraid. The IRIs are constructed through the array index which is not available with JSONPath. You need at least a JSONPath expression to iterate over the data.

huanyu-li commented 2 years ago

Thank you so much for the reply, @DylanVanAssche. It makes sense to me now.

huanyu-li commented 1 year ago

Hi @DylanVanAssche,

May I ask if this feature like getting index of a list is interested for KG construction? Or could you point to me if I can modify RML code somewhere to implement this feature by my self.

DylanVanAssche commented 1 year ago

Hi!

Index based access of lists are definitely useful, the problem here is access via JSONPath. That's the access description for JSON files here. If you can find a syntax for index based access in JSONPath, it could be integrated.

bjdmeest commented 1 year ago

(Just letting you know I'm putting this on the W3C community group radar, see referenced issue above)