pchampin / sophia_rs

Sophia: a Rust toolkit for RDF and Linked Data
Other
210 stars 23 forks source link

Parser failing on RDF/XML files with rdf:about="" #152

Closed jamesamcl closed 7 months ago

jamesamcl commented 7 months ago

Hi, I am trying to load RDF/XML files from UniProt and I'm hitting this error:

SourceError(RdfXmlError { kind: InvalidIri { iri: "", error: IriParseError { kind: NoScheme } } })

Here is a minimal example which reproduces the problem:

<?xml version='1.0' encoding='UTF-8'?>
<rdf:RDF xmlns="http://purl.uniprot.org/core/" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<owl:Ontology rdf:about="">
    <owl:imports rdf:resource="http://purl.uniprot.org/core/"/>
</owl:Ontology>
</rdf:RDF>

Apparently the document IRI should be used as the base in this case. Here is the n3 representation if I parse it (as a local file) with rapper:

<file:///home/james/grebi/rust/keywords.rdf> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Ontology> .
<file:///home/james/grebi/rust/keywords.rdf> <http://www.w3.org/2002/07/owl#imports> <http://purl.uniprot.org/core/> .
damooo commented 7 months ago

Parser accepts base field, to customise base uri.

jamesamcl commented 7 months ago

Ah that makes sense! thank you