-
Notifications
You must be signed in to change notification settings - Fork 2
Home
Welcome to the object-teller wiki!
- If however, you do indeed really want to reuse the URIs of deleted resources, you can remove the tombstone with: curl -X DELETE http://localhost:8080/rest/some/deleted/node/fcr:tombstone
The REST-API documentation has been recently updated (thanks Chris!). https://wiki.duraspace.org/display/FEDORA451/RESTful+HTTP+API#RESTfulHTTPAPI-RedDELETEDeletearesource
We are usually reading from the fuseki query endpoint by posting a sparql query. Here's an example:
curl -X POST -H "Content-Type: application/sparql-query" -H "Cache-Control: no-cache" -H "Postman-Token: ce3d6a23-414e-fdcb-b7df-af4ed6823e1e" -d /
'
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX ot: <http://dlhs-fedora-dev-a.umms.med.umich.edu:8080/fcrepo/rest/>
select *
WHERE {?s ?p ?o .
FILTER (?s = ot:99999-fk45h7sd3p || ?o = ot:99999-fk45h7sd3p)
}
' "http://dlhs-fedora-dev-a.umms.med.umich.edu:8080/fuseki/test/query"But, we are writing to the fedora fcrepo rest endpoint directly. The fuseki triplestore is indexed by a process running in the karaf backend contaner using an activemg messaging bus. If karaf or the activemq message bus goes down, fedora and fuseki can get out of sync.
Info on how to get things restarted and run a reindexing is scarce, but even if you managed that there may be objects in fedora without corresponding triples in fuseki, and vice versa. At some point fuseki should pick up the changes or existence of objects that are, in fact, in the fedora repo, and there should be some way to just delete the triplestore and have it rebuilt, but we couldn't figure it out (will update when we do.)
the fcrepo/rest endpoint provides a DELETE operation (which has to be followed by another DELETE operation for the "tombstone" object; see the documentation) which works on an entire object graph. That DELETE operation should sync to fuseki anyway, so give that a try when you really want to get rid of an object in the fedora repo.
After that deletion, or if things are just wonky, there may be fuseki triples for an object that's not even in fedora. We don't think things will EVER synchronize in that case. Here's one way to delete the fuseki triples for an object. The basic idea is to POST a SPARQL delete { ?s ?p ?o } query with a where clause that selects any triple with that object as subject or object:
curl -X POST -H "Content-Type: application/sparql-update" -H "Cache-Control: no-cache" -H "Postman-Token: 0c19dcf2-6d3a-bf65-6e5e-9933188793ac" -d /
'
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX ot: <http://dlhs-fedora-dev-a.umms.med.umich.edu:8080/fcrepo/rest/>
DELETE { ?s ?p ?o }
WHERE {?s ?p ?o .
FILTER (?s = ot:99999-fk4tt4wd3r || ?o = ot:99999-fk4tt4wd3r)
}
' "http://dlhs-fedora-dev-a.umms.med.umich.edu:8080/fuseki/test/update"We suspect there will still be triples in fuseki with references to the child containers...but it should keep the phantom objects from showing up in the library UI. To get rid of triples whose subject has that object as parent, something like this might work:
curl -X POST -H "Content-Type: application/sparql-query" -H "Cache-Control: no-cache" -H "Postman-Token: 1fd6e6e7-5410-7c8c-cc42-e7684d743092" -d /
'
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX ko: <http://dlhs-fedora-dev-a.umms.med.umich.edu:8080/fcrepo/rest/>
PREFIX ot: <http://uofm.org/objectteller/>
select *
WHERE {?s ?p ?o .
?s <http://fedora.info/definitions/v4/repository#hasParent> ko:99999-fk4tt4wd3r
}
' "http://dlhs-fedora-dev-a.umms.med.umich.edu:8080/fuseki/test/query"curl -X POST -H "Content-Type: application/sparql-update" -H "Cache-Control: no-cache" -H "Postman-Token: 7d03971b-0c65-a350-240e-fe51e364e89a" -d \
'
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX ot: <http://uofm.org/objectteller/>
PREFIX lib: <http://dlhs-fedora-dev-a.umms.med.umich.edu:8080/fcrepo/rest/>
DELETE {
lib:99999-fk40s01p75 dc:title ?o0;
ot:contributors ?o1;
ot:description ?o2;
ot:owner ?o3;
ot:keywords ?o4;
ot:licenseName ?o5;
ot:licenseLink ?o6 .
}
INSERT {
lib:99999-fk40s01p75 dc:title "Icon Array";
ot:contributors "Andrew Cullen V";
ot:description "JavaScript object to generate visual representation of risk scores. To use, create a div with an id=<any id name>, then create a dictionary with the proper values to pass into the draw_array function. Run the function, and the object will draw the visual where you put your div in the html code. NOTE: this knowledge object uses D3.JS, so to use it you have to include a script source to D3";
ot:owner "";
ot:keywords "Icon, Visual";
ot:licenseName "";
ot:licenseLink "null" .
}
WHERE {
lib:99999-fk40s01p75 dc:title ?o0;
ot:contributors ?o1;
ot:description ?o2;
ot:owner ?o3;
ot:keywords ?o4;
OPTIONAL { lib:99999-fk40s01p75 ot:licenseName ?o5;
ot:licenseLink ?o6 . }
}
' "http://dlhs-fedora-dev-a.umms.med.umich.edu:8080/fuseki/test/update"...and the equivalent fedora update query
curl -X PATCH -H "Content-Type: application/sparql-update" -H "Authorization: Basic ZmVkb3JhQWRtaW46c2VjcmV0MzIx" -H "Cache-Control: no-cache" -H "Postman-Token: c0c64a7d-68e8-7ffb-9e58-0e0c08b1e4db" -d /
'
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX ot: <http://uofm.org/objectteller/>
PREFIX lib: <http://dlhs-fedora-dev-a.umms.med.umich.edu:8080/fcrepo/rest/>
DELETE {
lib:99999-fk40s01p75 dc:title ?o0;
ot:contributors ?o1;
ot:description ?o2;
ot:owner ?o3;
ot:keywords ?o4;
ot:licenseName ?o5;
ot:licenseLink ?o6 .
}
INSERT {
lib:99999-fk40s01p75 dc:title "Icon Array";
ot:contributors "Andrew Cullen VI";
ot:description "JavaScript object to generate visual representation of risk scores. To use, create a div with an id=<any id name>, then create a dictionary with the proper values to pass into the draw_array function. Run the function, and the object will draw the visual where you put your div in the html code. NOTE: this knowledge object uses D3.JS, so to use it you have to include a script source to D3";
ot:owner "";
ot:keywords "Icon, Visual";
ot:licenseName "";
ot:licenseLink "null" .
}
WHERE {
lib:99999-fk40s01p75 dc:title ?o0;
ot:contributors ?o1;
ot:description ?o2;
ot:owner ?o3;
ot:keywords ?o4;
OPTIONAL { lib:99999-fk40s01p75 ot:licenseName ?o5;
ot:licenseLink ?o6 . }
}
' "http://dlhs-fedora-dev-a.umms.med.umich.edu:8080/fcrepo/rest/99999-fk40s01p75"