On 03/12/2025 13:03, Patrice Neff wrote:
> Hi,
>
> I have been looking into supporting updating of reifying triples in Jena.
> Please do let me know if this should be a discussion on a GitHub issue
> instead.
>
> The SPARQL 1.2 Update Working Draft has the following example (section
> 3.1.2, Example 6):
The example is wrong.
Would you mind raising an issue for this?
https://github.com/w3c/sparql-update/issues
Thanks.
It would work in RDF-star (The preceding community group work).
> PREFIX : <http://www.example.org/>
> DELETE DATA
> {
> :alice :claims << :bob :age 23 >>.
> }
>
> Running this against the latest Fuseki results in the error "Blank
nodes not
> allowed in DELETE templates".
This not a Jena issue - it's a consequence of <<>> being syntactic sugar
for input, and it is not stored as-is in the data.
DELETE DATA
{
:alice :claims _:b .
_:b rdf:reifies <<( :bob :age 23 ) >>.
}
This isn't specific new-style reification.
DELETE DATA { [ rdfs:label "foobar" . ] }
DELETE DATA { :s :p (1 2 3) . }
do not work either because each has one or more blank nodes in the
template and those blank nodes are not the ones in the data.
What does work is
DELETE WHERE { :alice :claims << :bob :age 23 ~ ?r >> }
The "~ ?r" captures the real blank node in the data and puts that in the
triples to be deleted.
Alternatively, allocate the reifier when the data is created before
reloading into Fuseki.
This can be a URI, allocated by the data pubisher - it can be generated
like urn:uuid:ABCD - but it's generated by user/client/application and
can be written down. If it's implicitly created by the server parser, it
then requires a WHERE to find and use it.
If the input is:
:alice :claims << :bob :age 23 ~ :reif1234 >>.
then
DELETE DATA { :alice :claims << :bob :age 23 ~ :reif1234 >> }
works. No blank nodes.
I have been investigating whether it would be possible to implement this.
But before investing too much time into it, I'd like to discuss this here
first in case there was a conscious decision made not to support this
functionality.
An initial source code investigation has revealed the existing method
RDFStar.reificationSubject to create stable identifiers for reified triples.
It looks like I could use that in QueryParserBase.insertTripleReifier
instead of the current BNode it aims to create.
Class RDFStar is related to the earlier RDF-start Community Group work,
not RDF 1.2.
An initial proof of concept hack for this approach was successful. But it
will require some further parser changes to avoid handling the annotation
syntax (e.g. syntax-triple-terms-negative/syntax-update-anonreifier-02.ru is
now considered valid syntax).
I'm happy to do the legwork on this and provide a pull request. But first I
wanted to make sure I'm not wasting my time on something the project team
actively wanted to avoid doing. Plus there are likely further complications
in implementing this I'm not yet aware of.
It would be non-standard. The specs define the meaning of the syntactic
sugar.
This is four different triples - each <<>> is a fresh blank node.
:alice :claims << :bob :age 23 >> .
:alice :claims << :bob :age 23 >> .
Andy
Best,
Patrice