Skip to content

Equivalent for VALUES #69

Answered by josd
ktk asked this question in Q&A
Discussion options

You must be logged in to vote

It can be done in 1 line :-)

The example in https://www.w3.org/TR/sparql11-query/#inline-data-examples can be written in N3 as

@prefix dc:   <http://purl.org/dc/elements/1.1/> .
@prefix :     <http://example.org/book/> .
@prefix ns:   <http://example.org/ns#> .
@prefix list: <http://www.w3.org/2000/10/swap/list#>.

:book1  dc:title  "SPARQL Tutorial" .
:book1  ns:price  42 .
:book2  dc:title  "The Semantic Web" .
:book2  ns:price  23 .

# SELECT ?book ?title ?price
# {
#    VALUES ?book { :book1 :book3 }
#    ?book dc:title ?title ;
#          ns:price ?price .
# }

{
    (:book1 :book3) list:member ?book.
    ?book dc:title ?title ;
        ns:price ?price .
} => {
    [] :result (?book …

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by ktk
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants