1

I have on a Web server an URL which serializes a RDF triplestore with Python module rdflib. I want to import this content into GraphDB.

The rdflib.serialize output format is "xml". The MIME type of the HTTP header is "xml/rdf" but the result is the same with the MIME type "text/rdf".

When the content is saved to a text file ending with ".rdf" extension, GraphDB can import this file without problem, and the repository content is OK.

The URL can be imported in the software "Protégé" which is a semantic web tool and RDF editor.

But, when importing the same URL into GraphDB, I get the error message:

"Could not find RDF format for URL: (... my url ... )"

I tried several things, without success:

  • I checked that GraphDB expects the same data format from URL and text files.
  • In GraphDB "Import advanced settings", I unchecked the flags "Verify URI" and "should stop on error".
  • I tried with Apache web server and a simple Python class BaseHTTPServer.

I suspect that this error message comes from the openrdf library which outputs this message when it cannot determine the content type based on the file extension of the URL or the content type in the HTTP response header, but I think I set it correctly.

What is the problem?

Jeen Broekstra
  • 21,642
  • 4
  • 51
  • 73
remi.chateauneu
  • 109
  • 2
  • 9
  • 1
    Neither "xml/rdf" nor "text/rdf" are correct MIME-types. It should be "application/xml+rdf" or possibly "application/xml" or "text/xml". – Jeen Broekstra Mar 03 '19 at 22:28
  • 1
    Sorry, that should be "application/rdf+xml", not "application/xml+rdf". See http://docs.rdf4j.org/javadoc/latest/index.html?org/eclipse/rdf4j/rio/RDFFormat.html#RDFXML – Jeen Broekstra Mar 03 '19 at 22:54
  • 1
    'application/xml' worked perfectly. "application/xml+rdf" did not work. Many thanks. – remi.chateauneu Mar 03 '19 at 23:00
  • 1
    as an aside: unless you are using a _very_ old version of GraphDB, it's more likely to be using the rdf4j libraries instead of openrdf sesame. Sesame was discontinued a few years ago, Eclipse rdf4j is the successor project. – Jeen Broekstra Mar 04 '19 at 02:44

1 Answers1

3

(converting comment to answer)

The problem is that "xml/rdf" and "text/rdf" are not known MIME-types for the RDF/XML file format.

The correct MIME-type to use is "application/rdf+xml". Optionally as a fallback "application/xml" or "text/xml" may also work. See the rdf4j javadoc for RDF formats for details.

Jeen Broekstra
  • 21,642
  • 4
  • 51
  • 73