title: RML Mapping - How to map a restriction?
body: <p>I am stuck on the mapping of an owl:Restriction and trying to figure out how that could be done using the <a href="https://github.com/RMLio/rmlmapper-java" rel="nofollow noreferrer">RML Mapper</a>.</p>
  <p>The result should be:</p>
  <pre><code>prefix ns: &lt;http://example.org/&gt; .
  ns:SomeResource rdf:type owl:NamedIndividual ,
     [ rdf:type owl:Restriction ;
       owl:onProperty &lt;http://example.org/myProperty&gt; ;
       owl:allValuesFrom ns:AnotherResource 
     ] ;
     rdfs:label &quot;label&quot; .
  </code></pre>
  <p>From the JSON I get <code>ns:SomeResource</code> and <code>ns:AnotherResource</code>. My mapping file looks like this:</p>
  <pre><code>&lt;#RestrictionMap&gt; rdf:type rr:TriplesMap;
  rml:logicalSource [
                      rml:source &quot;myJSON.json&quot;;
                      rml:referenceFormulation ql:JSONPath;
                      rml:iterator &quot;$.myIterator[*]&quot;
                    ];
  
  rr:subjectMap [
                  rr:template &quot;http://example.org/{Id}&quot; ;
                  rr:class owl:NamedIndividual
                ];
  </code></pre>
  <p>I tried to put the restriction into the rr:class of the subject map using a predicateObjectMap:</p>
  <pre><code>rr:subjectMap [
                  rr:template &quot;http://example.org/{Id}&quot; ;
                  rr:class [ rr:predicateObjectMap [                                                                  
                                         rr:predicate rdf:type ;                                                           
                                         rr:objectMap [                                                                                
                                                  rr:template &quot;http://www.w3.org/2002/07/owl#Restriction&quot; ;                                                                           
                                                  rr:termType rr:IRI ] ;                                                                                                                        ] ;
                              rr:predicateObjectMap [
                                         rr:predicate owl:onProperty ;                                                                
                                         rr:objectMap [
                                                      rr:template &quot;http://example.org/myProperty&quot; ;
                                                      rr:termType rr:IRI ] 
                              ];
                   ]
  ];
  </code></pre>
  <p>I admit that this approach is creative, unfortunately it also does not work and the mapper stops with an error message of a wrong absolute IRI.</p>
  <p>My other idea was to put into a predicateObjectMap using a string template:</p>
  <pre><code>rr:predicateObjectMap [
                        rr:predicate rdf:type ;
                        rr:objectMap [
                                     rr:template &quot;[ rdf:type owl:Restriction ; owl:onProperty &lt;http://example.org/myProperty&gt; ; owl:allValuesFrom {AnotherResource} ]&quot;;
                                     rr:termType rr:Literal ]
                        ];
  </code></pre>
  <p>This approach looks a bit more promising, but it puts the whole line in quotes:</p>
  <pre><code>&lt;http://example.org/SomeResource&gt;
      rdf:type &quot;[ rdf:type owl:Restriction ; owl:onProperty &lt;http://example.org/myProperty&gt; ; owl:allValuesFrom AnotherResource ]&quot; ;
  </code></pre>
  <p>I wonder whether it is possible to do the mappings automatically and, in case, how this is done correctly?</p>