You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by emri mbiemri <em...@gmail.com> on 2021/08/14 08:46:19 UTC

Inserting support a given model

Dear all, 

In the given RDF model:
https://github.com/iliriani/Test/blob/main/Notebook.rdf

I am trying to find a way on how to insert with SPARQL a <weight>5</weight> node within an <Association> node where the <class1> is "Notebook" and <class2> is "Evaluation".
Same also, I want to add <weight>2</weight> in the <Association> where <class1> is "Student" and <class2> is "Evaluation" (<class1> and <class2> may be interchangeable) and so the process can continue for all classes.

The problem is:
1. How to specify exactly the <Association> where <class1> is "X" and <class2> is "Y", and
2. insert within the exact <Association> the node <weight> int </weight>

Since I am using Java I need the insert query for one insert then I can loop for all class1 and class2 and add weights.
Thanks a lot.



Re: Inserting support a given model

Posted by Lorenz Buehmann <bu...@informatik.uni-leipzig.de>.
why can't you use a single INSERT query? An INSERT query allows a WHERE part

As mentioned in replies to your your previous mails, look at your data 
model as a graph, then convert it to triple patterns which make the 
SPARQL query.

On 14.08.21 10:46, emri mbiemri wrote:
> Dear all,
>
> In the given RDF model:
> https://github.com/iliriani/Test/blob/main/Notebook.rdf
>
> I am trying to find a way on how to insert with SPARQL a <weight>5</weight> node within an <Association> node where the <class1> is "Notebook" and <class2> is "Evaluation".
> Same also, I want to add <weight>2</weight> in the <Association> where <class1> is "Student" and <class2> is "Evaluation" (<class1> and <class2> may be interchangeable) and so the process can continue for all classes.
>
> The problem is:
> 1. How to specify exactly the <Association> where <class1> is "X" and <class2> is "Y", and
> 2. insert within the exact <Association> the node <weight> int </weight>
>
> Since I am using Java I need the insert query for one insert then I can loop for all class1 and class2 and add weights.
> Thanks a lot.
>
>

Re: Inserting support a given model

Posted by Andy Seaborne <an...@apache.org>.
Hi,

You'll need to think in triples to decide what triple to add or delete 
using SPARQL Update - as in previous email, printing the data out in a 
clear triples format will help.

And set the datatype of the literals if you want weight to be a number, 
not a string.

     Andy

On 14/08/2021 09:46, emri mbiemri wrote:
> Dear all,
> 
> In the given RDF model:
> https://github.com/iliriani/Test/blob/main/Notebook.rdf
> 
> I am trying to find a way on how to insert with SPARQL a <weight>5</weight> node within an <Association> node where the <class1> is "Notebook" and <class2> is "Evaluation".
> Same also, I want to add <weight>2</weight> in the <Association> where <class1> is "Student" and <class2> is "Evaluation" (<class1> and <class2> may be interchangeable) and so the process can continue for all classes.
> 
> The problem is:
> 1. How to specify exactly the <Association> where <class1> is "X" and <class2> is "Y", and
> 2. insert within the exact <Association> the node <weight> int </weight>
> 
> Since I am using Java I need the insert query for one insert then I can loop for all class1 and class2 and add weights.
> Thanks a lot.
> 
>