Reputation: 1100
I have Jena(2.6.4) and ARQ(2.8.8) and can't delete data from the triple store. SPARQL request:
DELETE {?doc ?p ?o}
WHERE { ?doc ?p ?o;
<http://example#fullName> <file:/c:/1.txt> }
This request works fine in Sesame Workbench.
But when I try to issue it from Java with DB2 v.10 RDF triple store nothing happens:
Dataset ds = RdfStoreFactory.connectDataset(store, conn);
GraphStore graphStore = GraphStoreFactory.create(ds) ;
UpdateAction.parseExecute(deleteDocumentString, graphStore);
The only way I have found - compare strings:
{?doc base:fullName ?fname. FILTER(str(?fname) = "file:/c:/1.txt")
Upvotes: 0
Views: 1531
Reputation: 16700
<file:/c:/1.txt>
is not a proper URI (it's not properly absolute, although file: URLs are not very well defined).
The formal defintion of file: URls requires: file://host/path
and host
maybe omitted, giving file:///
.
The SPARQL parser converts it to
You can test this with
arq.qparse --file QueryInFile.rq
It seems the data loading does not do the same step. The Jena RIOT parse issues a warning when run from the command line:
WARN [line: 1, col: 46] Bad IRI: <file:/c:/1.txt> Code: 57/REQUIRED_COMPONENT_MISSING in AUTHORITY: A component that is required by the scheme is missing.
Best to fix the data.
Upvotes: 2
Reputation: 22052
You don't say what error you get, but given that you are using very old versions of Jena and ARQ, I would suspect that the problem is simply that they don't support SPARQL update requests. I suggest you upgrade to a newer version of Jena (or stick to Sesame :))
Update It looks to me as if there is a problem in your data. Your update operation and the query you use both try to treat the value for fullName
as a URI (because you use URI syntax by placing it in angle brackets, like so:
<file:/c:/1.txt>
However, apparently that value does not exist as a URI in your data (since the SELECT query you do does not return it, and the DELETE operation you use with it does not delete anything). Since the version where you do a string-based check does work, I suspect that in your data, the value is a Literal, rather than a URI.
The following might work:
DELETE {?doc ?p ?o}
WHERE { ?doc ?p ?o;
<http://example#fullName> "file:/c:/1.txt" .
}
Though the above will only work if the literal value is an untyped literal with no language tag. Otherwise, the alternative you found yourself (using a FILTER condition on the string-value) is a fine way to handle this. Or, of course, modify your actual data, if you want these values to be URIs instead of literals.
Upvotes: 1