cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Problem exporting RDF using NeoSemantics N10S

john1
Node Link

I am trying to export some RDF from the sample northwind database using the neosemantics plugin in my neo4j desktop environment.
OS: windows 10
Desktop version: 1.2.9
Neo4j version: 4.1.0
Neosemantics version: neosemantics-4.0.0.1.jar

I run the following command in the browser:

:GET /rdf/neo4j/describe/78

I get the following error message:

Could not fetch URL: "Failed to fetch". This could be due to the remote server policy. See your web browsers error console for more information.

When I run the following command from the browser: http://localhost:7474/rdf/neo4j/describe/78

http://localhost:7474/rdf/neo4j/describe/78

The system produces an empty RDF file with no error message

I can successfully run the following command from the browser so I think it is installed correctly.

call n10s.graphconfig.show
9 REPLIES 9

john1
Node Link

I run the following command from firefox:
http://localhost:7474/rdf/neo4j/describe/78

Now I get the following error message:

XML Parsing Error: no root element found
Location: http://localhost:7474/rdf/neo4j/describe/78
Line Number 1, Column 1:

john1
Node Link

I think I've figured this out. The documentation states:

The only required parameter is node’s unique identifier: If the graph is the result of importing RDF using n10s it will be the uri and if the graph is not the result of importing RDF, then we’ll use the node ID. Whether we’re in one case or the other will be determied by the **presence** of a Graph Configuration (see Chapter 3, Configuring Neo4j to use RDF data)

Since I'm exporting graph data that was not the result of importing graph data I needed to delete the "graph configuration" using the following command:

call n10s.graphconfig.drop

Now I run the describe command shown above in Firefox and get the following error:

XML Parsing Error: not well-formed
Location: http://localhost:7474/rdf/neo4j/describe/78
Line Number 1, Column 1:@prefix neoind: <neo4j://individuals#> .

However if I run the same describe command in MSFT Edge I get no error and a file is downloaded with the generated RDF.

Hey John, sorry for the late reply. What did you use for your graph config? Depending on what you have set for handleVocabUris you may need to use the node's URI.

For example:

:GEThttp://localhost:7474/rdf/neo4j/describe/http%3A%2F%2Fneo4j.com%2Findiv%23The_Stones

Have you tried the n10s Graph App yet? You should be able to play with the HTTP call on the export screen. You can install it at install.graphapp.io.

Hi @adam.cowley, is there a solution to this problem? I got the same error when using the ':POST /rdf/neo4j/cypher' in Neo4j Browser, and got an empty RDF file when using 'describe' approach. Is it the fact that Neo4j Desktop version doesn't support RDF exporting?

Hi @hellozhengxiaochen,
if you use the following command :POST /rdf/neo4j/cypher {...} Neo4j Desktop will throw the following error:

Could not fetch URL: "Failed to fetch". This could be due to the remote server policy. See your web browsers error console for more information.


To see the resulting rdf file in Neo4j Desktop, you need to have the full URI. Since you are using Neo4j Desktop, running the following command should solve your problem: :POST http://localhost:7474/rdf/neo4j/cypher {...} .

For example:

:POST http://localhost:7474/rdf/neo4j/cypher 
{"cypher": "MATCH p=()-->() RETURN p", "format": "Turtle"} 


As for the empty file, I have been using the url with describe multiple times in the past week without problem, so I'm not sure that I can help you further.

Hi @philippe.carrier22,
Many thanks for the help!
I managed to fetch some results by changing to HTTP post. A new problem appears though. Not sure if you have any idea.
I imported an ontology to Neo4j using n10s.onto.import.fetch("file:xxx.ttl","Turtle",{ handleVocabUris: "IGNORE" }) .
Then I added some new entities to the imported ontology in Neo4j.
The problem now is I can get the entities from the original ontology, but not for the newly added entities. It returns an empty result for the new ones. This is also the cause of the previous empty file issue.

Do you have any idea about that?

Really appreciate your help!

It seems like you are having difficulties linking the right element to it's ontology. What I would do is mapped my ontology onto neo4j element. You can find more information here: Neo4j Mapping Documentation.

Then instead of using the ignore, this is what you would do:

call n10s.graphconfig.init({ handleVocabUris: 'MAP' })

Then you create your prefix (1) and mapping (2):

call n10s.nsprefixes.add("prefix", "http://example.com")
call n10s.mapping.add("http://example.com/label", "LABEL")


This can be done for both node label and relationship label. With that you will be able to import and export following the same ontology.

Hope this help

This is exactly what I was looking for! Problem solved.
Thank you very much for your help!

BTW, just for future readers, there is a typo for the second line of code. It should be n10s.nsprefixes.add(). "es" was missing.

I don't think the RDF export works with neo4j desktop. According to the n10s 4.0 documentation, you need to have this line in the neo4j conf file in the server version to enable HTTP RDF export

dbms.unmanaged_extension_classes=n10s.endpoint=/rdf