[ 
https://issues.apache.org/jira/browse/JENA-2340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17567879#comment-17567879
 ] 

Enrico Daga commented on JENA-2340:
-----------------------------------

Hi Andy, thanks for the explanation.

 

> {{BNODE}} behaves like {{[]}} and {{_:label}} in a {{CONSTRUCT}} template.

 

However, there may be cases where one wants to project the same bnode multiple 
times to the construct, and join the resulting triples. To solve this issue we 
developed our own function: 
[https://github.com/SPARQL-Anything/sparql.anything/issues/273]

I am writing this comment just because I wonder whether this is the intended 
behaviour of BNODE().

 

> bnode() with literal argument
> -----------------------------
>
>                 Key: JENA-2340
>                 URL: https://issues.apache.org/jira/browse/JENA-2340
>             Project: Apache Jena
>          Issue Type: Comment
>    Affects Versions: Jena 4.5.0
>            Reporter: Justin
>            Assignee: Andy Seaborne
>            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]

Reply via email to