Number of incoming link fo each DBpedia resource

左心房为你撑大大i 提交于 2019-12-22 19:15:23

问题


I have the SPARQL DBpedia Query below:

PREFIX rdfs:   <http://www.w3.org/2000/01/rdf-schema#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX vrank:<http://purl.org/voc/vrank#>
PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>
SELECT distinct  ?Nom ?resource ?url (count( (?o) as ?nb))
 WHERE{
   ?resource rdfs:label ?Nom.
   ?resource foaf:isPrimaryTopicOf ?url.
   ?resource dbpedia-owl:wikiPageWikiLink ?o
   ?Nom <bif:contains> "Apple".
   FILTER ( langMatches( lang(?Nom), "EN" )).
MINUS {?resource dbo:wikiPageRedirects|dbo:wikiPageDisambiguates  ?dis}
    }
Group By  ?Nom ?resource ?url

I want to get the number of incoming links of each entitie within wikipedia. How can I proceed? Thanks


回答1:


First of all syntax:

you are missing a dot after ?o, also it should be bif:contains, not <bif:contains>.

Next:

i ran this simpler query:

PREFIX rdfs:   <http://www.w3.org/2000/01/rdf-schema#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX vrank:<http://purl.org/voc/vrank#>
PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>
SELECT distinct  ?Nom ?resource
 WHERE{
   ?resource rdfs:label ?Nom.
   ?Nom bif:contains "Apple".
}

which produced a lot of results.... now i added this triple:

PREFIX rdfs:   <http://www.w3.org/2000/01/rdf-schema#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX vrank:<http://purl.org/voc/vrank#>
PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>
SELECT distinct  ?Nom ?resource
 WHERE{
   ?resource rdfs:label ?Nom.
   ?resource dbpedia-owl:wikiPageWikiLink ?o.
   ?Nom bif:contains "Apple".
}

which returned no results.

this means there is no triple containing apple in its object literal, where the subject has a wikiPageWikiLink in the whole endpoint.

If this property does exist, its instances are not included in the official endpoint since there is no triple containing this property (I checked). This is probably due to the fact, that the official endpoint does not hold every dbpedia dataset, or it might be deprecated.



来源:https://stackoverflow.com/questions/34810267/number-of-incoming-link-fo-each-dbpedia-resource

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!