RMLio / RML-Mapper

Generate High Quality Linked Data from multiple originally (semi-)structured data (legacy)
http://RML.io
52 stars 20 forks source link

How to add blank node in RML mapping #29

Closed vimaldarjiv26 closed 5 years ago

vimaldarjiv26 commented 6 years ago

While testing with RML mapper I have added rr:BlankNode in RML mapping file but RML mapper doesn't allow me.

pheyvaer commented 6 years ago

How does your mapping file look like? And what error does the mapper return?

ssskralin commented 6 years ago

@andimou, in the example below, why 4 blank nodes generated instead of 2?

Input

{
   "results": [
      {
         "record_id": "ec5ca92d-865a-431f-9984",
         "demographics": { "gender":"male", "age":18 }
      },
      {
         "record_id": "0a79ecf0-83d8-4148-9054",
         "demographics": { "gender":"female", "age":19 }
      }
   ]
}

Mappings


@prefix rr: <http://www.w3.org/ns/r2rml#>.
@prefix rml: <http://semweb.mmlab.be/ns/rml#>.
@prefix ql: <http://semweb.mmlab.be/ns/ql#>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix exo: <http://example.org/ontology/>.
@prefix exr: <http://example.org/resource/>.

<#RecordMapping>
  rml:logicalSource [
    rml:source "/home/kralin/Desktop/results.json";
    rml:referenceFormulation ql:JSONPath;
    rml:iterator "$.results.[*]"
  ];

  rr:subjectMap [ rr:termType rr:BlankNode ];

  rr:predicateObjectMap [
    rr:predicate exo:has_age;
    rr:objectMap [
      rml:reference "demographics.age" ;
      rr:datatype xsd:integer
    ]
  ].

<#ResultsMapping>
  rml:logicalSource [
    rml:source "/home/kralin/Desktop/results.json";
    rml:referenceFormulation ql:JSONPath;
    rml:iterator "$"
  ];

  rr:subjectMap [ rr:constant "http://example.org/resource/results" ];

  rr:predicateObjectMap [
    rr:predicate exo:has_record;
    rr:objectMap [
      rr:parentTriplesMap <#RecordMapping>
    ]
  ].

Output


exr:results exo:has_record _:NasCMHQ4qO , _:6zFBpcR1el .

_:59SyVseNjX exo:has_age 18 .

_:mEdfZ9cRrU exo:has_age 19 .

_:NasCMHQ4qO exo:has_age 18 .

_:6zFBpcR1el exo:has_age 19 .
pheyvaer commented 5 years ago

Hi,

We've updated the RMLMapper and it can now be found here. I've tried your example only two blank nodes are generated. If you have still issues, you can open a new issue at the repo of the new RMLMapper.