2
我想構建一個SPARQL查詢,其中填入了我設置爲文字的值。在SPARQL中選擇文字?
例如
SELECT 'A', 'B', attribute
FROM
TABLE
將返回一個表可能看起來像這樣的:
A | B | attribute
-------|---------|--------------
A | B | Mary
A | B | has
A | B | a
A | B | little
A | B | lamb
我想要做的是運行一個像這樣的查詢來獲取所有的對象類型的triplestore:
select distinct ?o ("class" as ?item_type)
where {
?s rdf:type ?o.
}
然後(理想情況下)UNION它與第二個查詢,拉出所有不同的謂詞值:
select distinct ?p ("predicate" as ?item_type)
where {
?s ?p ?o.
}
種
其結果可能是:
item | item_type
-----------------|-----------------
a_thing | class
another_thing | class
a_relation | predicate
another_relation | predicate
但在SPARQL一個聯盟額外的where子句中,這意味着我不能指定ITEM_TYPE文字我希望注入我的結果只能鏈接組。
你的意思是'(? 「對象」 作主語)'?這仍然是一種相當古怪的說法。也許你想說'(「class」爲?item_type)'和'(「謂詞」爲?item_type)'? – scotthenninger
是的,這是一個更清潔的方式。我會修改。 –