Hi there, you have different options depending on what you want to achieve.
I'll use your example extended with some random namespaces:
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix data: <http://thedata/set1#> .
@prefix ont: <http://ontology/v1#> .
@prefix neo4voc: <http://neo4voc/v1#> .
data:ASSET__OG_O_C_CL-9_0_0_24 rdf:type owl:NamedIndividual , ont:ASSET_class ;
ont:version "4.2" ;
ont:description "" ;
ont:CustomId "OG.O.C.CL-9.0.0.24" ;
ont:Name "Sensitive Enhanced Data" ;
ont:cluster "Policy" ;
ont:source "Orchestra Research" ;
neo4voc:name "Sensitive Enhanced Data" .
OPTION 1:
If you just want namespaces ignored on import, all you need to do is set the handleVocabUris
property to IGNORE
.
call n10s.graphconfig.init({ handleVocabUris: "IGNORE" })
Now when you import the RDF data in the usual way ( I'm using n10s.rdf.import.inline
for this example), the namespaces will be stripped out and you will have more 'query-friendly' names
call n10s.rdf.import.inline('
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix data: <http://thedata/set1#> .
@prefix ont: <http://ontology/v1#> .
@prefix neo4voc: <http://neo4voc/v1#> .
data:ASSET__OG_O_C_CL-9_0_0_24 rdf:type owl:NamedIndividual , ont:ASSET_class ;
ont:version "4.2" ;
ont:description "" ;
ont:CustomId "OG.O.C.CL-9.0.0.24" ;
ont:Name "Sensitive Enhanced Data" ;
ont:cluster "Policy" ;
ont:source "Orchestra Research" ;
neo4voc:name "Sensitive Enhanced Data" .
',"Turtle")
Now when you query you get unprefixed schema elements (property names, relationship names, labels).
The problem with this approach is that you obviously will not be able to regenerate the initially imported RDF. But this may or may not be an issue for you.
OPTION 2:
If you want to export the initial RDF
Create initial config (all defaults)
call n10s.graphconfig.init()
Then (OPTIONALLY) you can add namespace prefix definitions.
For this you only need the header of your RDF doc with the namespace definitions. This is a convenience method that parses the namespace definitions from an RDF fragment (in most serialisation formats). Alternatively, you can add each namespace prefixes individually by using the n10s.nsprefixes.add
method. And of course, if you skip this step, n10s will autogenerate ns0
, ns1
... namespaces for you.
call n10s.nsprefixes.addFromText("
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix data: <http://thedata/set1#> .
@prefix ont: <http://ontology/v1#> .
@prefix neo4voc: <http://neo4voc/v1#> .
")
Import the RDF data with exactly the same n10s.rdf.import.inline
we used in the previous example and when you run the same query,
match (r:Resource) return r
now you get a result similar to the one you showed but slightly more readable because the prefixes will be the same as in your RDF document.
Now if what you want is to get the result of your query as RDF, you can use n10s export capabilities (you can test it from the browser too). It would be something like this;
:POST http://localhost:7474/rdf/neo4j/cypher
{"cypher": "match (r:Resource) return r"}
and you should get exactly the same RDF you imported
Hope this helps,
JB.