zazuko / xrm

A friendly language for mappings to RDF
MIT License
1 stars 0 forks source link

Support (R2)RML graph maps #135

Closed tpluscode closed 2 years ago

tpluscode commented 4 years ago

R2RML can output triples to specific named graph defined using rr:graphMap property.

Either as template

[] rr:subjectMap [
  rr:graphMap [ rr:template "http://www.example.com/{@type}" ];
].

or constant

[] rr:subjectMap [
  rr:graphMap [ rr:constant ex:StopsGraph ];
].

I propose to add this as a language feature in the map block. Multiple should be allowed

map Subject from source {
  graph template "http://www.example.com/{0}" with Type

  graph constant "http://www.example.com/StopsGraph"

  # Also using prefixed names if possible
  graph constant ex.StopsGraph
}
mchlrch commented 2 years ago

XRM version 1.2.0 now supports declaring target named graph(s)

Declaring graphs is only supported for R2RML, RML and CARML output. It's not supported for CSVW output.

Sample XRM:

output r2rml

map ThingIntoGraphmapsMapping from ThingIntoGraphmapsSource {
    subject template "http://example.org/thing/{0}" with id;

    graphs
        constant "http://example.org/graph/omnigraph";          // constant IRI as string
        template "http://example.org/graph/thing-{0}" with id;  // templated IRI with variable(s)

        constant thing.Thing;              // IRI from Class
        constant thing.color;              // IRI from Property
        constant employee.myDatatype;      // IRI from Datatype
}