SemanticComputing / fuseki-docker

Apache Jena Fuseki with SeCo extensions
MIT License
33 stars 14 forks source link

New datasets not read after stoping and starting the docker container #6

Closed AnaKostovska closed 3 years ago

AnaKostovska commented 3 years ago

docker run --rm -it -p 3030:3030 --name fuseki -e ADMIN_PASSWORD=admin -e ENABLE_DATA_WRITE=true -e ENABLE_UPDATE=true -e ENABLE_UPLOAD=true -e QUERY_TIMEOUT=60000 --mount type=bind,source="$(pwd)"/fuseki-data,target=/fuseki-base/databases secoresearch/fuseki

I have started running the docker image and created a new dataset 'test' via the FUSEKI UI. After stopping and starting it again, the new dataset 'test' is not there. Isn't it support to offer permanent storage?

Also, when I run the container with the same command written above and I try to upload an RDF graph to the default 'ds' dataset, although it says triples uploaded successfully when I try to query the 'ds' dataset, it is empty.

yoge1 commented 3 years ago

1) Persisting the new dataset 'test': for persisting new datasets added via the Fuseki admin UI, you need to use volume/bind mount for the directory /fuseki-base/configuration. Instructions on this were added to README.md. 2) Uploading RDF graph to dataset 'ds': did you upload the data into the default graph or into a named graph? If into the default graph, you need to use GRAPH <urn:x-arq:DefaultGraph> in your query to access the data. Documentation on this was added to README.md. On the other hand, if you did upload the data into a named graph, could you provide more details (e.g. did you use Fuseki admin UI for uploading)?

Lexachoc commented 1 year ago

In case anyone else has the same problem. Below is my test.ttl located in /fuseki-base/configuration (in docker container) after add a dataset called test (TDB2) via the Fuseki admin UI.

@prefix :       <http://base/#> .
@prefix fuseki: <http://jena.apache.org/fuseki#> .
@prefix ja:     <http://jena.hpl.hp.com/2005/11/Assembler#> .
@prefix rdf:    <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs:   <http://www.w3.org/2000/01/rdf-schema#> .
@prefix tdb2:   <http://jena.apache.org/2016/tdb#> .

:tdb_dataset_readwrite
        rdf:type       tdb2:DatasetTDB2 ;
        tdb2:location  "/fuseki-base/databases/test" .

:service_tdb_all  rdf:type  fuseki:Service ;
        rdfs:label       "TDB2 test" ;
        fuseki:dataset   :tdb_dataset_readwrite ;
        fuseki:endpoint  [ fuseki:name       "data" ;
                           fuseki:operation  fuseki:gsp-rw
                         ] ;
        fuseki:endpoint  [ fuseki:name       "query" ;
                           fuseki:operation  fuseki:query
                         ] ;
        fuseki:endpoint  [ fuseki:name       "sparql" ;
                           fuseki:operation  fuseki:query
                         ] ;
        fuseki:endpoint  [ fuseki:operation  fuseki:query ] ;
        fuseki:endpoint  [ fuseki:operation  fuseki:gsp-rw ] ;
        fuseki:endpoint  [ fuseki:operation  fuseki:update ] ;
        fuseki:endpoint  [ fuseki:name       "update" ;
                           fuseki:operation  fuseki:update
                         ] ;
        fuseki:endpoint  [ fuseki:name       "get" ;
                           fuseki:operation  fuseki:gsp-r
                         ] ;
        fuseki:name      "test" .

what I did is putting this test.ttl file in my local directory, e.g., ./fastapi_app/data/fuseki/configuration Then I can do:

  fuseki:
    image: secoresearch/fuseki
    volumes:
      - ./fastapi_app/data/fuseki/databases:/fuseki-base/databases
      - ./fastapi_app/data/fuseki/configuration:/fuseki-base/configuration

in my docker-compose.yml file

Restart the container and the dataset test is now shown in the admin UI!