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

jsonld serialization does not convert rdf:type to @type #169

Open adlerfaulkner opened 2 years ago

adlerfaulkner commented 2 years ago

When exectuing a mapping with serialization set to jsonld and with a rr:predicateObjectMap that has rr:predicate rdf:type, the resulting jsonld uses http://www.w3.org/1999/02/22-rdf-syntax-ns#type as a key instead of @type.

For example with the mapping:

<#Mapping> a rr:TriplesMap ;
    rr:logicalSource [ ... ] ;
    rr:subjectMap [
        a rr:SubjectMap ;
        rr:constant "https://example.com/test/id" ] ;
    rr:predicateObjectMap [
        a rr:PredicateObjectMap ;
        rr:predicate rdf:type ;
        rr:objectMap [
            a ns2:ObjectMap ;
            rr:refernece "somejsonfield" ] ] ;

The jsonld I get as response is:

{
    "@id": "https://example.com/test/id",
    "http://www.w3.org/1999/02/22-rdf-syntax-ns#type": [ { "@value": "somejsonfield" } ]
}

I would expect this to give me:

{
    "@id": "https://example.com/test/id",
    "@type": "somejsonfield"
}
bjdmeest commented 2 years ago

Thanks for your issue! This is a consequence of using the RDF4J writers, see https://github.com/eclipse/rdf4j/issues/3643. There's not much we can do at this moment (I also cannot find a way, e.g., via JSONLD compacting, to fix this).

adlerfaulkner commented 2 years ago

Got it. Thanks for the info! Handled it with a hack on my end.