weixin_33713503 2019-03-07 14:13 采纳率: 0%
浏览 24

使用Ajax更新SPARQL

Hi I am trying to create an UPDATE query and send it via ajax. I am continuously getting an error and the update is not done. Any idea why? When I try the UPDATE query on Apache Fuseki it works well.

function createNewItem(deed, itemNo, desc){
var itemValue =document.getElementById("search").value;
myQuery= ["PREFIX dcterms: <http://purl.org/dc/terms/>",
"PREFIX locah: <http://data.archiveshub.ac.uk/def/>",
"prefix xsd: <http://www.w3.org/2001/XMLSchema#>",
"INSERT DATA",
"{",
"<http://natarchives.com.mt/deed/"+deed+"> locah:associatedWith <http://natarchives.com.mt/item/#item"+itemNo+">.",
"<http://natarchives.com.mt/item/#item"+itemNo+"> dcterms:description \""+desc+"\".",
"<http://natarchives.com.mt/item/#item"+itemNo+"> locah:item \""+itemValue+"\".",
"<http://natarchives.com.mt/item/#item"+itemNo+"> dcterms:identifier \""+itemNo+"\"^^xsd:integer.}"].join(" ");
window.alert(myQuery);
console.log('myQuery: '+myQuery);

$.ajax({
dataType: "jsonp",
url: myEndPointUpdate,
data: {"query": myQuery,
"output": "json"},
success: ready,
error: myError
});
console.log('After .ajax');
}
  • 写回答

0条回答 默认 最新

    报告相同问题?