zazuko/xrm

rmlmapper does not accept URIs: <#AirportMapping>

Opened this issue ยท 3 comments

The RML mappings produced from XRM might be used to materialize triples using many different engines.

There is one in particular, https://github.com/RMLio/rmlmapper-java has a strict parser that complains about URIs of the form <#AirportMapping>


<#AirportMapping> a rr:TriplesMap .

I'm not sure if the plugin should consider this, but materializer is a popular one.

Would it be much hassle to produce URIs if this materializer accepts?

Interesting. The IRIs generated by XRM are the way they are, because I simply copy/pasted the "style" from the RML spec :) (see below)

Does it work, if you add a @base to the generated mapping file? Could you add the error message that the materializer produces?

image

Sure,

Materializer: https://github.com/RMLio/rmlmapper-java/releases/tag/v6.1.3

Mapping:

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 ex: <http://example.org/>
PREFIX schema: <http://schema.org/>

<#person>
	a rr:TriplesMap;
	
	rml:logicalSource [
		rml:source "input/example.json";
		rml:referenceFormulation ql:JSONPath;
		rml:iterator "$.characters[*]"
	];
	
	rr:subjectMap [
		rr:template "http://example.org/character/{id}";
		rr:class schema:Person
	];
	
	rr:predicateObjectMap [
		rr:predicate schema:givenName;
		rr:objectMap [
			rml:reference "firstname"
		]
	];
	
	rr:predicateObjectMap [
		rr:predicate schema:lastName;
		rr:objectMap [
			rml:reference "lastname"
		]
	];
	
	rr:predicateObjectMap [
		rr:predicate ex:hairColor;
		rr:objectMap [
			rml:reference "hair"
		]
	].	

Stacktrace:

 ๐Ÿฃ main [โœ˜!?] is ๐Ÿ“ฆ v1.0.0 via โ˜• v19.0.2 via ๎œ˜ v18.12.0 xrm-xml-workflow โฏ java -jar rmlmapper.jar -m ./src-gen/mapping.rml.ttl -o output.ttl
09:56:28.232 [main] ERROR be.ugent.rml.cli.Main               .run(267) - Unable to parse mapping rules as Turtle. Does the file exist and is it valid Turtle?
org.eclipse.rdf4j.rio.RDFParseException: Not a valid (absolute) IRI: #person [line 7]
        at org.eclipse.rdf4j.rio.helpers.RDFParserHelper.reportFatalError(RDFParserHelper.java:380)
        at org.eclipse.rdf4j.rio.helpers.AbstractRDFParser.reportFatalError(AbstractRDFParser.java:708)
        at org.eclipse.rdf4j.rio.turtle.TurtleParser.reportFatalError(TurtleParser.java:1317)
        at org.eclipse.rdf4j.rio.helpers.AbstractRDFParser.createURI(AbstractRDFParser.java:360)
        at org.eclipse.rdf4j.rio.helpers.AbstractRDFParser.resolveURI(AbstractRDFParser.java:338)
        at org.eclipse.rdf4j.rio.turtle.TurtleParser.parseURI(TurtleParser.java:944)
        at org.eclipse.rdf4j.rio.turtle.TurtleParser.parseValue(TurtleParser.java:571)
        at org.eclipse.rdf4j.rio.turtle.TurtleParser.parseSubject(TurtleParser.java:398)
        at org.eclipse.rdf4j.rio.turtle.TurtleParser.parseTriples(TurtleParser.java:333)
        at org.eclipse.rdf4j.rio.turtle.TurtleParser.parseStatement(TurtleParser.java:203)
        at org.eclipse.rdf4j.rio.turtle.TurtleParser.parse(TurtleParser.java:165)
        at org.eclipse.rdf4j.rio.turtle.TurtleParser.parse(TurtleParser.java:128)
        at be.ugent.rml.store.RDF4JStore.read(RDF4JStore.java:120)
        at be.ugent.rml.cli.Main.run(Main.java:264)
        at be.ugent.rml.cli.Main.main(Main.java:46)
Caused by: java.lang.IllegalArgumentException: Not a valid (absolute) IRI: #person
        at org.eclipse.rdf4j.model.impl.SimpleIRI.setIRIString(SimpleIRI.java:78)
        at org.eclipse.rdf4j.model.impl.SimpleIRI.<init>(SimpleIRI.java:67)
        at org.eclipse.rdf4j.model.impl.SimpleValueFactory.createIRI(SimpleValueFactory.java:84)
        at org.eclipse.rdf4j.rio.helpers.RDFStarDecodingValueFactory.createIRI(RDFStarDecodingValueFactory.java:46)
        at org.eclipse.rdf4j.rio.helpers.AbstractRDFParser.createURI(AbstractRDFParser.java:358)
        ... 11 common frames omitted

Interesting. The IRIs generated by XRM are the way they are, because I simply copy/pasted the "style" from the RML spec :) (see below)

Does it work, if you add a @base to the generated mapping file? Could you add the error message that the materializer produces?

I can confirm It works if I add a @base

image