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
147 stars 61 forks source link

Use of rr:constant writes out value of rml:reference instead of constant value #111

Closed CyberDaedalus00 closed 3 years ago

CyberDaedalus00 commented 3 years ago

I'm trying to come up with a way to dynamically add additional rdf:type values for a subject based on the discovery of the existance of property in the JSON source. I've defined the following mapping:

` rr:predicateObjectMap [ rr:predicate rdf:type ; rr:objectMap [ rml:reference "extensions.archive-ext" ;

rr:constant archiveExt:ArchiveFile ;

        rr:constant "http://docs.oasis.org/ns/cti/stix/ext/archive-file#ArchiveFile" ;
    ] ;
] ;

` Unfortunately, when mapper runs, instead of getting the value of the rr:constant being written out, I get the value of the JSON property referenced by the rml:reference.

Is this a bug or am I doing something wrong?

bjdmeest commented 3 years ago

I'm not able to test it out right now, but according to the R2RML spec at https://www.w3.org/TR/r2rml/#term-map:

A term map MUST be exactly one of the following:

    a constant-valued term map,
    a column-valued term map,
    a template-valued term map.

Have you tried with multiple rr:objectMaps, one for each object you would want to generate?

CyberDaedalus00 commented 3 years ago

this is a constant-valued term map with only one value.

rr:predicateObjectMap [ rr:predicate rdf:type ; rr:objectMap [ rml:reference "extensions.archive-ext" ; rr:constant archiveExt:ArchiveFile ; ] The constant that I'm expecting to be used as the value of the object in the triple is the IRI of the class archiveExt:ArchiveFile.

Instead, what gets written out as the value of the object in the triple is the value of @.extensions.archive-ext property, thus ignoring the constant specified.

Upon reading the "From A Reference" section of the RML specification, it appears the use of rml:reference DOES return the data value of that column/element/object in a given logical iteration. Thus, it appears to override the rr:constant statement after it.