简体   繁体   中英

insert data to Fuseki with sparql query

I am trying to insert new data to Fuseki through SPARQL query, it's giving me success(200 OK) but it's not showing in my TDB. and I think it's because I haven't defined to which graph but I don't know-how

    String queryString =          
          "PREFIX ns:<http://www.semanticweb.org/hightech/ontologies/2019/unit#>" 
                    + "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>" 
                    + "INSERT DATA{" 
                    + "ns:" + d.getDomainName()+ "ns:domainName " + d.getDomainName() + "." 
                    + "ns:" + d.getDomainName() + " ns:domainId "+ d.getDomainId() + "." 
                    + "}";

            UpdateRequest request = UpdateFactory.create(queryString);
            UpdateProcessor qe = UpdateExecutionFactory.createRemote(request,
                    "http://localhost:3030/eduDataSet/update");
            qe.execute();
        

try to reformat your queryString as shown in this picture.

在此处输入图片说明

reference

be careful where to close your subject
"PREFIX ns:<http://www.semanticweb.org/hightech/ontologies/2019/unit#>" <== is already closed, while you need to insert your d.getDomainName() before closing ">"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM