You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Alexey Shulchenkov <al...@soarse.com> on 2021/10/12 07:24:35 UTC

RDF* support in QueryBuilder

Hi there,
I use Jena 4.2.0 and QueryBuilder to create SPARQL queries.

How to describe the following query snippet using QueryBuilder?

SELECT ?s ?p ?o
WHERE {
  << ?s ?p ?o >> ?predicate ?object
}

I tried the following expression but it results in an
IllegalArgumentException
*Subject (%s) must be a URI, blank, variable, or a wildcard.*

.addWhere(NodeFactory.createTripleNode(new Triple(s, p, o), predicate,
object))

Re: RDF* support in QueryBuilder

Posted by Andy Seaborne <an...@apache.org>.
Hi Alexey,

Thanks for the report - it is a bug.

Could you please raise a JIRA ticket for this?

A workaround is

WHERE
   { ?X  ?predicate ?object
     FILTER isTriple(?X)
     BIND(subject(?X) AS ?s)
     BIND(predicate(?X) AS ?p)
     BIND(object(?X) AS ?o)
   }

     Andy

Info: It's "RDF-star".

The community work split the naming into "RDF*" for Olaf Hartig's 
original work and "RDF-star" for the community work. They are not quite 
the same.

And it's easy to search for "RDF-star".

On 12/10/2021 08:24, Alexey Shulchenkov wrote:
> Hi there,
> I use Jena 4.2.0 and QueryBuilder to create SPARQL queries.
> 
> How to describe the following query snippet using QueryBuilder?
> 
> SELECT ?s ?p ?o
> WHERE {
>    << ?s ?p ?o >> ?predicate ?object
> }
> 
> I tried the following expression but it results in an
> IllegalArgumentException
> *Subject (%s) must be a URI, blank, variable, or a wildcard.*
> 
> .addWhere(NodeFactory.createTripleNode(new Triple(s, p, o), predicate,
> object))
>