0
在這樣的查詢中,如何避免?p
被綁定到rdf:type
?將屬性限制在rdf中:type
select ?p ?c where {
<http://dbpedia.org/resource/Istance_1> ?p ?c.
<http://dbpedia.org/resource/Istance_2> ?p ?c.
}
在這樣的查詢中,如何避免?p
被綁定到rdf:type
?將屬性限制在rdf中:type
select ?p ?c where {
<http://dbpedia.org/resource/Istance_1> ?p ?c.
<http://dbpedia.org/resource/Istance_2> ?p ?c.
}
添加filter
到您的查詢:
select ?p ?c where {
<http://dbpedia.org/resource/Istance_1> ?p ?c.
<http://dbpedia.org/resource/Istance_2> ?p ?c.
filter(?p != rdf:type)
}
這是典型的使用前綴dbpedia:
爲http://dbpedia.org/resource/
,和我預期Istance
被假設是Instance
,所以有一點清理的,你將有
prefix dbpedia: <http://dbpedia.org/resource>
select ?p ?c where {
dbpedia:Instance_1 ?p ?c .
dbpedia:Instance_2 ?p ?c .
filter(?p != rdf:type)
}
如果您要複製並粘貼到public DBpedia SPARQL endpoint,您w不需要定義該前綴,因爲它和bunch of others are predefined,但如果你將它稱爲其他一些時尚,你將需要。
非常感謝你! – user2837896