使用过滤器的SPARQL查询

使用过滤器的SPARQL查询,sparql,dbpedia,Sparql,Dbpedia,我对如何使用过滤器有一些疑问 当我在dbpediasparql端点中使用下面的查询时,检索到1个结果。 但是,如果我从查询中去掉过滤器langMatcheslang?sl、'en'和&langMatcheslang?ol、'en',那么就没有检索到任何内容。 我认为应该有更多的结果,因为没有使用过滤器 这怎么可能呢 SPARQL端点:dbpedia.org/SPARQL PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

我对如何使用过滤器有一些疑问 当我在dbpediasparql端点中使用下面的查询时,检索到1个结果。 但是,如果我从查询中去掉过滤器langMatcheslang?sl、'en'和&langMatcheslang?ol、'en',那么就没有检索到任何内容。 我认为应该有更多的结果,因为没有使用过滤器

这怎么可能呢

SPARQL端点:dbpedia.org/SPARQL

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT ?s ?sl (<http://xmlns.com/foaf/0.1/depiction> as ?p) ?o ?ol

WHERE {
  ?s rdfs:label ?sl . 
  ?s <http://xmlns.com/foaf/0.1/depiction> ?o .
  ?o rdfs:label ?ol .

  FILTER (   langMatches(lang(?sl),'en') && langMatches(lang(?ol),'en') )  <------- this part
} 
LIMIT 100

这很奇怪,我确实看到了你所说的结果。您已经有了一个web服务,可以对其运行查询,并且很容易对查询进行一些修改,以获得有关所发生情况的更多信息。首先,让我们看看在没有过滤器的情况下总共有多少个结果:

select (count(*) as ?nResults) where {
  ?s rdfs:label ?sl . 
  ?s <http://xmlns.com/foaf/0.1/depiction> ?o .
  ?o rdfs:label ?ol .
} 

请注意:SPARQL中的注释字符是。我们可以复制和粘贴您的查询,如果您这样做的话,问题已经说明在每种情况下检索了多少个结果,不是分别为1和0吗?@O.R.Mapper我的错误;问题是1和无。我已经从答案中删除了这一点。
select (count(*) as ?nResults) where {
  ?s rdfs:label ?sl . 
  ?s <http://xmlns.com/foaf/0.1/depiction> ?o .
  ?o rdfs:label ?ol .
  filter ( langMatches(lang(?sl),'en') && langMatches(lang(?ol),'en') )
} 
select * where {
  ?s rdfs:label ?sl . 
  ?s <http://xmlns.com/foaf/0.1/depiction> ?o .
  ?o rdfs:label ?ol .
} 
select * where {
  ?s rdfs:label ?sl . 
  ?s <http://xmlns.com/foaf/0.1/depiction> ?o .
  ?o rdfs:label ?ol .
  filter ( langMatches(lang(?sl),'en') && langMatches(lang(?ol),'en') )
} 
s  <http://dbpedia.org/resource/Franz_Kruckenberg>
sl "Franz Kruckenberg"@en
o  <http://dbpedia.org/resource/Schienenzeppelin>
ol "Schienenzeppelin"@en
select * where {
  ?s <http://xmlns.com/foaf/0.1/depiction> [ rdfs:label ?dl ]
} 
dl                      s
---------------------------------------------------------------------
"Schienenzeppelin"@de   http://dbpedia.org/resource/Franz_Kruckenberg
"Schienenzeppelin"@en   http://dbpedia.org/resource/Franz_Kruckenberg
"Schienenzeppelin"@fr   http://dbpedia.org/resource/Franz_Kruckenberg
"Schienenzeppelin"@it   http://dbpedia.org/resource/Franz_Kruckenberg
"シーネンツェッペリン"@ja   http://dbpedia.org/resource/Franz_Kruckenberg
"Schienenzeppelin"@pl   http://dbpedia.org/resource/Franz_Kruckenberg
"Рельсовый Цеппелин"@ru http://dbpedia.org/resource/Franz_Kruckenberg
"Schienenzeppelin"@sv   http://dbpedia.org/resource/Franz_Kruckenberg