Importing RDF file (turtle), error "Namespace prefix 'file' used but not defined [line 1]"

Hi,
I am trying to import an RDF file with my ontology (produced with protegé) exported in Turle format. I have tried to import the content or file using various commands like:

  1. CALL n10s.rdf.import.inline("Turle", "", {})
  2. CALL n10s.rdf.import.inline("file:///Users/kailashdejesushornig/Desktop/D_MBP_OLD2/DAT475_Ad_Databases/Assignment_4/Assignment_2.ttl", "Turtle")
  3. CALL n10s.rdf.import.inline("file:///Users/kailashdejesushornig/Desktop/D_MBP_OLD2/DAT475_Ad_Databases/Assignment_4/Assignment_2.ttl", "TriG", {})

But none seem to work. Either I get an "Unrecognized serialization format:" with the call nr 1., or I get "Namespace prefix 'file' used but not defined [line 1]" for calls like 2.3.

I have also tried with;
4. CALL apoc.import.rdf("file:///Users/kailashdejesushornig/Desktop/D_MBP_OLD2/DAT475_Ad_Databases/Assignment_4/Assignment_2.ttl", "Turtle") --> but this results in Neo.ClientError.Procedure.ProcedureNotFound, which I have tried to troubleshoot as well with restarting, checking compatibility, and so on. But without success.

Can anyone help me, primarily with the "Namespace prefix 'file' used but not defined [line 1]" error?

Hi @dejesushornig ,

The method to import from a file uses fetch instead of inline. You can read more here.

The .inline variant takes the actual RDF payload as input.

I would expect this to be the right syntax for you:

CALL n10s.rdf.import.fetch("file:///Users/kailashdejesushornig/Desktop/D_MBP_OLD2/DAT475_Ad_Databases/Assignment_4/Assignment_2.ttl", "Turtle")

For completeness, here's an example of what usage of the inline variant would look like:

call n10s.rdf.import.inline('

@prefix neo4voc: <http://neo4j.org/vocab/sw#> .
@prefix neo4ind: <http://neo4j.org/ind#> .

neo4ind:nsmntx3502 neo4voc:name "NSMNTX" ;
         a neo4voc:Neo4jPlugin ;
         neo4voc:version "3.5.0.2" ;
         neo4voc:releaseDate "03-06-2019" ;
         neo4voc:runsOn neo4ind:neo4j355 .


','Turtle')

Note how I'm passing the actual RDF instead of a reference to a document that contains the RDF.

Also worth mentioning that there are some procedures specifically created to import ontologies (as opposed to any generic RDF serialised data). Depending on your intended use, they might be worth trying.

Hope this helps.

JB.

Hi,
Great, big thanks!!

Best regards