简体   繁体   中英

executing sparql query on all the result of another sparql query

Suppose I have a list of names returned from a sparql query. And another query that uses a name from this list and returns something else. How can I execute this query on all names in the list returned by the other query? Thank you

You use a subquery. Eg,

select ?country ?capital {
  { select ?country {
      #-- criteria for selecting country
  }

  ?country :hasCapital ?country
}

Note that in trivial cases, you wouldn't need a separate subquery, you could just do:

select ?country ?capital {
  #-- criteria for selecting country
  ?country :hasCapital ?country
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM