如何在sparql中自动增加变量?

时间:2016-05-31 09:44:24

标签: web-crawler sparql semantic-web sparqlwrapper

我想抓取100页维基百科,所以我想每次将wikiPageID增加1。我该怎么办?

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT  * WHERE {
?saket dbo:wikiPageID 57570.
?saket foaf:isPrimaryTopicOf ?wikilink.  

       OPTIONAL {
            ?saket dbp:birthPlace ?birth.}
       OPTIONAL {
            ?saket dbp:dateOfBirth ?dob.}
       OPTIONAL{
            ?saket dbp:nationality ?country.}
       OPTIONAL{
            ?saket dbp:occupation  ?occupation.}

}

1 个答案:

答案 0 :(得分:2)

   PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

   SELECT  * WHERE {
   ?saket dbo:wikiPageID ?id .
   ?saket foaf:isPrimaryTopicOf ?wikilink.  
   FILTER(?id >= 100 && ?id < 200)

   OPTIONAL {
        ?saket dbp:birthPlace ?birth.}
   OPTIONAL {
        ?saket dbp:dateOfBirth ?dob.}
   OPTIONAL{
        ?saket dbp:nationality ?country.}
   OPTIONAL{
        ?saket dbp:occupation  ?occupation.}
   }