On Sun, Mar 2, 2014 at 8:42 PM, Kingsley Idehen <[email protected]> wrote:
> When we write a query like:
>
> select ?s,?p,?o where {
> ?s ?p ?o. filter (?p = foaf:name).
> }
>
> Is there a way to write query like following, but still l get ?p or the
> relations connecting the two:
>
> select ?s,?o where
> {
> ?s foaf:name ?o.
> }
I'm not exactly sure what you're asking, but I think you might be
looking for VALUES, with which you could write:
select ?s ?p ?o where {
values ?p { foaf:name }
?s ?p ?o
}
You'll have ?p in the result set, but it can only be bound to values
from the VALUES block, so in this case it will only be foaf:name. You
can specify more than one value in a block, of course, e.g.:
select ?s ?p ?o where {
values ?p { foaf:name rdfs:label }
?s ?p ?o
}
and you can specify multiple VALUES blocks, too. E.g.:
select ?s ?p ?o where {
values ?s { :Peter :Paul :Mary }
values ?p { foaf:name rdfs:label }
?s ?p ?o
}
VALUES is described in the W3C spec, 10.2 VALUES: Providing inline data [1]
//JT
[1] http://www.w3.org/TR/sparql11-query/#inline-data
--
Joshua Taylor, http://www.cs.rpi.edu/~tayloj/
------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works.
Faster operations. Version large binaries. Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
Virtuoso-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/virtuoso-users