如何使用sparql提取带有特定谓词的RDF三元组

如何使用sparql提取带有特定谓词的RDF三元组,sparql,rdf,virtuoso,triplestore,Sparql,Rdf,Virtuoso,Triplestore,我将一组RDF三元组上传到本地Virtuoso端点 在所有这些三元组中,我只想提取那些主语至少包含谓词和 例如,从这些三元组: <http://dbpedia.org/resource/AccessibleComputing> <http://www.w3.org/2000/01/rdf-schema#label> "AccessibleComputing"@en . <http://dbpedia.org/resource/AfghanistanGeography

我将一组RDF三元组上传到本地Virtuoso端点

在所有这些三元组中,我只想提取那些主语至少包含谓词和

例如,从这些三元组:

<http://dbpedia.org/resource/AccessibleComputing> <http://www.w3.org/2000/01/rdf-schema#label> "AccessibleComputing"@en .
<http://dbpedia.org/resource/AfghanistanGeography> <http://www.w3.org/2000/01/rdf-schema#label> "AfghanistanGeography"@en .
<http://dbpedia.org/resource/AfghanistanGeography> <http://www.w3.org/2000/01/rdf-schema#comment> " ... " .
<http://dbpedia.org/resource/Austroasiatic_languages> <http://www.w3.org/2000/01/rdf-schema#comment> " ... " .
<http://dbpedia.org/resource/AccessibleComputing> <http://dbpedia.org/ontology/wikiPageWikiLink> <http://dbpedia.org/resource/Computer_accessibility> .
<http://dbpedia.org/resource/AfghanistanGeography> <http://dbpedia.org/ontology/wikiPageWikiLink> <http://dbpedia.org/resource/Afghanistan_Geography> .
我想得到:

<http://dbpedia.org/resource/AfghanistanGeography> <http://www.w3.org/2000/01/rdf-schema#label> "AfghanistanGeography"@en .
<http://dbpedia.org/resource/AfghanistanGeography> <http://www.w3.org/2000/01/rdf-schema#comment> " ... " .
<http://dbpedia.org/resource/AfghanistanGeography> <http://dbpedia.org/ontology/wikiPageWikiLink> <http://dbpedia.org/resource/Afghanistan_Geography> .
是否可以使用一个或多个SPARQL查询来执行此操作

感谢您的帮助

一种方法是使用描述,例如:

或者使用构造:

一种方法是使用描述,例如:

或者使用构造:

这可以通过构造完成,其中查询:

这是一种简化的构造形式,可以在构造{}部分和WHERE{}部分相同时使用。

这可以通过构造WHERE查询完成:

这是一种简化的构造形式,可以在构造{}部分和WHERE{}部分相同时使用。

descripe的行为取决于SPARQL存储,它可能包括不需要的额外三元组,或者省略需要的三元组。因此,根据所使用的存储,它可能不是一个好的选择。descripe的行为取决于SPARQL存储,它可能包括不需要的额外三元组,或者省略需要的三元组。因此,根据所使用的商店,这可能不是一个好的选择。
DESCRIBE ?s 
WHERE {
  ?s rdfs:label ?label .
  ?s rdfs:comment ?comment .
}
CONSTRUCT { ?subject ?predicate ?object} 
WHERE {
  ?subject ?predicate ?object .
  FILTER EXISTS {
     ?subject rdfs:label ?label .
     ?subject rdfs:comment ?comment .
  }
}
CONSTRUCT WHERE {
    ?s rdfs:label ?label.
    ?s rdfs:comment ?comment.
    ?s ?p ?o
}