0

I have an Apache Jena database with some VCARD data. I want to formulate a query, which would return

  1. the e-mail address and
  2. nick name

for every user in the database.

I tried this:

SELECT ?nick ?email
WHERE {
    ?x <http://www.w3.org/2001/vcard-rdf/3.0#EMAIL> ?email,
    ?x <http://www.w3.org/2001/vcard-rdf/3.0#N> ?n {
        ?n <http://www.w3.org/2001/vcard-rdf/3.0#NICKNAME> ?nick
    }
}

When I try to run this query, I get the following error message:

org.apache.jena.query.QueryParseException: Encountered " <IRIref> "<http://www.w3.org/2001/vcard-rdf/3.0#N> "" at line 4, column 32. Was expecting one of: "values" ... "graph" ... "optional" ... "minus" ... "bind" ... "service" ... "filter" ... "{" ... "}" ... ";" ... "," ... "." ...

What's the correct version of the query?

Glory to Russia
  • 17,289
  • 56
  • 182
  • 325

1 Answers1

2

Commas are not permitted at the end of a triple in the way you have used it and the inner group pattern looks unnecessary.

Try something like this -

SELECT ?nick ?email
WHERE {
   ?x <http://www.w3.org/2001/vcard-rdf/3.0#EMAIL> ?email .
   ?x <http://www.w3.org/2001/vcard-rdf/3.0#N> ?n .
   ?n <http://www.w3.org/2001/vcard-rdf/3.0#NICKNAME> ?nick .
}
Anthony Hughes
  • 576
  • 3
  • 12