cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to query database using rdf

ananthbv
Node Link

Hi,

I'm trying to follow the steps given for exposing data as rdf using neosemantics.

https://neo4j.com/labs/neosemantics/4.0/mapping/

I created a local database 'northwind' and was able to load the data fine with the given cypher commands. When I tried to access the data from the browser using
http://localhost:11004/rdf/northwind/describe/1, it returns just one line, like below:

@prefix sch: http://schema.org/ .

From the neo4j browser, I can see that this command returns the data correctly.

match(n) where id(n) = 1 return n

I can also confirm that the neo4j.conf contains this line:

dbms.unmanaged_extension_classes=n10s.endpoint=/rdf

Other relevant lines from the config file are:

dbms.connector.http.enabled=true
dbms.connector.http.listen_address=:11004
#dbms.connector.http.advertised_address=:7474

Also, when I execute this command on the browser (after :use northwind),

northwind$ :GET /rdf

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.

Are there any other settings that I need to turn on in the config files to make the data available through rdf?

3 REPLIES 3

I have the same problem.... does anybody has a solution?

Rcolinp
Ninja
Ninja

Hey there @ananthbv @torstenlabs ,

I can try to help you guys out! To start off, to ensure the neosemantics plugin (jar file) & your neo4j.conf file are setup and configured correctly - run the following GET request in your Neo4j Browser: 

 

 

:GET http://localhost:7474/rdf/ping

 

or rather 

:GET http://localhost:11004/rdf/ping

If your Neo4j instance has been configured correctly, you will get receive the response:

 

 

{"ping":"here!"}

 

 

If you receive an error message of any kind, then the problem lies within your configuration or .jar file. 

If 

 

 

{"ping":"here!"}

 

 

is being returned - great! 

@ananthbv When you say, "When I tried to access the data from the browser using
http://localhost:11004/rdf/northwind/describe/1, it returns just one line, like below:

@prefix sch: http://schema.org/ .". Are you attempting a GET request? (i.e. :GET http://localhost:11004/rdf/northwind/describe/1)?

 

 

:GET http://localhost:<port>/neo4j/<db_name>/describe/id

 

or specifically:

:GET http://localhost:11004/rdf/northwind/describe/1

the above should work fine. Not specifying "GET" as a get request will yield nothing. I.e.:

 

http://localhost:<port>/neo4j/<db_name>/describe/id

 



Regarding "Also, when I execute this command on the browser (after :use northwind)," - 

 

 

:GET /rdf

 

 

Are you attempting to send a GET request to retrieve serialized RDF or ontology? If so try the following:

 

 

:GET http://localhost:11004/rdf/neo4j/onto?format=N-Triples

 

 

or if you are attempting a post request using cypher: 

 

 

:post http://localhost:11004/rdf/northwind/cypher 
{"cypher": "match p = (a)-[r]-(b) return p", "format": "Turtle"}

 

 

 My hunch is that when you are leaving out your local instances hostname and port (http://localhost:11004) and using the shorthand of

 

 

:GET /rdf/neo4j/

 

 

Neo4j Browser is assuming you are running https & you are then sending a GET & POST requests to https://localhost:11004 which is why you see 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.

 

 

Hope this helps! Post back here if not! 

Best,
Rob

ananthbv
Node Link

Hi Rob, Thank you for replying. This is still a problem. I was able to get the reply to ping correctly, as below.

 

 

 

:GET http://localhost:11004/rdf/ping

{"ping":"here!"}

 

 

 

But the describe is still returning 1 line without any details.

:GET http://localhost:11004/rdf/northwind/describe/1

@prefix sch: <http://schema.org/> .

The data for node 1 is available in the database, so the problem does not seem to be with the underlying data.

match (n) where id(n) = 1 return n

╒══════════════════════════════════════════════════════════════════════╕
│"n"                                                                   │
╞══════════════════════════════════════════════════════════════════════╡
│{"unitPrice":19.0,"unitsInStock":17,"reorderLevel":25,"supplierID":"1"│
│,"productID":"2","quantityPerUnit":"24 - 12 oz bottles","discontinued"│
│:false,"productName":"Chang","categoryID":"1","unitsOnOrder":40}      │
└──────────────────────────────────────────────────────────────────────┘

Regarding the last error, you were right, I was passing the relative path to the GET command. 

Please let me know if you have any other suggestions. Perhaps there is some setting that is missing?

 
Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.