Re: SPARQL rdf:type predeclared?

Graham Klyne wrote:
> Some clarification may help...
> 
> With reference to:
> 
> [[
> 2.8.4 rdf:type
> 
> The keyword "a" can be used as a predicate in a triple pattern and is an
> alternative for the IRI rdf:type which is
> http://www.w3.org/1999/02/22-rdf-syntax-ns#type.
> ]]
> -- http://www.w3.org/TR/rdf-sparql-query/#abbrevRdfType
> 
> and the example in the same section:
> [[
>   ?x    rdf:type  :Class1 .
>   _:b0  rdf:type  :appClass .
>   _:b0  :p        "v" .
> ]]
> 
> It's not entirely obvious whether the name rdf:type is predeclared, or if this
> is used must the query also define the rdf: prefix?

rdf: is not predeclared.  The WG decided that there would be no preset 
prefixes and queries must declare them all.  We did discuss it in the early 
days of syntax but its always been that they should be declared.

>  On balance, I think
> rdf:type cannot be used without first defining the rdf: prefix -- could this be
> made clearer?

It does say in the doc conventions that rdf: is the prefix for 
http://www.w3.org/1999/02/22-rdf-syntax-ns#. I took out the rdf:type in the 
text.  Same for http://www.w3.org/1999/02/22-rdf-syntax-ns#nil in "RDF 
Collections" section.

[[
The editors' working draft is currently at:
   http://www.w3.org/2001/sw/DataAccess/rq23/rq24.html
(This version has not been endorsed by the working group yet)

the section you mention is 3.2.4 - the doc has been reorganised quite a lot
   http://www.w3.org/2001/sw/DataAccess/rq23/rq24.html#abbrevRdfType
]]

> 
> (BTW, I think Jena/ARQ may accept rdf:type without a prefix declaration, but
> don't have firm evidence of this.)

No - ARQ does not accept rdf:type without a prefix declaration as per the WG 
decision (RDQL does have predefined prefixes).

There is a SPARQL validator running ARQ at:
http://www.sparql.org/validator.html

http://www.sparql.org/validator?query=SELECT+*+%7B+%3Fx+rdf%3Atype+%3Ft+%7D&languageSyntax=SPARQL&outputFormat=sparql&linenumbers=true

Input:

   1 SELECT * { ?x rdf:type ?t }

Syntax error:

Line 1, column 15: Unresolved qname: rdf:type



> 
> Also, I would assume that the keyword "a" can be used without declaring the rdf:
> prefix.

The keyword "a" is the full IRI - not the prefixed name rdf:type so would not 
need the declaration anyway.

> 
> #g
> 

	Thanks
	Andy

Received on Wednesday, 13 September 2006 19:48:29 UTC