Re: Sparql Update: Insert a property whose value is a calculated average

2017-06-11 Thread Aya Hamdy
Thanks! I wrote the file to a different path and imported it to eclipse and finally, it has the new attributes. Thank you, Lorenz for your help and patience for the past days, much appreciated. On Sun, Jun 11, 2017 at 12:01 PM, Lorenz B. < buehm...@informatik.uni-leipzig.de> wrote: > Please uploa

Re: Sparql Update: Insert a property whose value is a calculated average

2017-06-11 Thread Lorenz B.
Please upload your update code for b.java And then try to write to another path instead of the same file, just to make sure that you really write to disk. > - I had included the writing to the file in b.java, but I must have dropped > it by mistake when putting the files as a gist, apologies. > >

Re: Sparql Update: Insert a property whose value is a calculated average

2017-06-11 Thread Aya Hamdy
- I had included the writing to the file in b.java, but I must have dropped it by mistake when putting the files as a gist, apologies. - I am not surprised with the output. Don't know why you got that impression. You are right, it is my code so I know what I have written and I have made the outpu

Re: Sparql Update: Insert a property whose value is a calculated average

2017-06-11 Thread Lorenz B.
> Yes, I see. I don't get why it does not add them when I run it... > > Do you see the new tuples when you print or when you open the file ontology > file? Cause with me, when I used your syntax, the new triples show in the > print but when I open the ontology file on Eclipse which I am running t

Re: Sparql Update: Insert a property whose value is a calculated average

2017-06-10 Thread Aya Hamdy
Yes, I see. I don't get why it does not add them when I run it... Do you see the new tuples when you print or when you open the file ontology file? Cause with me, when I used your syntax, the new triples show in the print but when I open the ontology file on Eclipse which I am running the query on

Re: Sparql Update: Insert a property whose value is a calculated average

2017-06-10 Thread Aya Hamdy
Yes, I see. I don't get why it does not add them when I run it... Do you see the new tuples when you print or when you open the file ontology file? Cause with me, when I used your syntax, the new triples show in the print but when I open the ontology file on Eclipse which I am running the query on

Re: Sparql Update: Insert a property whose value is a calculated average

2017-06-10 Thread Lorenz B.
That can't be. I tried your example b.java with my query PREFIX rdf: PREFIX cv: INSERT { ?ass cv:recorded_speed ?avg . } WHERE { SELECT ?ass (AVG(?speed) AS ?avg)

Re: Sparql Update: Insert a property whose value is a calculated average

2017-06-09 Thread Aya Hamdy
And I explained that using Lorenz's example syntax is something that I have already tried before asking on the list and still the update to the owl file does not take place. I mentioned that in my previous email. I think the 2000+ lines u r mentioning are the full ontology file. I mentioned that th

Re: Sparql Update: Insert a property whose value is a calculated average

2017-06-09 Thread Andy Seaborne
" cv:Vehicle_Road ?r ;"+ Bad syntax. Replace ";" by "." Lorenz showed you the correct syntax. "?ass cv:avgSpeedSensor_Infrastructue ?r ."+ Print the query out and see what it looks like. Hence the earlier suggestion you put newlines in the query. Andy ~2800 lines is

Re: Sparql Update: Insert a property whose value is a calculated average

2017-06-09 Thread Aya Hamdy
When I do not use the subselect and write the query this way: String queryString1 = "PREFIX rdf:"+ "PREFIX cv:< http://www.semanticweb.org/toshiba/ontologies/2017/3/untitled-ontology-6#>"+ "INSERT {"+ " ?ass cv:recorded_speed ?avg"+ "}"+ "WHERE {"+ "SEL

Re: Sparql Update: Insert a property whose value is a calculated average

2017-06-09 Thread Lorenz Buehmann
There was some formatting issue in my previous mail. What I was wondering the need for grouping by ?r instead of ?ass. PREFIX rdf: PREFIX cv: INSERT { ?ass cv:recorded

Re: Sparql Update: Insert a property whose value is a calculated average

2017-06-09 Thread Lorenz Buehmann
That is your query: PREFIX rdf: PREFIX cv: INSERT { ?ass cv:recorded_speed ?avg . } WHERE { SELECT (AVG(?speed) AS ?avg) WHERE { ?v cv:vehicleSpeed ?spee

Re: Sparql Update: Insert a property whose value is a calculated average

2017-06-09 Thread Aya Hamdy
Didn't know attachments are not allowed. This is a gist of the three files. https://gist.github.com/AyazzHamdy/faa14ebf46b0fe32689edc808dbf85d9 The code files are minimalist as you can see on the gist. Only the query is included and everything else is removed. I wanted to attach them as files to a

Re: Sparql Update: Insert a property whose value is a calculated average

2017-06-09 Thread Andy Seaborne
Attachments don't get through to this list. Put them in a pastebin or guithub gist. However, if they are so large that inlining email in plain text is impractical, than it suggests they are not minimal. Andy On 09/06/17 07:06, Lorenz Buehmann wrote: You forgot the attachments... On

Re: Sparql Update: Insert a property whose value is a calculated average

2017-06-08 Thread Lorenz Buehmann
You forgot the attachments... On 09.06.2017 03:02, Aya Hamdy wrote: > Attached is a file of my code and my ontology which I have imported on > Eclipse. > > I have finally fixed the null values issue. I am not sure if I > understood the cause of the nulls correctly. However, it got fixed > when I

Re: Sparql Update: Insert a property whose value is a calculated average

2017-06-08 Thread Aya Hamdy
Attached is a file of my code and my ontology which I have imported on Eclipse. I have finally fixed the null values issue. I am not sure if I understood the cause of the nulls correctly. However, it got fixed when I used a different way of making the ResultSet as shown below: Query query = Query

Re: Sparql Update: Insert a property whose value is a calculated average

2017-06-08 Thread Lorenz Buehmann
If results are bound it can't be a null value. Please show your updated code. On 07.06.2017 14:58, Aya Hamdy wrote: > Sorry about the x, It was a stupid mistake. But it is nit the cause of the > null. When I fixed it, the results of even the simplest queries are still > nulls. > > The code is not

Re: Sparql Update: Insert a property whose value is a calculated average

2017-06-08 Thread Lorenz Buehmann
Ehm, no - why? It's a local ontology. On 07.06.2017 15:04, Aya Hamdy wrote: > Does the ontology have to be posted online for instance? I found on > StackOverflow that the URI I assign to the prefix does not have to be a > real one. Therefore the URI for the PREFIX cv: > "PREFIX cv:< > http://www.

Re: Sparql Update: Insert a property whose value is a calculated average

2017-06-07 Thread Aya Hamdy
Does the ontology have to be posted online for instance? I found on StackOverflow that the URI I assign to the prefix does not have to be a real one. Therefore the URI for the PREFIX cv: "PREFIX cv:< http://www.semanticweb.org/toshiba/ontologies/2017/3/untitled-ontology-6#>" is the one generated

Re: Sparql Update: Insert a property whose value is a calculated average

2017-06-07 Thread Aya Hamdy
Sorry about the x, It was a stupid mistake. But it is nit the cause of the null. When I fixed it, the results of even the simplest queries are still nulls. The code is not generating errors though, it is not generating the proper results ... On Tue, Jun 6, 2017 at 9:13 AM, Andy Seaborne wrote:

Re: Sparql Update: Insert a property whose value is a calculated average

2017-06-06 Thread Andy Seaborne
On 06/06/17 00:26, Aya Hamdy wrote: Ok. That sounds reasonable so I will work on breaking down my chain of thought into smaller pieces. Thank you so much. I saw an example online where the query syntax is written as a string on Jena. so my query now looks like this: Use String.join("\n"

Re: Sparql Update: Insert a property whose value is a calculated average

2017-06-06 Thread Lorenz Buehmann
> I tried breaking the query down to smaller bits right down to doing a > simple select on vehicles: > > String query1= > "PREFIX rdf:"+ > "PREFIX cv:< > http://www.semanticweb.org/toshiba/ontologies/2017/3/untitled-ontology-6#>"+ > > "Select ?v"+ > "w

Re: Sparql Update: Insert a property whose value is a calculated average

2017-06-05 Thread Aya Hamdy
Ok. That sounds reasonable so I will work on breaking down my chain of thought into smaller pieces. Thank you so much. I saw an example online where the query syntax is written as a string on Jena. so my query now looks like this: String queryString= "PREFIX rdf:

Re: Sparql Update: Insert a property whose value is a calculated average

2017-06-05 Thread Andy Seaborne
Then find the sensor of interest, and all cars on that given road. GROUP BY the speed sensor, and the AVG is that of calls on that given road. The way to develop complex queris is to write simple parts, then combine them. Andy On 05/06/17 16:46, Aya Hamdy wrote: The goal is not to

Re: Sparql Update: Insert a property whose value is a calculated average

2017-06-05 Thread Aya Hamdy
The goal is not to calculate the avg speed of a car. It is rather to compute the avg speed of all the cars on a given road and assign that computed average as the reading of the average speed sensot attached to that road. Sorry if my wording is causing confusion. On Jun 5, 2017 5:12 PM, "Lorenz B

Re: Sparql Update: Insert a property whose value is a calculated average

2017-06-05 Thread Lorenz Buehmann
No, why do you think so? ?v is the variable that gets assigned a vehicle for which you compute the avg speed. should be ?v, i.e. you have to group by it and select it INSERT { ?v :avgSpeed ?avg } WHERE { SELECT ?v (AVG(?speed) AS ?avg) { } GROUP BY ?v } On 05.06.2017 17:03, Aya Hamd

Re: Sparql Update: Insert a property whose value is a calculated average

2017-06-05 Thread Aya Hamdy
Hello, I will try to explain with examples. I have generated my ontology from Protege and converted it to turtle syntax via an online tool. *I have a class for average speed sensors:* ### http://www.semanticweb.org/toshiba/ontologies/2017/3/untitled-ontology-6#Avg_Speed_Sensor untitled-ontolog

Re: Sparql Update: Insert a property whose value is a calculated average

2017-06-04 Thread Andy Seaborne
On 04/06/17 18:47, Aya Hamdy wrote: Hello, I wanted to add a property called avgSpeed to an instance of a class called FlowSensor. This property should be the average of the values of the property vehicleSpeed attached to instances of the class Vehicle. I read that SPARQL update allows doing

Sparql Update: Insert a property whose value is a calculated average

2017-06-04 Thread Aya Hamdy
Hello, I wanted to add a property called avgSpeed to an instance of a class called FlowSensor. This property should be the average of the values of the property vehicleSpeed attached to instances of the class Vehicle. I read that SPARQL update allows doing this. However, I cannot reach the syntax