Showing results for 
Search instead for 
Did you mean: 

Head's Up! Site migration is underway. Phase 1: replicate users.

Exporting RDF with 4.0 and 3.5.x

Node Clone

Hi Jesus,

I've playing around with exporting data with Neosemantics and had a question:

  1. Does Neosemantics expand the prefixes in properties when you try to export some RDF? For example, if I tried something like:

call n10s.rdf.export.cypher("match(n:skos__ConceptScheme{uri:''}) return n")

Then I'll see:

subject predicate object isLiteral literalType literalLang
"neo4j://individuals#1965" "" "neo4j://vocabulary#skos__ConceptScheme" false null null
"neo4j://individuals#1965" "neo4j://vocabulary#uri" "" true "" null
"neo4j://individuals#1965" "neo4j://vocabulary#rdfs__label" "My Test Vocabulary Name" true "" null
"neo4j://individuals#1965" "" "neo4j://vocabulary#Resource" false null null

In looking at the code, it appears as if Neosemantics things that the nodes being exported are not RDF nodes and therefore the property names aren't being converted back into RDF properly? I'm guessing that's somehow my issue, I can just can't figure out why that is happening though?

I thought I would try to do the above using the http api for Neosemantics, I tried a bunch of different things such as, http://localhost:7474/rdf/describe/uri/ and http://localhost:7474/rdf/n10s/neo4j/describe/uri/ (from looking at the unit tests) but keep getting a 404. So I'm not really sure how to use the extension via http. I can however get the ping to work if I hit the /rdf/n10s/ping context path.

I see the same behavior with the export using 3.5.x as well.

Is there something particular that is needed to export RDF that conforms to what was loaded? Hopefully I haven't missed anything silly. I did comb through the current docs and the new docs without any luck so far.



Hi @r.moquin, you're right the n10s.rdf.export.cypher method at the moment only exports RDF from a Property Graph model. But I expect to have its behavior fixed for the GA release by the end of the week.

In 4.0 you can achieve it using the RDF http endpoint. Here's how:

:post http://localhost:7474/rdf/n10s/mydb/cypher
{ "cypher" : "match p = (r:Resource { uri: ''})--() return p " , "format": "Turtle" }

where mydb is the name of the database you're using ('neo4j' if it's the default one).

Similarly, for the describe method, you can invoke it as follows:
:get http://localhost:7474/rdf/n10s/mydb/describe/xxxxxxx

where mydb is again your db name and xxxx is the 'URL encoded' URI of the resource you want to get serialised. You can do the encoding programmatically or for testing you can use this page.

By using the endpoint, you should get exactly the RDF you imported, triple by triple.

(for 3.5 you can check the documentation here)

Sorry for the difficulties you're finding but this will all be described properly in the documentation, bear with us, we're getting there 😉

Hope this helps, please let me know if there's anything unclear.



You don't need to apologize. I'm just very thankful that you are so responsive and helpful. 🙂 Documentation is very time consuming and is a lot of work in addition to the development work that needs done.

This is why I try to make sure that I look through documentation when it is available, to minimize the chance of wasting someone's time asking a question that already spent time to answer in their documentation. 😉

I get what I was doing wrong now, I feel silly. Because I didn't url encode the IRI, the IRI was being interpreted as an additional sequence of paths in the url. I'm used to web browsers auto encoding characters as needed in parameters but completely forgot the web browser doesn't know what part of a path in a URI is a dynamic parameter and might need encoded.

My bad. It looks much better if I hit the URL directly. The only initial thing I'll mention, but I'm sure you know this, is that the neo4j prefixes that are added, are added whether or not they are used in the rdf response or not. That is an extremely trivial thing though.

I'm looking forward to the release of 4.0. Thanks for all the work you put you into this!