Exported RDF/XML is invalid

edited February 7, 2022
Hi,

I'm parsing Zotero's export file with Jena. The problematic bit looks like this:

<z:Attachment rdf:about="#item_4">
<rdf:resource rdf:resource="smth.pdf"/>
</z:Attachment>


The problem is that rdf:resource is used as a property but it is a reserved term (attribute) in the RDF/XML syntax. It's an example of "Use inappropriate reserved names as properties":
https://www.w3.org/TR/rdf-syntax-grammar/#section-Syntax-property-attributes

Jena throws a parser error:
org.apache.jena.riot.RiotException: [line: 83, col: 121] {E205} rdf:resource is not allowed as an element tag here.

Could you please change the property to something else? I think it should be the inverse of dcterms:source but can't find any right now:
https://www.dublincore.org/specifications/dublin-core/dcmi-terms/#http://purl.org/dc/elements/1.1/source

Martynas
atomgraph.com
  • We can change this, but I'd defer to someone else on what an appropriate property for the file path would be.
  • That doesn't seem very appropriate to me.
  • edited February 7, 2022
    The path value itself did not cause any errors but I wonder if it shouldn't be in file:// scheme, URL-encoded and probably absolute?
    So instead of rdf:resource="files/4/Jusevičius - 2016 - Linked Data Templates Ontology-driven approach to.pdf"> I think it should be rdf:resource="file:///C:/Users/pumba/WebRoot/AtomGraph/Zotero%20Library/files/4/Jusevi%C4%8Dius%20-%202016%20-%20Linked%20Data%20Templates%20Ontology-driven%20approach%20to.pdf">. This link will open the document in the browser (that's where I copied it from).
  • edited February 7, 2022
    Well then you might as well create a new property in the http://www.zotero.org/namespaces/export# namespace, because the resource it belongs to is of type <z:Attachment>.
  • No, it can't be absolute. Then any export would be useless if you moved the folder anywhere else (e.g., if you sent it to someone else).
    Well then you might as well create a new property in the http://www.zotero.org/namespaces/export# namespace, because the resource it belongs to is of type <z:Attachment>.
    Yeah, that might be best.
Sign In or Register to comment.