I have a java project on Eclipse that read R2RML (.ttl) file. I am using R2RMLReader
from it.unibz.inf.ontop.r2rml.R2RMLReader
which uses Open RDF Rio org.openrdf.rio.Rio
, here is the method code:
public static ArrayList<TripleMaps> readR2RMLFile() {
String mappingFile= "/path/to/Desktop/r2rmlFile.ttl";
R2RMLReader reader = null;
try {
reader = new R2RMLReader(mappingFile);
} catch (Exception e) {
e.printStackTrace();
}
ArrayList<OBDAMappingAxiom> axioms = reader.readMappings();
for (OBDAMappingAxiom ax : axioms)
System.out.println(ax);
return null;
}
However, the R2RMLReader throws this error:
org.openrdf.rio.UnsupportedRDFormatException: No parser factory available for RDF format Turtle (mimeTypes=text/turtle, application/x-turtle; ext=ttl)
at org.openrdf.rio.Rio.createParser(Rio.java:198)
at it.unibz.inf.ontop.r2rml.R2RMLManager.<init>(R2RMLManager.java:71)
at it.unibz.inf.ontop.r2rml.R2RMLReader.<init>(R2RMLReader.java:63)
at it.unibz.inf.ontop.r2rml.R2RMLReader.<init>(R2RMLReader.java:54)
at TripleMaps.readR2RMLFile(TripleMaps.java:170)
What am I missing? Are there any jar files that should I add to the project?
I see this implementation on many tutorials and they use .ttl file format. However, in my project it not working.
I looked into different solutions this org.eclipse.rdf4j.rio.UnsupportedRDFormatException for Turtle format and this RDF4J RIO UnsupportedRDFormatException when adding data to an HTTPRepository using a stand-alone application
However, I am not using maven I downloaded all jar files and added it to the project.
I looked in http://archive.rdf4j.org/javadoc/sesame-2.8.9/org/openrdf/rio/RDFFormat.html , the openrdf/rio/RDFFormat should support Turtle.
"The file extension .ttl is recommend for Turtle documents"
How make org.openrdf.rio parser supports Turtle documents?