I am using my Nodejs app to Run(Sending HTTP Post) Sparql updates on my Ontology model. Now I have a variable 'seconds' in my code that stores an integer value. Now How do I include that variable to my query.
var request = require('request');
var querystring = require('querystring');
var seconds = ROB_8_StopSeconds-ROB_8_StartSeconds;
var myquery2 = querystring.stringify({
update: "PREFIX test:<http://www.semanticweb.org/muhammad/ontologies/2017/2/untitled-ontology-14#> insert {[] test:Actual_Production_Time ?s; test:hasValue_ROB1 ?p; test:hasTime ?now.} where {values (?s ?p ) {(test:Actual_Production_Time 2000)} bind (now() as ?now)}"
});
request.post({headers: {'content-type': 'application/x-www-form-urlencoded'},
url: 'http://localhost:3030/DS-1/?' + myquery2},
function(error, response, body) {
if (!error && response.statusCode == 200) {
console.log('successful update');
//console.log(body);
} else {
console.log(response.statusCode)
console.warn(error);
}
});
Now in my query as you can see I am sending 2000 but i want to send the variable 'seconds' instead of 2000. How can I achieve this?. And Secondly, will my model be able to extract that integer value from the variable 'seconds'.
P.s: I have searched the answer in dotNetRDF Documentation(https://github.com/dotnetrdf/dotnetrdf/wiki) but I couldn't find it thr.
via Usman Khan
No comments:
Post a Comment