简体   繁体   English

使用Sparql获取DBpedia中实体类型之间的所有可能的谓词

[英]Geting all possible predicates between Entity types in DBpedia using Sparql

I am trying to get all the possible predicates that are possible in between two entity types. 我试图获取两种实体类型之间可能存在的所有可能的谓词。 Below is the example for two entities with Person type. 以下是两个具有Person类型的实体的示例。

SELECT distinct ?p 
WHERE { ?url1 rdf:type <http://dbpedia.org/ontology/Person> . 
        ?url2 rdf:type <http://dbpedia.org/ontology/Person> . 
        ?url1 ?p ?url2 . 
        FILTER(STRSTARTS(STR(?p), "http://dbpedia.org/ontology")).
      }

However, the resulting output consists of predicates like birthPlace , deathPlace which definitely cannot be in between two Person types. 但是,结果输出包含谓词,例如birthPlacedeathPlace ,它们肯定不能在两种Person类型之间。

Am I missing any constraints to get more logical outputs? 我是否缺少任何约束以获取更多逻辑输出?

Not sure whether it's not worth to provide it as an answer ... 不知道提供它作为答案是否值得...

You're missing only one point: 您只缺少一点:

The data in DBpedia is not perfect and free of noise since it's automatically extracted from Wikipedia. 由于DBpedia中的数据是自动从Wikipedia中提取的,因此它不是完美无缺的。

You can check why this happens when you use 您可以检查为什么在使用时会发生这种情况

SELECT * WHERE { 
  ?url1 rdf:type <http://dbpedia.org/ontology/Person> . 
  ?url2 rdf:type <http://dbpedia.org/ontology/Person> . 
  ?url1 <http://dbpedia.org/ontology/birthPlace> ?url2 . 
}
limit 10

Among others, you get 除其他外,您得到

+-------------------------------------------+------------------------------------------------------------------------+
|                   url1                    |                                  url2                                  |
+-------------------------------------------+------------------------------------------------------------------------+
| http://dbpedia.org/resource/Analía_Núñez  | http://dbpedia.org/resource/David                                      |
| http://dbpedia.org/resource/Jorvan_Vieira | http://dbpedia.org/resource/Luís_Alves_de_Lima_e_Silva,_Duke_of_Caxias |
| http://dbpedia.org/resource/Adebayo_Lawal | http://dbpedia.org/resource/Offa_of_Mercia+                            |
| ...                                       | ...                                                                    |
+-------------------------------------------+------------------------------------------------------------------------+

Let's have a look at http://dbpedia.org/resource/Analía_Núñez : 让我们看一下http://dbpedia.org/resource/Analía_Núñez

DESCRIBE <http://dbpedia.org/resource/Analía_Núñez>

Among others, it returns the triples 其中,它返回三元组

dbr:Analía_Núñez  dbo:birthPlace    dbr:Panama ,
                                    dbr:David ,
                  <http://dbpedia.org/resource/David,_Chiriqu\u00ED> .

You can see three birth places. 您可以看到三个出生地。 While it should be http://dbpedia.org/resource/David,_Chiriqu%C3%AD , you can see that something went wrong during the extraction from the infobox in the Wikipedia article about Analía Núñez . 虽然它应该是http://dbpedia.org/resource/David,_Chiriqu%C3%AD ,但是您可以从Wikipedia文章中有关AnalíaNúñez的信息框中提取信息时看到错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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