0
我插入使用Node.js的API測試文檔:如何使用SPARQL查詢Marklogic三元組?
db.documents.write(
{
uri: "/test/doc1.json",
contentType: "application/json",
collections: "test",
content: {
name : "Peter",
"triple": {
"subject": {
"datatype": "http://example.com/name/",
"value": "Peter"
},
"predicate": {
"datatype": "http://example.com/relation/",
"value": "livesin"
},
"object": {
"datatype": "http://example.com/location/",
"value": "Paris"
}
}
}
}
).
result(function(response){
console.log("Done loading");
});
然後我試圖在Marklogic控制檯web應用程序通過SPARQL查詢它:
SELECT ?s ?p ?o
WHERE { ?s ?p ?o }
上面的查詢工作正常,它檢索測試三重我上面插入
但是,如果我想用文字值「巴黎」來過濾,我試過如下:
PREFIX loc: <http://example.com/location/>
SELECT ?s ?p
WHERE { ?s ?p loc:Paris }
但在這種情況下,我得到零結果。這個語法不正確?我只是下面的查詢中https://docs.marklogic.com/guide/semantics/semantic-searches
是什麼做的正確方法是什麼樣子?
優秀。謝謝! –