0

I am using DBpedia SPARQL query to get the list of persons with details. I have DBpedia dump data which is stored locally. When I query, virtuoso gets stop.

Query -

SELECT DISTINCT ?dbpedia_link ?freebase_link str(?abstract) as ?abstract str(?alias) as ?alias
                        str(?birthDate) as ?birthDate str(?birthName) as ?birthName str(?birthPlace) as ?birthPlace
                        str(?label) as ?label str(?occupation) as ?occupation str(?residence) as ?residence
                        str(?spouse) as ?spouse str(?education) as ?education str(?networth) as ?networth str(?salary) as ?salary
                        str(?wikiPageID) as ?wikiPageID str(?wikiPageRevisionID) as ?wikiPageRevisionID str(?shortDescription) as ?shortDescription
                        WHERE {
                    {
                        ?dbpedia_link rdf:type dbpedia-owl:Person
                    }
                    OPTIONAL {?dbpedia_link dbpedia-owl:abstract ?abstract. }
                    OPTIONAL {?dbpedia_link dbpedia-owl:alias ?alias .}
                    OPTIONAL {?dbpedia_link dbpprop:birthDate ?birthDate .} 
                    OPTIONAL {?dbpedia_link dbpprop:birthName ?birthName .} 
                    OPTIONAL {?dbpedia_link dbpprop:birthPlace ?birthPlace .} 
                    OPTIONAL {?dbpedia_link rdfs:label ?label .} 
                    OPTIONAL {?dbpedia_link dbpprop:occupation ?occupation .}
                    OPTIONAL {?dbpedia_link dbpprop:residence ?residence .} 
                    OPTIONAL {?dbpedia_link dbpprop:spouse ?spouse .} 
                    OPTIONAL {?dbpedia_link dbpprop:education ?education .}  
                    OPTIONAL {?dbpedia_link dbpprop:networth ?networth .}  
                    OPTIONAL {?dbpedia_link dbpprop:salary ?salary .}  
                    OPTIONAL {?dbpedia_link dbpedia-owl:wikiPageID ?wikiPageID .}  
                    OPTIONAL {?dbpedia_link dbpedia-owl:wikiPageRevisionID ?wikiPageRevisionID .}
                    OPTIONAL {?dbpedia_link dbpprop:shortDescription ?shortDescription .} 
                    OPTIONAL {?dbpedia_link owl:sameAs ?freebase_link
                    FILTER regex(?freebase_link, "^http://rdf.freebase.com") .}
                }LIMIT "1"
            OFFSET "225930"

Any help on this?

iNikkz
  • 3,729
  • 5
  • 29
  • 59
  • Why don't you increase the timeout variable? – Artemis May 20 '15 at 08:38
  • @Artemis I did. I increased the **MaxQueryExecutionTime** to **600000**. Still not succeed. – iNikkz May 20 '15 at 08:41
  • I think it has something to do with the offset then. Does it work without the offset? Can you explain what exactly you want to achieve? Do you want a person with some of these qualities after your offset? – Artemis May 20 '15 at 09:21
  • 1
    I'm not sure whether it applies to other Virtuoso installations or not, but [this answer](http://stackoverflow.com/q/20937556/1281433) may be useful if it does have something to do with the offset. This is just a guess though; I don't know whether it's related or not. – Joshua Taylor May 20 '15 at 13:06
  • Also, **OFFSET** doesn't really mean anything without an **ORDER BY**. Since the order's not specified, the query could always return the same result. – Joshua Taylor May 20 '15 at 13:07
  • 2
    And, while Virtuoso might accept it, your query isn't legal. The limit and offset need to be number (e.g., **LIMIT 1**, not **LIMIT "1"**), and you need parens around your projection expressions. I.e., `select (count(?foo) as ?nFoo) { .. }`. – Joshua Taylor May 20 '15 at 13:09
  • @JoshuaTaylor: I used LIMIT and OFFSET as number. I didn't work. Finally, I changed those into string and it worked. – iNikkz May 21 '15 at 06:06

1 Answers1

0

Thing 1 -- query edited for clarity, with a few syntax corrections.

SELECT  DISTINCT                               ?dbpedia_link 
                                               ?freebase_link 
                 (           str(?abstract) AS ?abstract           ) 
                 (              str(?alias) AS ?alias              )
                 (          str(?birthDate) AS ?birthDate          ) 
                 (          str(?birthName) AS ?birthName          )
                 (         str(?birthPlace) AS ?birthPlace         )
                 (              str(?label) AS ?label              )
                 (         str(?occupation) AS ?occupation         )
                 (          str(?residence) AS ?residence          )
                 (             str(?spouse) AS ?spouse             )
                 (          str(?education) AS ?education          )
                 (           str(?networth) AS ?networth           )
                 (             str(?salary) AS ?salary             )
                 (         str(?wikiPageID) AS ?wikiPageID         )
                 ( str(?wikiPageRevisionID) AS ?wikiPageRevisionID )
                 (   str(?shortDescription) AS ?shortDescription   )
  WHERE  {
                    { ?dbpedia_link          rdf:type                dbpedia-owl:Person  }
           OPTIONAL { ?dbpedia_link  dbpedia-owl:abstract            ?abstract           }
           OPTIONAL { ?dbpedia_link  dbpedia-owl:alias               ?alias              }
           OPTIONAL { ?dbpedia_link      dbpprop:birthDate           ?birthDate          } 
           OPTIONAL { ?dbpedia_link      dbpprop:birthName           ?birthName          } 
           OPTIONAL { ?dbpedia_link      dbpprop:birthPlace          ?birthPlace         } 
           OPTIONAL { ?dbpedia_link         rdfs:label               ?label              } 
           OPTIONAL { ?dbpedia_link      dbpprop:occupation          ?occupation         }
           OPTIONAL { ?dbpedia_link      dbpprop:residence           ?residence          } 
           OPTIONAL { ?dbpedia_link      dbpprop:spouse              ?spouse             } 
           OPTIONAL { ?dbpedia_link      dbpprop:education           ?education          }  
           OPTIONAL { ?dbpedia_link      dbpprop:networth            ?networth           }  
           OPTIONAL { ?dbpedia_link      dbpprop:salary              ?salary             }  
           OPTIONAL { ?dbpedia_link  dbpedia-owl:wikiPageID          ?wikiPageID         }  
           OPTIONAL { ?dbpedia_link  dbpedia-owl:wikiPageRevisionID  ?wikiPageRevisionID }
           OPTIONAL { ?dbpedia_link      dbpprop:shortDescription    ?shortDescription   } 
           OPTIONAL { ?dbpedia_link          owl:sameAs              ?freebase_link
                          FILTER regex( ?freebase_link, "^http://rdf.freebase.com" )     }
         }
  LIMIT  1
 OFFSET  225930

Thing 2 -- you've got undefined prefixes in there. dbpedia-owl? dbpprop?

Random tinkering and asking random people on the web for help may get you some results, but you're likely to get faster, more accurate, more relevant answers about specific products and tools by asking on forums dedicated to those products and tools, e.g., the DBpedia discussion mailing list, the Virtuoso Users mailing list, etc.

TallTed
  • 9,069
  • 2
  • 22
  • 37