SPARQL:从dbpedia中提取不同的值 [英] SPARQL: extract distinct values from dbpedia

查看:90
本文介绍了SPARQL:从dbpedia中提取不同的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从DBPedia中提取5个人(电影)的图形。

I want to extract graphs for 5 individuals who are Film(or movies) from DBPedia.

我的查询是:

ParameterizedSparqlString qs = new ParameterizedSparqlString( +

construct {?s?p?o} +
where {?sa http://dbpedia.org/ontology/Film 。 +
?s?p?o}偏移0 LIMIT 5);

我得到以下结果:

1- http://dbpedia.org/resource/1001_Inventions_and_the_World_of_Ibn_Al-Haytham http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://dbpedia.org/ontology/Film

2- http://dbpedia.org/resource/1001_Inventions_and_the_World_of_Ibn_Al-Haytham http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://www.w3.org/2002/07/owl#Thing

3- http://dbpedia.org/resource/1001_Inventions_and_the_World_of_Ibn_Al-Haytham < a href = http://www.w3.org/1999/02/22-rdf-syntax-ns#type rel = nofollow> http://www.w3.org/1999/02/22- rdf-syntax-ns#type http://www.wikidata.org/entity/Q386724

4- http:// dbpedia.org/resource/1001_Inventions_and_the_World_of_Ibn_Al-Haytham http://www.w3.org/1999/02/22-rdf -syntax-ns#type http://dbpedia.org/ontology/Wikidata:Q11424

5- http:// dbpedia .org / resource / 1001_Inventions_and_the_World_of_Ibn_Al-Haytham http:/// /www.w3.org/1999/02/22-rdf-syntax-ns#type http:/ /dbpedia.org/ontology/Work

问题:
同一部电影的归还率是所有班级的5倍:电影,事物, Q386724,WIKIdata:Q11424和Work是等效类(或存在子类关系)。

Problem: The same film is returned 5 times as all the class: Film, Thing, Q386724,WIKIdata:Q11424, and Work are equivalent class (or Subclass relation exist).

我的问题:

我要返回一次三元组

 <http://dbpedia.org/resource/1001_Inventions_and_the_World_of_Ibn_Al-Haytham>    
 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
 <http://dbpedia.org/ontology/Film> .

并过滤掉其他四个三元组。

and filter out the other 4 triples.

请问如何?

先谢谢您

推荐答案

我认为您想要此查询

construct {?s a <http://dbpedia.org/ontology/Film> .}
where { ?s a <http://dbpedia.org/ontology/Film>. }
limit 5

这篇关于SPARQL:从dbpedia中提取不同的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆