HI,

The modification didn't help me to update the ontology remotely.The program
just display the names in the console window with no updation.

 I think some where I am doing wrong. I have a doubt regarding the owl file
. Currently I have per2.owl in two locations . One is in the root directory
"D:\fuseki-0.2.2\per2.owl" for executing the command " ruby s-put
http://localhost:3030/ds2/data default per2.owl" . And the second one is
inside the "D:\fuseki-0.2.2\pages" directory also. when I removed the
per2.owl file from the D:\fuseki-0.2.2\pages it shows the error.

" Exception in thread "main" com.hp.hpl.jena.shared.DoesNotExistException:
http://localhost:3030/per2.owl";

So confusing when calling "UpdateExecutionFactory.createRemote(ur,"
http://localhost:3030/ds2/update";);" which file will update or is it just
in-memory updation. Should I need to write extra function for updating the
ontology. similar like  model.write(...)

Regards






On Mon, Jun 11, 2012 at 4:04 AM, Andy Seaborne <[email protected]> wrote:

> On 11/06/12 03:27, Don S wrote:
>
>> HI,
>>
>>
>> What does the Fuseki log say?
>> No message in the  Fuseki log. Before running the main program, I execute
>> this command first
>> " ruby s-put  http://localhost:3030/ds2/data default per2.owl" to put the
>> file in the server.
>>
>
> which puts it into the default model of datasat called
> http://localhost:3030/ds2/data**.
>
> The name "per2.owl" is lost - it's just a local file of data.
>
>
>  What's in model at this point?
>> Simultaneously I am writing the file to local c drive also. For that I
>> used  in model.
>>
>> Also I changed the first line of  rupdata to #!/bin/sh instead
>> of #!/bin/bash.
>>
>> Fuseki log after running the server
>>
>> D:\fuseki-0.2.2>run
>>
>> D:\fuseki-0.2.2>java -Xmx1200M -jar fuseki-server.jar --update --mem
>> --loc=D:/fu
>> seki-0.2.2/TD /ds2
>> 10:40:16 INFO  Server               :: Dataset: in-memory
>> 10:40:16 INFO  Server               :: TDB dataset:
>> directory=D:/fuseki-0.2.2/TD
>>
>> 10:40:17 INFO  Server               :: Dataset path = /ds2
>> 10:40:17 INFO  Server               :: Fuseki 0.2.2-incubating-SNAPSHOT
>> 20120506
>> -0501
>> 10:40:17 INFO  Server               :: Jetty 7.x.y-SNAPSHOT
>> 10:40:17 INFO  Server               :: Started 2012/06/11 10:40:17 PDT on
>> port 3
>> 030
>> 10:48:03 INFO  Fuseki               :: [1] PUT
>> http://localhost:3030/ds2/**data?de <http://localhost:3030/ds2/data?de>
>> fault
>> 10:48:03 INFO  Fuseki               :: [1] 204 No Content
>>
>
> s-put
>
>
>  10:54:10 INFO  Fuseki               :: [3] GET
>> http://localhost:3030/ds2/**query?q <http://localhost:3030/ds2/query?q>
>> uery=SELECT+%2A%7B%3Fs+%3Fp+%**3Fo%7D
>> 10:54:10 INFO  Fuseki               :: [3] Query = SELECT *{?s ?p ?o}
>> 10:54:11 INFO  Fuseki               :: [3] OK/select
>> 10:54:11 INFO  Fuseki               :: [3] 200 OK
>>
>
> Dump triples of defaul graph.
>
>
>>
>> Here is the code
>>
>> static final String inputFileName = "http://localhost:3030/";;
>> public static void main(String[] args) throws IOException{
>>  Model model =ModelFactory.**createOntologyModel();You shodul get
>>
>>
>>         // use the FileManager to find the input file
>>         InputStream in = FileManager.get().open(**inputFileName);
>>         if (in == null) {
>>             throw new IllegalArgumentException( "File: " + inputFileName +
>> " not found");
>>         }
>>
>>         model.read(inputFileName+"**per2.owl");
>>         in.close();
>>         String queryString ="PREFIX xmlns:
>> <http://localhost:3030/per1.**owl# <http://localhost:3030/per1.owl#>
>> >\r\n"
>> +
>>                             "PREFIX base:<http://localhost:3030/**
>> per1.owl <http://localhost:3030/per1.owl>
>>
>>> \r"+
>>>
>>                     "PREFIX 
>> xsd:<http://www.w3.org/2001/**XMLSchema#<http://www.w3.org/2001/XMLSchema#>
>> >\r"+
>>                      "INSERT DATA" +
>>                     "{"+
>>                           
>> "<http://localhost:3030/per1.**owl#name1<http://localhost:3030/per1.owl#name1>>\n"
>> +
>>                            "xmlns:hasFirstname \" Xie\"^^ xsd:string;" +
>>                              "}";
>>
>
> Use better prefixes.
>
> Do not use xmlns:, owl: -- invent your own like myNS: or ex: or per:
>
>
>
>>         String queryString1 =
>>         "PREFIX 
>> owl:<http://localhost:3030/**per1.owl#<http://localhost:3030/per1.owl#>>"
>> +
>>
>
>
>          "SELECT * "+
>>         
>> "FROM<http://localhost:3030/**per1.owl<http://localhost:3030/per1.owl>
>> >"+
>>
>
> Do not use FROM.  Delete this.  It is not needed.
>
> There is no file 
> <http://localhost:3030/per1.**owl<http://localhost:3030/per1.owl>>,
> either as a web resource or as a graph name in the datasets.
>
> And you were trying to call it per2.owl anyway.
>
>
>          "WHERE"+
>>         "{"+
>>         "?Name owl:hasFirstname ?hasFirstname." +
>>         "}";
>>         GraphStore gs=GraphStoreFactory.create(**model);
>>         gs.setDefaultGraph(model.**getGraph());
>>         UpdateRequest ur = UpdateFactory.create(**queryString);
>>
>
>
>          Update update = ur.getOperations().get(0);
>>
>
> not needed, not used.
>
>
>          UpdateExecutionFactory.**createRemote(ur,"
>> http://localhost:3030/ds2/**update <http://localhost:3030/ds2/update>");
>>         UpdateAction.execute(ur,gs);
>>         System.out.println(update);
>>
>>
>>     // search part
>>            Query query = QueryFactory.create(**queryString1);
>>
>
> remove the FROM.
>
>
>     QueryExecution qe = QueryExecutionFactory.create(**query, model);
>>    ResultSet results = qe.execSelect();
>>    ResultSetFormatter.out(System.**out, results, query);
>>
>
> And now try the web interface to Fuseki.
>
>
>     FileOutputStream  fileour =new FileOutputStream("c:/per2.owl"**);
>>    model.write(fileour,"RDF/XML-**ABBREV");
>>         qe.close();
>>         }
>> }
>>
>
>
>>
>> Still struggling to write the file using UpdateExecutionFactory.**
>> createRemote
>>
>> Regards
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**~~~~~~~~~~~~~~~~~~~~~~~~~
>>
>>
>>
>> On Fri, Jun 8, 2012 at 2:34 AM, Andy Seaborne<[email protected]>  wrote:
>>
>>  On 08/06/12 09:30, Don S wrote:
>>>
>>>  HI,
>>>>
>>>>        Finally I succeed to call the
>>>> function UpdateExecutionFactory.****createRemote. Thanks for the
>>>> comments.
>>>>
>>>>
>>>> Here is my configuration
>>>>
>>>> Fuseki server
>>>> java -Xmx1200M -jar fuseki-server.jar --update --mem
>>>> --loc=D:/fuseki-0.2.2/TD /ds2
>>>>
>>>> and the insert query code
>>>>
>>>> public class search {
>>>> static final String inputFileName = "http://localhost:3030/";;
>>>> public static void main(String[] args) throws IOException{
>>>>  Model model =ModelFactory.****createOntologyModel();
>>>>
>>>>
>>>>         // use the FileManager to find the input file
>>>>         InputStream in = FileManager.get().open(****inputFileName);
>>>>
>>>>         if (in == null) {
>>>>             throw new IllegalArgumentException( "File: " +
>>>> inputFileName +
>>>> " not found");
>>>>         }
>>>>
>>>>         model.read(inputFileName+"****per2.owl");
>>>>         in.close();
>>>>
>>>>
>>> What's in model at this point?
>>>
>>>
>>>          String queryString ="PREFIX xmlns:
>>>
>>>> <http://localhost:3030/per1.****owl#<http://localhost:3030/per1.**owl#>
>>>> <http://localhost:3030/**per1.owl# <http://localhost:3030/per1.owl#>>
>>>>
>>>>> \r\n"
>>>>>
>>>> +
>>>>                             "PREFIX base:<http://localhost:3030/**
>>>> per1.owl<http://localhost:**3030/per1.owl<http://localhost:3030/per1.owl>
>>>> >
>>>>
>>>>  \r"+
>>>>>
>>>>>                      "PREFIX xsd:<http://www.w3.org/2001/****
>>>> XMLSchema# <http://www.w3.org/2001/**XMLSchema#><http://www.w3.org/**
>>>> 2001/XMLSchema# <http://www.w3.org/2001/XMLSchema#>>
>>>>
>>>>  \r"+
>>>>>
>>>>                                   "INSERT DATA" +
>>>>                     "{"+
>>>>                           
>>>> "<http://localhost:3030/per1.****owl#name1<http://localhost:3030/per1.**owl#name1>
>>>> <http://localhost:**3030/per1.owl#name1<http://localhost:3030/per1.owl#name1>
>>>> >>\n"
>>>>
>>>> +
>>>>                            "xmlns:hasFirstname \"Rex\"^^ xsd:string;" +
>>>>                              "}";
>>>>
>>>>
>>> xmlns is not a good choice of prefix name.
>>>
>>>
>>>
>>>          GraphStore gs=GraphStoreFactory.create(****model);
>>>>         gs.setDefaultGraph(model.****getGraph());
>>>>         UpdateRequest ur = UpdateFactory.create(****queryString);
>>>>         Update update = ur.getOperations().get(0);
>>>>         UpdateExecutionFactory.****createRemote(ur,"
>>>> http://localhost:3030/per2.**owl** <http://localhost:3030/per2.owl**>
>>>> ");
>>>>
>>>>         UpdateAction.execute(ur,gs);
>>>>         System.out.println(update);
>>>>
>>>>
>>>>     // some codes ....
>>>>
>>>>         qe.close();
>>>>         }
>>>> }
>>>>
>>>> I am wondering why it is not updating the ontology??
>>>>
>>>> regards
>>>>
>>>>
>>> What does the Fuseki log say?
>>>
>>>
>>>
>>> UpdateExecutionFactory.****createRemote(ur,"http://****
>>> localhost:3030/per2.owl<http:/**/localhost:3030/per2.owl<http://localhost:3030/per2.owl>
>>> >
>>>
>>> ");
>>>
>>>
>>> per2.owl is not a SPARQL update service endpoint.
>>>
>>> http://localhost:3030/ds2/****update<http://localhost:3030/ds2/**update>
>>> <http://localhost:3030/**ds2/update <http://localhost:3030/ds2/update>>
>>>  is
>>>
>>> the SPARQL update service endpoint.
>>>
>>>        Andy
>>>
>>>
>>
>

Reply via email to