Hi all,

I recently posted an answer to a Stack Overflow question [1] that led
me to write the query

select ?prop ?c
where {
  dbpedia:Milano dbpedia-owl:wikiPageRedirects* [ ?prop ?c ] .
}

and submit it to the DBpedia public endpoint [2] (which has the
appropriate namespace prefixes defined), but I get this error message:

"""
Virtuoso 37000 Error SP031: SPARQL compiler: Object of transitive
triple pattern should be variable or QName or literal, not blank node

SPARQL query:
define sql:big-data-const 0
#output-format:text/html
define sql:signal-void-variables 1 define input:default-graph-uri
<http://dbpedia.org> select ?prop ?c
where {
  dbpedia:Milano dbpedia-owl:wikiPageRedirects* [ ?prop ?c ] .
}
"""

If I explicitly define the prefixes

prefix dbpedia: <http://dbpedia.org/resource/>
prefix dbpedia-owl: <http://dbpedia.org/ontology/>
select ?prop ?c
where {
  rdf:Milano rdf:wikiPageRedirects* [ ?prop ?c ] .
}

and bring it over to sparql.org's validator, I get no complaints, and
it says the query is equivalent to

  1 PREFIX  dbpedia-owl: <http://dbpedia.org/ontology/>
  2 PREFIX  dbpedia: <http://dbpedia.org/resource/>
  3
  4 SELECT  ?prop ?c
  5 WHERE
  6   { dbpedia:Milano (dbpedia-owl:wikiPageRedirects)* _:b0 .
  7     _:b0 ?prop ?c
  8   }

which makes sense, based on 4.1.4 Syntax for Blank Nodes [4] from the
spec which says:

"""
The following two forms
[ :p "v" ] .
[] :p "v" .
allocate a unique blank node label (here "b57") and are equivalent to writing:
_:b57 :p "v" .
"""

I asked about it on the Jena-users list (since the validator is
Jena-based), and got this response from Andy Seaborne:

"""
It's legal syntax.

[[
Virtuoso 37000 Error SP031: SPARQL compiler: Object of transitive
triple pattern should be variable or QName or literal, not blank node
]]

suggests to me it is not an error in parsing but in
translation/compilation afterwards; it's quite specific to the form
you've used.  It might be doing something special for "property*".

> ObjectListPath
> ObjectPath

ObjectPath        ::=   VarOrTerm | TriplesNodePath

VarOrTerm covers the [] case, not the [ ... ] case.

TriplesNodePath   ::=   CollectionPath | BlankNodePropertyListPath

BlankNodePropertyListPath         ::=   '[' PropertyListPathNotEmpty ']'

PropertyListPathNotEmpty ::= ... VerbSimple ObjectListPath ...

matches "?p ?c"

so [ ?prop ?c ] is OK.
"""

Is this a bug in Virtuoso, or something that's a product of some
configuration, or DBpedia using an older version, or… ?

Thanks,
//JT

[1] http://stackoverflow.com/q/19380175/1281433
[2] http://dbpedia.org/sparql
[3] http://www.w3.org/TR/sparql11-query/#rGraphTerm
[4] http://www.w3.org/TR/sparql11-query/#QSynBlankNodes
[5] 
http://mail-archives.apache.org/mod_mbox/jena-users/201202.mbox/%3c4f4019b6.1030...@apache.org%3E

-- 
Joshua Taylor, http://www.cs.rpi.edu/~tayloj/

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
_______________________________________________
Virtuoso-users mailing list
Virtuoso-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtuoso-users

Reply via email to