Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rmlmapper does not accept URIs: <#AirportMapping> #146

Open
cristianvasquez opened this issue Feb 21, 2023 · 3 comments
Open

rmlmapper does not accept URIs: <#AirportMapping> #146

cristianvasquez opened this issue Feb 21, 2023 · 3 comments

Comments

@cristianvasquez
Copy link

cristianvasquez commented Feb 21, 2023

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?

@mchlrch
Copy link
Member

mchlrch commented Mar 15, 2023

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

@cristianvasquez
Copy link
Author

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

@cristianvasquez
Copy link
Author

cristianvasquez commented Mar 16, 2023

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

@mchlrch mchlrch transferred this issue from zazuko/expressive-rdf-mapper Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants