Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [rdf4j-dev] Getting [Rio fatal] Not a valid (absolute) IRI - but file is parsable by rdflib for python

Thank you very much for resolution help.

2018-03-04 18:56 GMT+01:00 Ladislav Jech <archenroot@xxxxxxxxx>:
It works, I changed the code to this (I will provide full copy where I filled http://example.org/ to Rio.parse:
String filename = "RDF.xml";
//StringBuilder result = new StringBuilder("");

//Get file from resources folder
ClassLoader classLoader = getClass().getClassLoader();
File file = new File(classLoader.getResource(filename).getFile());

FileInputStream input = null;
Repository db = null;
try {
input = new FileInputStream(file);


Model model = null;

model = Rio.parse(input, "http://example.org/", RDFFormat.RDFXML);


// Create a new Repository. Here, we choose a database implementation
// that simply stores everything in main memory.
db = new SailRepository(new MemoryStore());

db.initialize();
try (RepositoryConnection conn = db.getConnection()) {
// add the model
conn.add(model);

// let's check that our data is actually in the database
try (RepositoryResult<Statement> result = conn.getStatements(null, null, null);)
{
while (result.hasNext()) {
Statement st = result.next();
System.out.println("db contains: " + st);
}
}

}
And it works like charm now.

2018-03-04 18:41 GMT+01:00 Bart Hanssens (BOSA) <bart.hanssens@xxxxxxxxxxxx>:

Hi Ladislav,


Well, I'd suggest to use whatever base URI you want (say "http://example.uri") to test if that solves the issue.


If you are using the Java API, you only have to set the second parameter (baseURI) in RDFParser.parse() or Rio.parse().

Same goes for uploading a file using the workbench / webinterface (set a baseURI in the upload form)


Best regards


Bart



From: rdf4j-dev-bounces@xxxxxxxxxxx <rdf4j-dev-bounces@xxxxxxxxxxx> on behalf of Ladislav Jech <archenroot@xxxxxxxxx>
Sent: Sunday, March 4, 2018 6:23:14 PM
To: rdf4j developer discussions

Subject: Re: [rdf4j-dev] Getting [Rio fatal] Not a valid (absolute) IRI - but file is parsable by rdflib for python
 
Aha, so what do you suggest? For us it is hard to enforce producer to change methodology of the data provider. I will wait for your decision, but as per my understanding the standard simply doesn't cover this situation, meaning your more strict and rdflib more easy going implementation are actually both correct in the moment, am I right?

Ladislav

2018-03-04 14:41 GMT+01:00 Bart Hanssens (BOSA) <bart.hanssens@xxxxxxxxxxxx>:

Hi,

 

 

RDF4j doesn’t handle the relative IRI because there is no base IRI, but the RDF/XML spec mentions in 2.14

 

“The XML Infoset provides a base URI attribute xml:base that sets the base URI for resolving relative IRIs,

otherwise the base URI is that of the document.”

 

Entering Ladislav’s example file in “direct input” textbox of the W3C RDF validator generates valid RDF with IRIs like

http://www.w3.org/RDF/Validator/run/1520169429241#_11

 

So it depends on whether or not an implementation provides/generates a document URI.

 

If loaded from a file system or submitted via online form, it’s quite straightforward to generate a document URI.

Probably a bit less defined what should be done when there is no direct link (e.g. in memory)

 

Maybe RDF4J could just use a dummy document URI if there is no base specified,

instead of relying on the developer to explicitly provide a base  IRI  ?

 

 

Best regards

 

Bart

 

From: rdf4j-dev-bounces@xxxxxxxxxxx [mailto:rdf4j-dev-bounces@eclipse.org] On Behalf Of Håvard Ottestad
Sent: zondag 4 maart 2018 10:46
To: rdf4j developer discussions <rdf4j-dev@xxxxxxxxxxx>
Subject: Re: [rdf4j-dev] Getting [Rio fatal] Not a valid (absolute) IRI - but file is parsable by rdflib for python

 

Hi Ladislav

 

Not every library implements the RDF standard strictly. 

 

This may actually be a bug in rdflib. Have you tried to contact them? 

 

This is the spec for IRIs: http://www.ietf.org/rfc/rfc3987.txt

I recommend that your IRIs be of the following format: http://example.com/resource1

Håvard


On 4 Mar 2018, at 09:20, Ladislav Jech <archenroot@xxxxxxxxx> wrote:

Hello dev team of rdf4j,

 

thanks for your work first of all.

 

I got into exception scenario as per message subject described here:

 

Issue has been close and today I also opened subject on google groups:

 

Thing is that the data file is processable by rdflib for python library(https://github.com/RDFLib/rdflib), while rdf4j is failing, I am new to format and being not sure what and where is root cause.

 

Thank you for any help on this.

 

Ladislav

 

_______________________________________________
rdf4j-dev mailing list
rdf4j-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/rdf4j-dev


_______________________________________________
rdf4j-dev mailing list
rdf4j-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/rdf4j-dev



_______________________________________________
rdf4j-dev mailing list
rdf4j-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/rdf4j-dev




Back to the top