- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试在 http://dbpedia.org/sparql 上运行此查询但我得到一个错误,我的查询太贵了。当我通过 http://dbpedia.org/snorql/ 运行查询时我得到:
The estimated execution time 25012730 (sec) exceeds the limit of 1500 (sec) ...
当使用 SPARQLWrapper 通过我的 python 脚本运行查询时,我只得到一个 HTTP 500。
我认为我需要做一些事情来优化我的 SPARQL 查询。我需要数据来遍历教育机构并将其导入本地数据库,也许我使用的 SPARQL 有误,应该以完全不同的方式执行此操作。
希望有人能帮助我!
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX : <http://dbpedia.org/resource/>
PREFIX dbpedia2: <http://dbpedia.org/property/>
PREFIX dbpedia: <http://dbpedia.org/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
SELECT DISTINCT ?uri
?name
?homepage
?student_count
?native_name
?city
?country
?type
?lat ?long
?image
WHERE {
?uri rdf:type dbpedia-owl:EducationalInstitution .
?uri foaf:name ?name .
OPTIONAL { ?uri foaf:homepage ?homepage } .
OPTIONAL { ?uri dbpedia-owl:numberOfStudents ?student_count } .
OPTIONAL { ?uri dbpprop:nativeName ?native_name } .
OPTIONAL { ?uri dbpprop:city ?city } .
OPTIONAL { ?uri dbpprop:country ?country } .
OPTIONAL { ?uri dbpprop:type ?type } .
OPTIONAL { ?uri geo:lat ?lat . ?uri geo:long ?long } .
OPTIONAL { ?uri foaf:depiction ?image } .
}
ORDER BY ?uri
LIMIT 20 OFFSET 10
最佳答案
算了。仅使用一个 SPARQL 将无法从 dbpedia 返回该查询。那些可选项非常昂贵。
要解决这个问题,您需要先运行类似以下内容:
SELECT DISTINCT ?uri WHERE {
?uri rdf:type dbpedia-owl:EducationalInstitution .
?uri foaf:name ?name .
} ORDER BY ?uri
LIMIT 20 OFFSET 10
然后遍历此查询的结果集,为每个 dbpedia-owl:EducationalInstitution
形成单个查询例如 ...(注意查询末尾的过滤器):
SELECT DISTINCT ?uri
?name
?homepage
?student_count
?native_name
?city
?country
?type
?lat ?long
?image
WHERE {
?uri rdf:type dbpedia-owl:EducationalInstitution .
?uri foaf:name ?name .
OPTIONAL { ?uri foaf:homepage ?homepage } .
OPTIONAL { ?uri dbpedia-owl:numberOfStudents ?student_count } .
OPTIONAL { ?uri dbpprop:nativeName ?native_name } .
OPTIONAL { ?uri dbpprop:city ?city } .
OPTIONAL { ?uri dbpprop:country ?country } .
OPTIONAL { ?uri dbpprop:type ?type } .
OPTIONAL { ?uri geo:lat ?lat . ?uri geo:long ?long } .
OPTIONAL { ?uri foaf:depiction ?image } .
FILTER (?uri = <http://dbpedia.org/resource/%C3%89cole_%C3%A9l%C3%A9mentaire_Marie-Curie>)
}
在哪里<http://dbpedia.org/resource/%C3%89cole_%C3%A9l%C3%A9mentaire_Marie-Curie>
已从第一个查询中获得。
... 是的,它会很慢,您可能无法为在线应用程序运行它。建议:尝试制定出某种缓存机制以位于您的应用程序和 dbpedia SPARQL 端点之间。
关于query-optimization - SPARQL 查询的优化。 [预计执行时间超过 1500(秒)的限制],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6280670/
我正在使用 SPARQL,我想知道是否可以在 in 子句中放入 sparql?更具体地说,我需要获取对此 sparql 查询具有特定条件的实体(s1,s2)[s1 在某个字段上的聚合值大于 5] se
我们有办法在 SPARQL 中做一个不减少的累加和吗? 例如, SELECT ?p WHERE { VALUES ?p { 1 1 2 } } ORDER BY ?p 将导致 1 2 4, - 而
在这个小片段中,第二行的 a 是做什么的? CONSTRUCT { ?uri a skos:Concept ; skos:prefLabel ?prefLabel ; 我确
我写了一个 Sparql 查询。 PREFIX table: SELECT ?name ?color FROM WHERE { ?element table:group ?group. ?gro
下面的两个查询有什么区别吗? select distinct ?i where{ ?i rdf:type . FILTER EXISTS { ?i ?b.
我不太明白为什么在SPARQL中他们没有实现基本的逻辑运算符。然而,在大多数情况下,可以通过多种方式获得相同的结果。 这个问题的目的是快速引用可以替代“or”语句的可能方式。 这是我能想到的: 1)联
我的问题很简单:我有一个源my:g1,其中包含: my:a1 my:b "literal 1" 然后我有第二个源my:g2,其中包含: my:a2 my:b my:c. my:c rdfs:label
我在处理数字数据类型时遇到 SPARQL 问题。 我有一个本体 ( http://cabas.ugr.es/ontology/ugr ),我在其中定义了一对属性,表示特定性别的学生人数:
我有以下 SPARQL 查询: PREFIX rdfs: PREFIX type: PREFIX prop: SELECT * WHERE { ?person a foaf:Per
我想知道如何在sparql中表达以下问题: “请告诉我每个 child 都上麻省理工学院的 parent ” 更一般地说,我想知道查询 sparql 的限制是什么?请问数据库中有哪些类型的答案不能
我正在尝试编写一个优雅的 SPARQL,为多个可能的查询提供一个解决方案。我有多个主语和多个谓词,我想接收一个对象。单一解决方案的存在非常不确定,因此我给出了多种选择。如果我没记错的话,这可以通过以下
这是一个关于 Sparql 和 Wikidata 的问题。我想制定一个返回实例类型关系的查询,但如果它不可用,则返回其子类。我尝试过: SELECT DISTINCT ?ent_type WHER
我想做一些类似的事情 { SELECT ?page, "A" AS ?type WHERE { ?s rdfs:label "Microsoft"@en;
我正在尝试进行 SPARQL 查询,该查询返回一个变量,其中包含两个单词,由某些内容分隔。实际上,我尝试获取一个变量,如 ?πληθυσμός_population(希腊语和英语)。但是,我更喜欢与“
我想知道 SPARQL 默认情况下是否采用开放世界假设,或者这是否取决于执行 SPARQL 查询的三元组存储。 这个假设在查询中的含义是什么。 致以诚挚的问候。 最佳答案 嗯.... 我想知道这对于这
我在处理数字数据类型时遇到 SPARQL 问题。 我有一个本体 ( http://cabas.ugr.es/ontology/ugr ),我在其中定义了一对属性,表示特定性别的学生人数:
我正在玩DBPedia . 通过这个查询,我得到了所有出生在伦敦的人: SELECT ?person WHERE { ?person dbo:birthPlace :London } 但
我需要处理 SPARQL 查询。有没有人有很好的链接来学习 SPARQL 查询?我正在寻找有关 SPARQL 查询和示例语法的好文章,以便我可以快速学习。 最佳答案 Lee Feigenbaum 的
我有一个 SPARQL 查询,它在 Virtuoso SPARQL 查询编辑器中运行时提供结果,但相同的查询在 SPARQL 查询验证器中给出语法错误。问题是什么?为什么显示语法错误? PREFIX
我正在运行 sparql 查询 PREFIX rdfs: PREFIX rdfs: SELECT DISTINCT(?film_link) ?film_name ?wiki
我是一名优秀的程序员,十分优秀!