- From: Ben De Meester <ben.demeester@ugent.be>
- Date: Fri, 27 Sep 2024 11:42:18 +0200
- To: fano.ramparany@orange.com, "semantic-web@w3c.org" <semantic-web@w3c.org>
- Message-ID: <9cd99b0b-ebe9-4393-8520-e70400e7336c@ugent.be>
Dear Fano, Being part of the KG Construct Community Group <https://www.w3.org/community/kg-construct/>, I can tell you that RML <https://w3id.org/rml/portal/> is flexible enough to support your use case. Depending on the structure of the source data, you could use conditionals (ongoing specification work <https://github.com/kg-construct/rml-fnml/pull/46>) to say 'if type is X, then generate following predicates and objects', but in this case, given your polymorphism is quite straightforwardly represented based on the 'type' value, you could just use JSONPath to filter all objects of type 'person' to be mapped using mappings X, and all objects of type 'parcel' to be mapped using mappings Y. See eg https://jsonpath.com/: using JSONPath expression $.phoneNumbers[?(@.type=="home")].number , you only get phone numbers of type 'home', similarly you could use JSONPath expression $[?(@.type=='person')] to filter objects of type person. To see this in action, you can try at https://rml.io/yarrrml/matey/: if you load the 'People (JSON)' example and click 'Generate LD', you see triples generated for all three people, if you replace line 7 of the Input:YARRRML screen with ` - ['data.json~jsonpath', "$.persons[?(@.firstname=='John')]"] `, it will only use those mappings to generate triples for input objects with condition 'firstname is John'. You could image to add another mapping that generates very different triples for input objects with condition 'firstname is Jane'. Feel free to get back to me for follow-up! Kind regards, Ben Ben De Meester Researcher Semantic Web imec - Ghent University - IDLab | Faculty of Engineering and Architecture | Department of Electronics and Information Systems Technologiepark-Zwijnaarde 122, 9052 Ghent, Belgium t: +32 9 331 49 56 | e: ben.demeester@ugent.be | URL: https://ben.de-meester.org/#me On 27/09/2024 10:57, fano.ramparany@orange.com wrote: > > Hi, > > Are there any polymorphic RDF mapping tool? > > More concretely , we use a json data source which publish heterogenous > json documents such as in the following example: > > [ > > { > > "type" : "person", > > "name" : "peter", > > "age" : 30 > > }, > > { > > "type" : "parcel", > > "id" : "p320", > > "weight" : 2, > > "recipient" : { > > "name" : "daniel", > > "address" : "2, Harbor Str., Hopville" > > } > > } > > ] > > Thank you in advance for your help > > Orange Restricted > > ____________________________________________________________________________________________________________ > Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc > pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler > a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration, > Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci. > > This message and its attachments may contain confidential or privileged information that may be protected by law; > they should not be distributed, used or copied without authorisation. > If you have received this email in error, please notify the sender and delete this message and its attachments. > As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified. > Thank you.
Received on Friday, 27 September 2024 09:42:26 UTC