[
https://issues.apache.org/jira/browse/JENA-2340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17567532#comment-17567532
]
Justin commented on JENA-2340:
------------------------------
That is a very helpful explanation! Thank you for that.
So there is no bug with Jena but it does make me think it might have been more
useful for SPARQL to specify the behavior of bnode() with an argument like:
"If the form with a simple literal is used, every call results in distinct
blank nodes for different simple literals, and the same blank node for calls
with the same simple literal {-}within expressions for one [solution
mapping|https://www.w3.org/TR/sparql11-query/#defn_sparqlSolutionMapping].{-}"
That is how I think people expect it to work and I think it would be more
useful like that. It seems like the way it is currently specified it is only
useful for upgrading a literal into a bnode but we can do something perhaps
better already: upgrade a literal to a URI.
Thanks again for the example and explanation [~andy] .
> bnode() with literal argument
> -----------------------------
>
> Key: JENA-2340
> URL: https://issues.apache.org/jira/browse/JENA-2340
> Project: Apache Jena
> Issue Type: Bug
> Affects Versions: Jena 4.5.0
> Reporter: Justin
> Priority: Major
> Attachments: a2.rq, a2.ttl
>
>
> [^a2.rq]
>
> About the bnode() function:
> "If the form with a simple literal is used, every call results in distinct
> blank nodes for different simple literals, and the same blank node for calls
> with the same simple literal within expressions for one [solution
> mapping|https://www.w3.org/TR/sparql11-query/#defn_sparqlSolutionMapping]."
> [https://www.w3.org/TR/sparql11-query/]
>
> In the following example I expected the same bnode to appear multiple times
> in the o_node column. But instead Jena doesn't reuse any of the bnodes.
> {code:java}
> root@354840b30d6f:/mnt# cat ./a2.ttl
> @prefix : <http://example/>
> :s0 :p "one" .
> :s1 :q "one" .
> :s1 :p "one" .
> :s2 :p "two" .
> :s3 :p "two" .
> root@354840b30d6f:/mnt# cat ./a2.rq
> prefix : <http://example/>
> select *
> where{
> ?s ?p ?o
> bind(bnode(?o) as ?o_node)
> }
> root@354840b30d6f:/mnt# ./apache-jena-4.5.0/bin/sparql --data=./a2.ttl
> --query=./a2.rq
> -----------------------------
> | s | p | o | o_node |
> =============================
> | :s0 | :p | "one" | _:b0 |
> | :s3 | :p | "two" | _:b1 |
> | :s2 | :p | "two" | _:b2 |
> | :s1 | :p | "one" | _:b3 |
> | :s1 | :q | "one" | _:b4 |
> ----------------------------- {code}
> How do you get the bnode() function with a literal argument to return the
> same bnode?
> I feel like perhaps I am not understanding what it means to have "one
> solution mapping."
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]