W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > January to March 2005

Please add RDF term checking operators to sparql

From: Dave Beckett <dave.beckett@bristol.ac.uk>
Date: Tue, 25 Jan 2005 10:36:34 +0000
To: RDF Data Access Working Group <public-rdf-dawg@w3.org>
Message-ID: <20050125103634.7871b8be@hoth.ilrt.bris.ac.uk>

I think these would be useful operators for value testing of SPARQL
RDF Terms, to go along with lang() and dtype()* operating on
literal terms.

I propose adding to 10.2 10.2 Value Testing / RDF Types

possibly a new section or could be in one of the existing ones:

10.2.3 SPARQL Operations on RDF Terms

The following table provides operations to test if an expression is
one of the three RDF Terms[#href to definition in section 2.2].

Operator: isblank(arg)
Meaning: Tests if the expression is an RDF blank node
                ( http://www.w3.org/TR/rdf-concepts/#dfn-blank-node )
Return: xsd:boolean
  isblank(_:a)       => true
  isblank(<uri>)     => false
  isblank("literal") => false

Operator: isuri(arg)
Meaning: Tests if the expression is an RDF URI Reference 
              ( http://www.w3.org/TR/rdf-concepts/#dfn-URI-reference )
Return: xsd:boolean
  isuri(<uri>)     => true
  isuri(_:blank)   => false
  isuri("literal") => false

  [ could be isresource() but then they are all RDF resources

Operator: isliteral(arg)
Meaning: Tests if the expression is an RDF Literal
               ( http://www.w3.org/TR/rdf-concepts/#dfn-literal )
Return: xsd:boolean
  isliteral(<uri>)     => true
  isliteral(_:blank)   => false
  isliteral("literal") => true

Examples of use

Find literals in French
  WHERE (?x ?y ?z)
  AND isLiteral(?z) and lang(?z) = "fr"

Find blank subject nodes
  WHERE (?x ?y ?z)
  AND isBlank(?x)

Find triples with URIs
  WHERE (?x ?y ?z)
  AND isURI(?z)


* Yuck - datatype() is a full word for 3 chars more and we have rdf:datatype
lang() is OK since xml:lang has lots of use
Received on Tuesday, 25 January 2005 10:39:23 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:00:33 UTC