- From: Dan Connolly <connolly@w3.org>
- Date: Tue, 25 Jan 2005 10:36:39 -0600
- To: Dave Beckett <dave.beckett@bristol.ac.uk>
- Cc: RDF Data Access Working Group <public-rdf-dawg@w3.org>
On Tue, 2005-01-25 at 16:13 +0000, Dave Beckett wrote:
> On Tue, 25 Jan 2005 08:49:03 -0600, Dan Connolly <connolly@w3.org> wrote:
>
> > On Tue, 2005-01-25 at 10:36 +0000, Dave Beckett wrote:
> > > 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.
> >
> > Hmmm... these make me uneasy about use/mention issues.
> > It seems to me that functions should take as input
> > the denotation of the terms, not the syntax of the terms.
> >
> > In C, you can't write a function
> >
> > int lastDigitIsZero(float arg){ ... }
> >
> > because when it's called, it will see the same
> > value in both cases:
> >
> > firstDigitIsZero(23.010)
> > and
> > firstDigitIsZero(23.01)
>
> that's because C has types known only at compile time.
>
> In python you can write such a function since a variable's type
> is made at runtime (only made at runtime? I'm not sure)
This is not about when types are known; it's about use vs mention;
i.e. terms versus their denotation.
> >>> foo=23.010
> >>> type(foo)
> <type 'float'>
> >>> str(foo)[0]
> '2'
I meant _last_ digit. (I changed my example while I was drafting it).
> and checking the types at run time
>
> if foo is float:
> # do something
> else:
> # else not
>
> I'm asking for 'is float' functionality for the three types of RDF Term
> that matter, literal, URI and blank node.
No, I don't think you are. I think you want a function
that always returns false for isLiteral(<w3cstats#name>)
even if <w3cstats#age> denotes the same thing that "W3C"
denotes.
> It's equivalent here since you can't tell the type of the RDF term
> that will bind when you ask the question. This functionality is
> needed in order to find that out in the constraints, in order to ask
> make further queries.
>
> So AND lang(?x) = "fr"
> might cause a type error or fail or warn if ?x isn't a literal
>
> wheras
> AND isliteral(?x) && lang(?x) = "fr"
> might be ok
>
>
>
> > This is what makes me uneasy about the str() function;
> > I'd rather that str(<http://www.w3.org/2000/01/rdf-schema#Literal>)
> > be specified to relate class to a string, not a URI to a string.
>
> I can't grok that.
Use versus mention. The subject of "Mary hit the ball" is
either a 4 letter word starting with M or a female person.
>
> > Consider a service that offers queries over the
> > OWL closure of...
> >
> > <orglist#w3c> cyc:age [ :inYears <w3cstats#ageInYears>].
> > <w3cstats#ageInYears> owl:sameAs 10.
> >
> > and a query...
> >
> > SELECT ?ORG, ?QTY
> > WHERE (?ORG cyc:age ?DUR)
> > (?DUR :inYears ?QTY)
> > AND ?QTY > 5.
> >
> > Hmm... I don't think this example makes my point, because
> > the OWL closure will include
> >
> > <orglist#w3c> cyc:age [ :inYears 12].
> >
> > I have been uneasy about this for some time, but I can't seem
> > to construct an example that makes the point sharply, so
> > maybe there is no issue. But I'm still worried.
> >
> > And yes, my worry applies to dtype() and lang() as well.
> >
> > >
> > > I propose adding to 10.2 10.2 Value Testing / RDF Types
> > > http://www.w3.org/2001/sw/DataAccess/rq23/#sparqlTests
> > >
> > > 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
> >
> > Well, they all denote resources. And if you consider terms
> > to be resources, then yes, they're resources. But I think
> > you made a use/mention think-o there.
>
> Possibly. How would you protect a query from doing operations on
> variables bound to RDF literals or blank nodes or URIs, that were
> invalid for one or all of them? Such as trying to do
> lang() or a string equals operation on a variable bound to a URI?
I don't think of queries doing operations. I think of there
being solutions to queries. Either there is a solution that
satisfies the lang() constraint or there isn't.
>
> Dave
--
Dan Connolly, W3C http://www.w3.org/People/Connolly/
D3C2 887B 0F92 6005 C541 0875 0F91 96DE 6E52 C29E
Received on Tuesday, 25 January 2005 16:36:41 UTC