aws / graph-notebook

Library extending Jupyter notebooks to integrate with Apache TinkerPop, openCypher, and RDF SPARQL.
https://github.com/aws/graph-notebook
Apache License 2.0
723 stars 166 forks source link

[BUG] Issue with SPARQL path in Fuseki documentation #702

Open ibrahimfathy2 opened 6 days ago

ibrahimfathy2 commented 6 days ago

Community Note

Describe the bug

%%graph_notebook_config
{
  "host": "localhost",
  "port": 3030,
  "ssl": false,
  "sparql": {
    "path": "ds/sparql"
  }
}

This config found in graph-notebook/tree/main/additional-databases/fuseki didn't run the queries successfully, the only config that succeeded was path: "ds" not "ds/sparql"

michaelnchin commented 6 days ago

Hi @ibrahimfathy2 , thank you for submitting an issue!

This config found in graph-notebook/tree/main/additional-databases/fuseki didn't run the queries successfully, the only config that succeeded was path: "ds" not "ds/sparql"

I tried out both [dataset] and [dataset]/sparql paths on Fuseki 5.1.0 + graph-notebook 4.6.0. It looks like Fuseki allows the extra /sparql path for read queries, but not update queries. Both read and write work fine in the base [dataset] path.

3c22fb5e1f47:apache-jena-fuseki-5.1.0 chnmch$ ./fuseki-server --update --mem /ds
Picked up JAVA_TOOL_OPTIONS: -Dlog4j2.formatMsgNoLookups=true
21:45:31 INFO  Server          :: Apache Jena Fuseki 5.1.0
21:45:31 INFO  Config          :: FUSEKI_HOME=/Users/chnmch/Downloads/apache-jena-fuseki-5.1.0/.
21:45:31 INFO  Config          :: FUSEKI_BASE=/Users/chnmch/Downloads/apache-jena-fuseki-5.1.0/run
21:45:31 INFO  Config          :: Shiro file: file:///Users/chnmch/Downloads/apache-jena-fuseki-5.1.0/run/shiro.ini
21:45:31 INFO  Config          :: Template file: templates/config-mem
21:45:32 INFO  Server          :: Database: in-memory
21:45:32 INFO  Server          :: Path = /ds
21:45:32 INFO  Server          ::   Memory: 4.0 GiB
21:45:32 INFO  Server          ::   Java:   21.0.4
21:45:32 INFO  Server          ::   OS:     Mac OS X 14.4.1 x86_64
21:45:32 INFO  Server          ::   PID:    50417
21:45:32 INFO  Server          :: Started 2024/09/24 21:45:32 PDT on port 3030
21:45:50 INFO  Fuseki          :: [1] POST http://localhost:3030/ds/sparql
21:45:50 INFO  Fuseki          :: [1] 400 Bad Request (26 ms)
21:45:50 INFO  Fuseki          :: [2] POST http://localhost:3030/ds/sparql
21:45:50 INFO  Fuseki          :: [2] 400 Bad Request (0 ms)
21:46:07 INFO  Fuseki          :: [3] POST http://localhost:3030/ds
21:46:07 INFO  Fuseki          :: [3] 200 OK (44 ms)
21:46:29 INFO  Fuseki          :: [4] POST http://localhost:3030/ds/sparql
21:46:29 INFO  Fuseki          :: [4] Query = SELECT ?s ?p ?o WHERE {?s ?p ?o} LIMIT 10 
21:46:29 INFO  Fuseki          :: [4] 200 OK (44 ms)
21:46:55 INFO  Fuseki          :: [5] POST http://localhost:3030/ds
21:46:55 INFO  Fuseki          :: [5] Query = SELECT ?s ?p ?o WHERE {?s ?p ?o} LIMIT 10 
21:46:55 INFO  Fuseki          :: [5] 200 OK (12 ms)

Not sure if something changed Fuseki side paths since that documentation was contributed, but your suggestion looks valid. I'll add an update to the current docs, thanks!

michaelnchin commented 6 days ago

Regarding:

Graph Notebook Version: [3.7.3]

%%sparql --expand-all SELECT ?s ?p ?o WHERE { ?s ?p ?o }

Throws an error {'error': AttributeError("'DataFrame' object has no attribute 'map'")}

To match, I tried downgrading my graph-notebook version from 4.6.0 to 3.7.3. This also broke my ability to use %%sparql against Fuseki 5.1.0.

Graph-notebook v3.7.3 is over 2.5 years old at this point, and may not have the best compatibility with the latest graph database versions. Can you try upgrading to graph-notebook v4.6.0 and see if that resolves the issue?