2015-12-07 17 views
0

我試圖更新使用SPARQL一些數據數據添加到RDF。這裏是什麼樣的原始數據是這樣的:我想在SPARQL

<http://dbpedia.org/resource/Switzerland#1 > 
   <http://www.w3.org/2000/01/rdf-schema#label > "1"@ja ; 
   <http://linkdata.org/property/rdf1s2307i#num > "1"@ja ; 
   <http://learningsparql.com/ns/addressbook#code > "1234"@ja . 

這就是我想要的數據看起來像在更新後:

<http://dbpedia.org/resource/Switzerland#1 > 
   <http://www.w3.org/2000/01/rdf-schema#label > "1"@ja ; 
   <http://linkdata.org/property/rdf1s2307i#num > "1"@ja ; 
   <http://learningsparql.com/ns/addressbook#code > "1234"@ja ; 
   <http://learningsparql.com/ns/addressbook#name > "taro"@ja . 

我已經得到了我想要使用查詢,但我最終得到了一個錯誤。這裏的查詢和我得到的錯誤:

PREFIX schema: <http://www.w3.org/2000/01/rdf-schema# > 
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos# > 
PREFIX ab: <http://learningsparql.com/ns/addressbook# > 
PREFIX res: <http://www.w3.org/2000/01/rdf-schema# > 

INSERT DATA{ 
    GRAPH <http://ddd.test/addressbook> { ab:name "taro" . } 
} 

SQLSTATE:22023消息:SR007:功能exec_metadata需要一個字符串 或NULL作爲參數1,而不是一個類型ARRAY_OF_POINTER(193)

的ARG

回答

4

幾件事情:

  1. 不要在你的前綴的URI的結尾留下任何空間。
  2. 當使用INSERT DATA確保你的陳述中三元。您只使用謂詞和對象。

如果您在執行之前通過SPARQL驗證程序傳遞您的查詢,則上面的代碼可能已被提取。

試試這個:

PREFIX schema: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> 
PREFIX ab: <http://learningsparql.com/ns/addressbook#> 
PREFIX res: <http://www.w3.org/2000/01/rdf-schema#> 

INSERT DATA{ 
    GRAPH <http://ddd.test/addressbook> { 
     <http://dbpedia.org/resource/Switzerland#1> ab:name "taro" . 
    } 
} 
+0

約書亞·泰勒山>我有你修一個骯髒的寫作風格,謝謝。 –

+0

Anthony Hughes-san>非常感謝您的精確解釋!這很容易理解。我很感激。 –