You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by kumar rohit <ku...@gmail.com> on 2016/09/24 13:33:32 UTC
Overwrite data of ontology
I want to save item price entered by users in file. Samsung Galaxy hasPrice
?value.
User enter some value and it is stored in the file. After some time,
another price for same Samsung Galaxy is entered and it is stored. But the
problem is that the old price is also there.
How can I overwrite the previous values with recently entered value so that
my ontology save and shows one value at a time.
Re: Overwrite data of ontology
Posted by Dave Reynolds <da...@gmail.com>.
On 24/09/16 14:33, kumar rohit wrote:
> I want to save item price entered by users in file. Samsung Galaxy hasPrice
> ?value.
> User enter some value and it is stored in the file. After some time,
> another price for same Samsung Galaxy is entered and it is stored. But the
> problem is that the old price is also there.
> How can I overwrite the previous values with recently entered value so that
> my ontology save and shows one value at a time.
>
Use OntResource#setPropertyValue or do it manually (remove the existing
value then add a new one).
Dave
Re: Overwrite data of ontology
Posted by "A. Soroka" <aj...@virginia.edu>.
What do you mean "Annotations tab"? Is this actually a question about Protege usage?
---
A. Soroka
The University of Virginia Library
> On Sep 26, 2016, at 7:22 AM, kumar rohit <ku...@gmail.com> wrote:
>
> Yes Lorenz sir I have written it to disk but it writes the data in the
> Annotations tab rather than in the data property.
>
> Customer1.setPropertyValue(price, pricevalue);
> Customer1.setPropertyValue(quantity, value);
>
> I want to write as data property values.
>
> On Sun, Sep 25, 2016 at 7:35 AM, Lorenz B. <
> buehmann@informatik.uni-leipzig.de> wrote:
>
>> Ehm, did you write the model to disk? Without seeing any code it's like
>> to try a shot in the dark.
>>
>>> Customer1.setPropertyValue(price, pricevalue);
>>> Customer1.setPropertyValue(quantity, value);
>>>
>>> Next time after login as Customer1, previous data has not overwritten and
>>> the owl file shows me old data also..
>>>
>>> On Sun, Sep 25, 2016 at 4:16 AM, Lorenz B. <
>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>
>>>> Please learn to read the Javadoc [1] if you're programming in Java...
>>>>
>>>> And using an IDE would also help, usually this is able to show you the
>>>> arguments and it's expected types.
>>>>
>>>>
>>>> [1]
>>>> https://jena.apache.org/documentation/javadoc/jena/
>>>> org/apache/jena/ontology/OntResource.html
>>>>
>>>>> I used this: customer.setPropertyValue(property, pricevariable);
>>>>>
>>>>> property here is property name:Item price and pricevariable is int
>> value
>>>>> but it gives me error of :
>>>>>
>>>>> *int can not be converted to RDF Node*
>>>>>
>>>>> On Sat, Sep 24, 2016 at 8:29 AM, Dave Reynolds <
>>>> dave.e.reynolds@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> On 24/09/16 15:37, kumar rohit wrote:
>>>>>>
>>>>>>> Thanks Soroka and Dave, but how I can do it dynamically? I used this
>>>>>>>
>>>>>>> Property property=model.getProperty(name space+ "Item price");
>>>>>>> and then customer_1.addLiteral(property, Text Field value);
>>>>>>> Now how to remove previously entered values? Any built-in methods?
>>>>>>>
>>>>>> Read my message again, I gave you the name of a method that does the
>>>>>> replacement (= remove + add) in one go.
>>>>>>
>>>>>> The javadoc and documentation tutorials will help you find the many
>>>> remove
>>>>>> methods that are available.
>>>>>>
>>>>>> Dave
>>>>>>
>>>>>>
>>>>>> On Sat, Sep 24, 2016 at 6:48 AM, A. Soroka <aj...@virginia.edu>
>> wrote:
>>>>>>> Remove the old triple and add a new one with the new value.
>>>>>>>> ---
>>>>>>>> A. Soroka
>>>>>>>> The University of Virginia Library
>>>>>>>>
>>>>>>>> On Sep 24, 2016, at 9:33 AM, kumar rohit <ku...@gmail.com>
>>>> wrote:
>>>>>>>>> I want to save item price entered by users in file. Samsung Galaxy
>>>>>>>>>
>>>>>>>> hasPrice
>>>>>>>>
>>>>>>>>> ?value.
>>>>>>>>> User enter some value and it is stored in the file. After some
>> time,
>>>>>>>>> another price for same Samsung Galaxy is entered and it is stored.
>>>> But
>>>>>>>> the
>>>>>>>>
>>>>>>>>> problem is that the old price is also there.
>>>>>>>>> How can I overwrite the previous values with recently entered value
>>>> so
>>>>>>>> that
>>>>>>>>
>>>>>>>>> my ontology save and shows one value at a time.
>>>>>>>>>
>>>>>>>>
>>>> --
>>>> Lorenz Bühmann
>>>> AKSW group, University of Leipzig
>>>> Group: http://aksw.org - semantic web research center
>>>>
>>>>
>> --
>> Lorenz Bühmann
>> AKSW group, University of Leipzig
>> Group: http://aksw.org - semantic web research center
>>
>>
Re: Overwrite data of ontology
Posted by kumar rohit <ku...@gmail.com>.
Not typo, my data property in ontology was the same I used in Jena code but
I just made a change in its spelling to check it works or not and luckily
it worked.
On Tue, Sep 27, 2016 at 12:26 AM, Lorenz B. <
buehmann@informatik.uni-leipzig.de> wrote:
> So it was a typo in the end.
> > Thanks Dave and Lorenz, what I actually did now is just changed the name
> of
> > data property from Item to item, and now it works i-e saved it as data
> > property.
> > Thanks again sir for both of your kind suggestions.
> >
> >
> > On Mon, Sep 26, 2016 at 10:32 AM, Dave Reynolds <
> dave.e.reynolds@gmail.com>
> > wrote:
> >
> >> On 26/09/16 18:26, kumar rohit wrote:
> >>
> >>> May I know why this occurs usually (save data as Annotations)? I wonder
> >>> what mistake I have actually done to encounter this.?
> >>>
> >> You would need to ask the protege folks why they put it there, protege
> is
> >> nothing to do with Jena.
> >>
> >> However, one thing to check is whether you are using the correct URI. If
> >> you have the wrong value in the "ns" variable then you might be adding a
> >> different property than the one you have declared.
> >>
> >> Again, to get help you need to provide a complete, minimal example.
> >>
> >> In this case you need a single generated ontology file with the
> >> DatatypeProperty declaration and the instance with the corresponding
> value
> >> as generated by your Jena code.
> >>
> >> Then if the ontology files looks correct but doesn't show in protege how
> >> you expect then you have something to talk to the protege folks about.
> >>
> >> If the file doesn't look correct then you know there's a problem in your
> >> jena code. In which case, if need help then show a complete, minimal
> >> example of the code that generated the file.
> >>
> >> Dave
> >>
> >>
> >> On Mon, Sep 26, 2016 at 10:22 AM, kumar rohit <ku...@gmail.com>
> >>> wrote:
> >>>
> >>> Hello Dave, I have Item as data type property in my Protege ontology.
> >>>> On Mon, Sep 26, 2016 at 9:28 AM, Dave Reynolds <
> >>>> dave.e.reynolds@gmail.com>
> >>>> wrote:
> >>>>
> >>>> On 26/09/16 16:59, kumar rohit wrote:
> >>>>> I have already tried this:
> >>>>>> DatatypeProperty item= model.getDatatypeProperty(ns+"Item");
> >>>>>>
> >>>>>>
> >>>>> If the URI ns+"Item" is not already declared as a DatatypeProperty in
> >>>>> your ontology then you'll need model.createDatatypeProperty so as to
> >>>>> side-effect the model to include the declaration of Item.
> >>>>>
> >>>>> Dave
> >>>>>
> >>>>>
> >>>>> Literal value = model.createTypedLiteral(Some value);
> >>>>>
> >>>>>> customer.setPropertyValue(item, value);
> >>>>>>
> >>>>>> On Mon, Sep 26, 2016 at 8:22 AM, Lorenz Buehmann <
> >>>>>> buehmann@informatik.uni-leipzig.de> wrote:
> >>>>>>
> >>>>>> Please try to use the Apache Jena documentations first, most things
> are
> >>>>>>
> >>>>>>> pretty much explained there [1]
> >>>>>>>
> >>>>>>> I am sorry my problem still exists and some values are stored as
> data
> >>>>>>>> property and some still as "Annotations" though I used the same
> >>>>>>>> procedure
> >>>>>>>> for all.
> >>>>>>>>
> >>>>>>>> OntResource res=model.createOntResource(ns+ value); //value come
> >>>>>>>> from
> >>>>>>>>
> >>>>>>>> java
> >>>>>>> variable
> >>>>>>>> OntProperty price= model.getOntProperty(ns+"ItemPrice");
> >>>>>>>>
> >>>>>>>> I don't understand why you still do not use a typed OWL property
> >>>>>>> here,
> >>>>>>> as I said in my previous answer?...
> >>>>>>> OWL has object property and data property, thus, why don't you call
> >>>>>>>
> >>>>>>> model.getDatatypeProperty(ns+"ItemPrice")
> >>>>>>>
> >>>>>>> For object properties the same:
> >>>>>>> model.getObjectProperty(String uri)
> >>>>>>>
> >>>>>>> [1] https://jena.apache.org/documentation/ontology/#ontology-
> >>>>>>> properties
> >>>>>>>
> >>>>>>> customer.setPropertyValue(price, res);
> >>>>>>>> On Mon, Sep 26, 2016 at 5:20 AM, Lorenz B. <
> >>>>>>>> buehmann@informatik.uni-leipzig.de> wrote:
> >>>>>>>>
> >>>>>>>> Yes, in that case it is supposed to be an RDF property, thus not
> >>>>>>>> typed
> >>>>>>>>
> >>>>>>>>> as expected to be in an OWL ontology.
> >>>>>>>>>
> >>>>>>>>> I used OntModel as model to read the ontology but used Property
> >>>>>>>>>> instead
> >>>>>>>>>>
> >>>>>>>>>> of
> >>>>>>>>> OntProperty, is this an issue?
> >>>>>>>>>> On Mon, Sep 26, 2016 at 4:34 AM, Lorenz B. <
> >>>>>>>>>> buehmann@informatik.uni-leipzig.de> wrote:
> >>>>>>>>>>
> >>>>>>>>>> For Protege it MUST be an OWL data property, otherwise the OWL
> API
> >>>>>>>>>>
> >>>>>>>>>>> parser will treat it as OWL annotation property. This has to be
> >>>>>>>>>>> explicitly declared in the ontology, the easiest way in Jena
> would
> >>>>>>>>>>> be
> >>>>>>>>>>>
> >>>>>>>>>>> to
> >>>>>>> use an OntModel
> >>>>>>>>>>> Yes Lorenz sir I have written it to disk but it writes the
> data in
> >>>>>>>>>>>
> >>>>>>>>>>>> the
> >>>>>>> Annotations tab rather than in the data property.
> >>>>>>>>>>>> Customer1.setPropertyValue(price, pricevalue);
> >>>>>>>>>>>> Customer1.setPropertyValue(quantity, value);
> >>>>>>>>>>>>
> >>>>>>>>>>>> I want to write as data property values.
> >>>>>>>>>>>>
> >>>>>>>>>>>> On Sun, Sep 25, 2016 at 7:35 AM, Lorenz B. <
> >>>>>>>>>>>> buehmann@informatik.uni-leipzig.de> wrote:
> >>>>>>>>>>>>
> >>>>>>>>>>>> Ehm, did you write the model to disk? Without seeing any code
> >>>>>>>>>>>> it's
> >>>>>>>>>>>>
> >>>>>>>>>>>>> like
> >>>>>>>>> to try a shot in the dark.
> >>>>>>>>>>>>> Customer1.setPropertyValue(price, pricevalue);
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>> Customer1.setPropertyValue(quantity, value);
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> Next time after login as Customer1, previous data has not
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> overwritten
> >>>>>>> and
> >>>>>>>>>>> the owl file shows me old data also..
> >>>>>>>>>>>>>> On Sun, Sep 25, 2016 at 4:16 AM, Lorenz B. <
> >>>>>>>>>>>>>> buehmann@informatik.uni-leipzig.de> wrote:
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> Please learn to read the Javadoc [1] if you're programming
> in
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> Java...
> >>>>>>>>> And using an IDE would also help, usually this is able to show
> you
> >>>>>>>>>>>>>>> the
> >>>>>>>>> arguments and it's expected types.
> >>>>>>>>>>>>>>> [1]
> >>>>>>>>>>>>>>> https://jena.apache.org/documentation/javadoc/jena/
> >>>>>>>>>>>>>>> org/apache/jena/ontology/OntResource.html
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> I used this: customer.setPropertyValue(property,
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> pricevariable);
> >>>>>>>> property here is property name:Item price and pricevariable is
> >>>>>>>>>>>>>>>> int
> >>>>>>> value
> >>>>>>>>>>>>> but it gives me error of :
> >>>>>>>>>>>>>>>> *int can not be converted to RDF Node*
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> On Sat, Sep 24, 2016 at 8:29 AM, Dave Reynolds <
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> dave.e.reynolds@gmail.com>
> >>>>>>>>>>>>>>> wrote:
> >>>>>>>>>>>>>>>> On 24/09/16 15:37, kumar rohit wrote:
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> Thanks Soroka and Dave, but how I can do it dynamically?
> I
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> used
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> this
> >>>>>>>>>>> Property property=model.getProperty(name space+ "Item
> >>>>>>>>>>>>>>>>>> price");
> >>>>>>> and then customer_1.addLiteral(property, Text Field value);
> >>>>>>>>> Now how to remove previously entered values? Any built-in
> >>>>>>>>>>>>>>>>>> methods?
> >>>>>>>>> Read my message again, I gave you the name of a method that does
> >>>>>>>>>>>>>>>>> the
> >>>>>>>>> replacement (= remove + add) in one go.
> >>>>>>>>>>>>>>>>> The javadoc and documentation tutorials will help you
> find
> >>>>>>>>>>>>>>>>> the
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> many
> >>>>>>>>> remove
> >>>>>>>>>>>>>>> methods that are available.
> >>>>>>>>>>>>>>>>> Dave
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> On Sat, Sep 24, 2016 at 6:48 AM, A. Soroka <
> >>>>>>>>>>>>>>>>> ajs6f@virginia.edu>
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> wrote:
> >>>>>>>>>>>>> Remove the old triple and add a new one with the new value.
> >>>>>>>>>>>>>>>>>> ---
> >>>>>>>>>>>>>>>>>>> A. Soroka
> >>>>>>>>>>>>>>>>>>> The University of Virginia Library
> >>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>> On Sep 24, 2016, at 9:33 AM, kumar rohit <
> >>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>> kumar.eng84@gmail.com
> >>>>>>> wrote:
> >>>>>>>>>>>>>>> I want to save item price entered by users in file. Samsung
> >>>>>>>>>>>>>>>>>>>> Galaxy
> >>>>>>>>>>> hasPrice
> >>>>>>>>>>>>>>>>>>> ?value.
> >>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>> User enter some value and it is stored in the file.
> After
> >>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>> some
> >>>>>>> time,
> >>>>>>>>>>>>> another price for same Samsung Galaxy is entered and it is
> >>>>>>>>>>>>>>>>>>>> stored.
> >>>>>>>>>>> But
> >>>>>>>>>>>>>>> the
> >>>>>>>>>>>>>>>>>>> problem is that the old price is also there.
> >>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>> How can I overwrite the previous values with recently
> >>>>>>>>>>>>>>>>>>>> entered
> >>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>> value
> >>>>>>>>>>> so
> >>>>>>>>>>>>>>> that
> >>>>>>>>>>>>>>>>>>> my ontology save and shows one value at a time.
> >>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>> --
> >>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>> Lorenz Bühmann
> >>>>>>>>>>>>>>> AKSW group, University of Leipzig
> >>>>>>>>>>>>>>> Group: http://aksw.org - semantic web research center
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> --
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>> Lorenz Bühmann
> >>>>>>>>>>>>> AKSW group, University of Leipzig
> >>>>>>>>>>>>> Group: http://aksw.org - semantic web research center
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> --
> >>>>>>>>>>>>>
> >>>>>>>>>>>> Lorenz Bühmann
> >>>>>>>>>>> AKSW group, University of Leipzig
> >>>>>>>>>>> Group: http://aksw.org - semantic web research center
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>> --
> >>>>>>>>>>>
> >>>>>>>>>> Lorenz Bühmann
> >>>>>>>>> AKSW group, University of Leipzig
> >>>>>>>>> Group: http://aksw.org - semantic web research center
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>
> --
> Lorenz Bühmann
> AKSW group, University of Leipzig
> Group: http://aksw.org - semantic web research center
>
>
Re: Overwrite data of ontology
Posted by "Lorenz B." <bu...@informatik.uni-leipzig.de>.
So it was a typo in the end.
> Thanks Dave and Lorenz, what I actually did now is just changed the name of
> data property from Item to item, and now it works i-e saved it as data
> property.
> Thanks again sir for both of your kind suggestions.
>
>
> On Mon, Sep 26, 2016 at 10:32 AM, Dave Reynolds <da...@gmail.com>
> wrote:
>
>> On 26/09/16 18:26, kumar rohit wrote:
>>
>>> May I know why this occurs usually (save data as Annotations)? I wonder
>>> what mistake I have actually done to encounter this.?
>>>
>> You would need to ask the protege folks why they put it there, protege is
>> nothing to do with Jena.
>>
>> However, one thing to check is whether you are using the correct URI. If
>> you have the wrong value in the "ns" variable then you might be adding a
>> different property than the one you have declared.
>>
>> Again, to get help you need to provide a complete, minimal example.
>>
>> In this case you need a single generated ontology file with the
>> DatatypeProperty declaration and the instance with the corresponding value
>> as generated by your Jena code.
>>
>> Then if the ontology files looks correct but doesn't show in protege how
>> you expect then you have something to talk to the protege folks about.
>>
>> If the file doesn't look correct then you know there's a problem in your
>> jena code. In which case, if need help then show a complete, minimal
>> example of the code that generated the file.
>>
>> Dave
>>
>>
>> On Mon, Sep 26, 2016 at 10:22 AM, kumar rohit <ku...@gmail.com>
>>> wrote:
>>>
>>> Hello Dave, I have Item as data type property in my Protege ontology.
>>>> On Mon, Sep 26, 2016 at 9:28 AM, Dave Reynolds <
>>>> dave.e.reynolds@gmail.com>
>>>> wrote:
>>>>
>>>> On 26/09/16 16:59, kumar rohit wrote:
>>>>> I have already tried this:
>>>>>> DatatypeProperty item= model.getDatatypeProperty(ns+"Item");
>>>>>>
>>>>>>
>>>>> If the URI ns+"Item" is not already declared as a DatatypeProperty in
>>>>> your ontology then you'll need model.createDatatypeProperty so as to
>>>>> side-effect the model to include the declaration of Item.
>>>>>
>>>>> Dave
>>>>>
>>>>>
>>>>> Literal value = model.createTypedLiteral(Some value);
>>>>>
>>>>>> customer.setPropertyValue(item, value);
>>>>>>
>>>>>> On Mon, Sep 26, 2016 at 8:22 AM, Lorenz Buehmann <
>>>>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>>>>
>>>>>> Please try to use the Apache Jena documentations first, most things are
>>>>>>
>>>>>>> pretty much explained there [1]
>>>>>>>
>>>>>>> I am sorry my problem still exists and some values are stored as data
>>>>>>>> property and some still as "Annotations" though I used the same
>>>>>>>> procedure
>>>>>>>> for all.
>>>>>>>>
>>>>>>>> OntResource res=model.createOntResource(ns+ value); //value come
>>>>>>>> from
>>>>>>>>
>>>>>>>> java
>>>>>>> variable
>>>>>>>> OntProperty price= model.getOntProperty(ns+"ItemPrice");
>>>>>>>>
>>>>>>>> I don't understand why you still do not use a typed OWL property
>>>>>>> here,
>>>>>>> as I said in my previous answer?...
>>>>>>> OWL has object property and data property, thus, why don't you call
>>>>>>>
>>>>>>> model.getDatatypeProperty(ns+"ItemPrice")
>>>>>>>
>>>>>>> For object properties the same:
>>>>>>> model.getObjectProperty(String uri)
>>>>>>>
>>>>>>> [1] https://jena.apache.org/documentation/ontology/#ontology-
>>>>>>> properties
>>>>>>>
>>>>>>> customer.setPropertyValue(price, res);
>>>>>>>> On Mon, Sep 26, 2016 at 5:20 AM, Lorenz B. <
>>>>>>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>>>>>>
>>>>>>>> Yes, in that case it is supposed to be an RDF property, thus not
>>>>>>>> typed
>>>>>>>>
>>>>>>>>> as expected to be in an OWL ontology.
>>>>>>>>>
>>>>>>>>> I used OntModel as model to read the ontology but used Property
>>>>>>>>>> instead
>>>>>>>>>>
>>>>>>>>>> of
>>>>>>>>> OntProperty, is this an issue?
>>>>>>>>>> On Mon, Sep 26, 2016 at 4:34 AM, Lorenz B. <
>>>>>>>>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>>>>>>>>
>>>>>>>>>> For Protege it MUST be an OWL data property, otherwise the OWL API
>>>>>>>>>>
>>>>>>>>>>> parser will treat it as OWL annotation property. This has to be
>>>>>>>>>>> explicitly declared in the ontology, the easiest way in Jena would
>>>>>>>>>>> be
>>>>>>>>>>>
>>>>>>>>>>> to
>>>>>>> use an OntModel
>>>>>>>>>>> Yes Lorenz sir I have written it to disk but it writes the data in
>>>>>>>>>>>
>>>>>>>>>>>> the
>>>>>>> Annotations tab rather than in the data property.
>>>>>>>>>>>> Customer1.setPropertyValue(price, pricevalue);
>>>>>>>>>>>> Customer1.setPropertyValue(quantity, value);
>>>>>>>>>>>>
>>>>>>>>>>>> I want to write as data property values.
>>>>>>>>>>>>
>>>>>>>>>>>> On Sun, Sep 25, 2016 at 7:35 AM, Lorenz B. <
>>>>>>>>>>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>> Ehm, did you write the model to disk? Without seeing any code
>>>>>>>>>>>> it's
>>>>>>>>>>>>
>>>>>>>>>>>>> like
>>>>>>>>> to try a shot in the dark.
>>>>>>>>>>>>> Customer1.setPropertyValue(price, pricevalue);
>>>>>>>>>>>>>
>>>>>>>>>>>>>> Customer1.setPropertyValue(quantity, value);
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Next time after login as Customer1, previous data has not
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> overwritten
>>>>>>> and
>>>>>>>>>>> the owl file shows me old data also..
>>>>>>>>>>>>>> On Sun, Sep 25, 2016 at 4:16 AM, Lorenz B. <
>>>>>>>>>>>>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Please learn to read the Javadoc [1] if you're programming in
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Java...
>>>>>>>>> And using an IDE would also help, usually this is able to show you
>>>>>>>>>>>>>>> the
>>>>>>>>> arguments and it's expected types.
>>>>>>>>>>>>>>> [1]
>>>>>>>>>>>>>>> https://jena.apache.org/documentation/javadoc/jena/
>>>>>>>>>>>>>>> org/apache/jena/ontology/OntResource.html
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> I used this: customer.setPropertyValue(property,
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> pricevariable);
>>>>>>>> property here is property name:Item price and pricevariable is
>>>>>>>>>>>>>>>> int
>>>>>>> value
>>>>>>>>>>>>> but it gives me error of :
>>>>>>>>>>>>>>>> *int can not be converted to RDF Node*
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> On Sat, Sep 24, 2016 at 8:29 AM, Dave Reynolds <
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> dave.e.reynolds@gmail.com>
>>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>> On 24/09/16 15:37, kumar rohit wrote:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Thanks Soroka and Dave, but how I can do it dynamically? I
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> used
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> this
>>>>>>>>>>> Property property=model.getProperty(name space+ "Item
>>>>>>>>>>>>>>>>>> price");
>>>>>>> and then customer_1.addLiteral(property, Text Field value);
>>>>>>>>> Now how to remove previously entered values? Any built-in
>>>>>>>>>>>>>>>>>> methods?
>>>>>>>>> Read my message again, I gave you the name of a method that does
>>>>>>>>>>>>>>>>> the
>>>>>>>>> replacement (= remove + add) in one go.
>>>>>>>>>>>>>>>>> The javadoc and documentation tutorials will help you find
>>>>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> many
>>>>>>>>> remove
>>>>>>>>>>>>>>> methods that are available.
>>>>>>>>>>>>>>>>> Dave
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> On Sat, Sep 24, 2016 at 6:48 AM, A. Soroka <
>>>>>>>>>>>>>>>>> ajs6f@virginia.edu>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>> Remove the old triple and add a new one with the new value.
>>>>>>>>>>>>>>>>>> ---
>>>>>>>>>>>>>>>>>>> A. Soroka
>>>>>>>>>>>>>>>>>>> The University of Virginia Library
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> On Sep 24, 2016, at 9:33 AM, kumar rohit <
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> kumar.eng84@gmail.com
>>>>>>> wrote:
>>>>>>>>>>>>>>> I want to save item price entered by users in file. Samsung
>>>>>>>>>>>>>>>>>>>> Galaxy
>>>>>>>>>>> hasPrice
>>>>>>>>>>>>>>>>>>> ?value.
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> User enter some value and it is stored in the file. After
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> some
>>>>>>> time,
>>>>>>>>>>>>> another price for same Samsung Galaxy is entered and it is
>>>>>>>>>>>>>>>>>>>> stored.
>>>>>>>>>>> But
>>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>>>>>> problem is that the old price is also there.
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> How can I overwrite the previous values with recently
>>>>>>>>>>>>>>>>>>>> entered
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> value
>>>>>>>>>>> so
>>>>>>>>>>>>>>> that
>>>>>>>>>>>>>>>>>>> my ontology save and shows one value at a time.
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Lorenz B�hmann
>>>>>>>>>>>>>>> AKSW group, University of Leipzig
>>>>>>>>>>>>>>> Group: http://aksw.org - semantic web research center
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Lorenz B�hmann
>>>>>>>>>>>>> AKSW group, University of Leipzig
>>>>>>>>>>>>> Group: http://aksw.org - semantic web research center
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> --
>>>>>>>>>>>>>
>>>>>>>>>>>> Lorenz B�hmann
>>>>>>>>>>> AKSW group, University of Leipzig
>>>>>>>>>>> Group: http://aksw.org - semantic web research center
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>>
>>>>>>>>>> Lorenz B�hmann
>>>>>>>>> AKSW group, University of Leipzig
>>>>>>>>> Group: http://aksw.org - semantic web research center
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>
--
Lorenz B�hmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
Re: Overwrite data of ontology
Posted by kumar rohit <ku...@gmail.com>.
Thanks Dave and Lorenz, what I actually did now is just changed the name of
data property from Item to item, and now it works i-e saved it as data
property.
Thanks again sir for both of your kind suggestions.
On Mon, Sep 26, 2016 at 10:32 AM, Dave Reynolds <da...@gmail.com>
wrote:
> On 26/09/16 18:26, kumar rohit wrote:
>
>> May I know why this occurs usually (save data as Annotations)? I wonder
>> what mistake I have actually done to encounter this.?
>>
>
> You would need to ask the protege folks why they put it there, protege is
> nothing to do with Jena.
>
> However, one thing to check is whether you are using the correct URI. If
> you have the wrong value in the "ns" variable then you might be adding a
> different property than the one you have declared.
>
> Again, to get help you need to provide a complete, minimal example.
>
> In this case you need a single generated ontology file with the
> DatatypeProperty declaration and the instance with the corresponding value
> as generated by your Jena code.
>
> Then if the ontology files looks correct but doesn't show in protege how
> you expect then you have something to talk to the protege folks about.
>
> If the file doesn't look correct then you know there's a problem in your
> jena code. In which case, if need help then show a complete, minimal
> example of the code that generated the file.
>
> Dave
>
>
> On Mon, Sep 26, 2016 at 10:22 AM, kumar rohit <ku...@gmail.com>
>> wrote:
>>
>> Hello Dave, I have Item as data type property in my Protege ontology.
>>>
>>> On Mon, Sep 26, 2016 at 9:28 AM, Dave Reynolds <
>>> dave.e.reynolds@gmail.com>
>>> wrote:
>>>
>>> On 26/09/16 16:59, kumar rohit wrote:
>>>>
>>>> I have already tried this:
>>>>>
>>>>> DatatypeProperty item= model.getDatatypeProperty(ns+"Item");
>>>>>
>>>>>
>>>> If the URI ns+"Item" is not already declared as a DatatypeProperty in
>>>> your ontology then you'll need model.createDatatypeProperty so as to
>>>> side-effect the model to include the declaration of Item.
>>>>
>>>> Dave
>>>>
>>>>
>>>> Literal value = model.createTypedLiteral(Some value);
>>>>
>>>>>
>>>>> customer.setPropertyValue(item, value);
>>>>>
>>>>> On Mon, Sep 26, 2016 at 8:22 AM, Lorenz Buehmann <
>>>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>>>
>>>>> Please try to use the Apache Jena documentations first, most things are
>>>>>
>>>>>> pretty much explained there [1]
>>>>>>
>>>>>> I am sorry my problem still exists and some values are stored as data
>>>>>>> property and some still as "Annotations" though I used the same
>>>>>>> procedure
>>>>>>> for all.
>>>>>>>
>>>>>>> OntResource res=model.createOntResource(ns+ value); //value come
>>>>>>> from
>>>>>>>
>>>>>>> java
>>>>>>
>>>>>> variable
>>>>>>>
>>>>>>> OntProperty price= model.getOntProperty(ns+"ItemPrice");
>>>>>>>
>>>>>>> I don't understand why you still do not use a typed OWL property
>>>>>> here,
>>>>>> as I said in my previous answer?...
>>>>>> OWL has object property and data property, thus, why don't you call
>>>>>>
>>>>>> model.getDatatypeProperty(ns+"ItemPrice")
>>>>>>
>>>>>> For object properties the same:
>>>>>> model.getObjectProperty(String uri)
>>>>>>
>>>>>> [1] https://jena.apache.org/documentation/ontology/#ontology-
>>>>>> properties
>>>>>>
>>>>>> customer.setPropertyValue(price, res);
>>>>>>>
>>>>>>> On Mon, Sep 26, 2016 at 5:20 AM, Lorenz B. <
>>>>>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>>>>>
>>>>>>> Yes, in that case it is supposed to be an RDF property, thus not
>>>>>>> typed
>>>>>>>
>>>>>>>> as expected to be in an OWL ontology.
>>>>>>>>
>>>>>>>> I used OntModel as model to read the ontology but used Property
>>>>>>>>> instead
>>>>>>>>>
>>>>>>>>> of
>>>>>>>>
>>>>>>>> OntProperty, is this an issue?
>>>>>>>>>
>>>>>>>>> On Mon, Sep 26, 2016 at 4:34 AM, Lorenz B. <
>>>>>>>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>>>>>>>
>>>>>>>>> For Protege it MUST be an OWL data property, otherwise the OWL API
>>>>>>>>>
>>>>>>>>>> parser will treat it as OWL annotation property. This has to be
>>>>>>>>>> explicitly declared in the ontology, the easiest way in Jena would
>>>>>>>>>> be
>>>>>>>>>>
>>>>>>>>>> to
>>>>>>>>>
>>>>>>>>
>>>>>> use an OntModel
>>>>>>>
>>>>>>>>
>>>>>>>>>> Yes Lorenz sir I have written it to disk but it writes the data in
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> the
>>>>>>>>>>
>>>>>>>>>
>>>>>> Annotations tab rather than in the data property.
>>>>>>>
>>>>>>>>
>>>>>>>>>>> Customer1.setPropertyValue(price, pricevalue);
>>>>>>>>>>> Customer1.setPropertyValue(quantity, value);
>>>>>>>>>>>
>>>>>>>>>>> I want to write as data property values.
>>>>>>>>>>>
>>>>>>>>>>> On Sun, Sep 25, 2016 at 7:35 AM, Lorenz B. <
>>>>>>>>>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>>>>>>>>>
>>>>>>>>>>> Ehm, did you write the model to disk? Without seeing any code
>>>>>>>>>>> it's
>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> like
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>> to try a shot in the dark.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>> Customer1.setPropertyValue(price, pricevalue);
>>>>>>>>>>>>
>>>>>>>>>>>>> Customer1.setPropertyValue(quantity, value);
>>>>>>>>>>>>>
>>>>>>>>>>>>> Next time after login as Customer1, previous data has not
>>>>>>>>>>>>>
>>>>>>>>>>>>> overwritten
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>> and
>>>>>>>
>>>>>>>>
>>>>>>>>>> the owl file shows me old data also..
>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>> On Sun, Sep 25, 2016 at 4:16 AM, Lorenz B. <
>>>>>>>>>>>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>> Please learn to read the Javadoc [1] if you're programming in
>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Java...
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>> And using an IDE would also help, usually this is able to show you
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>> the
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>> arguments and it's expected types.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> [1]
>>>>>>>>>>>>>> https://jena.apache.org/documentation/javadoc/jena/
>>>>>>>>>>>>>> org/apache/jena/ontology/OntResource.html
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> I used this: customer.setPropertyValue(property,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> pricevariable);
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>
>>>>>>> property here is property name:Item price and pricevariable is
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> int
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>> value
>>>>>>>
>>>>>>>>
>>>>>>>>>>>> but it gives me error of :
>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> *int can not be converted to RDF Node*
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> On Sat, Sep 24, 2016 at 8:29 AM, Dave Reynolds <
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> dave.e.reynolds@gmail.com>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> On 24/09/16 15:37, kumar rohit wrote:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Thanks Soroka and Dave, but how I can do it dynamically? I
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> used
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> this
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>> Property property=model.getProperty(name space+ "Item
>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> price");
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>> and then customer_1.addLiteral(property, Text Field value);
>>>>>>>
>>>>>>>> Now how to remove previously entered values? Any built-in
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> methods?
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>> Read my message again, I gave you the name of a method that does
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>> replacement (= remove + add) in one go.
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>>>> The javadoc and documentation tutorials will help you find
>>>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> many
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>> remove
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>>> methods that are available.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Dave
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> On Sat, Sep 24, 2016 at 6:48 AM, A. Soroka <
>>>>>>>>>>>>>>>> ajs6f@virginia.edu>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>> Remove the old triple and add a new one with the new value.
>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> ---
>>>>>>>>>>>>>>>>>> A. Soroka
>>>>>>>>>>>>>>>>>> The University of Virginia Library
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> On Sep 24, 2016, at 9:33 AM, kumar rohit <
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> kumar.eng84@gmail.com
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>> wrote:
>>>>>>>
>>>>>>>>
>>>>>>>>>>>>>> I want to save item price entered by users in file. Samsung
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Galaxy
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>> hasPrice
>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> ?value.
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> User enter some value and it is stored in the file. After
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> some
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>> time,
>>>>>>>
>>>>>>>>
>>>>>>>>>>>> another price for same Samsung Galaxy is entered and it is
>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> stored.
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>> But
>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> problem is that the old price is also there.
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> How can I overwrite the previous values with recently
>>>>>>>>>>>>>>>>>>> entered
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> value
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>> so
>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>>> that
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> my ontology save and shows one value at a time.
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Lorenz Bühmann
>>>>>>>>>>>>>> AKSW group, University of Leipzig
>>>>>>>>>>>>>> Group: http://aksw.org - semantic web research center
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>
>>>>>>>>>>>>> Lorenz Bühmann
>>>>>>>>>>>> AKSW group, University of Leipzig
>>>>>>>>>>>> Group: http://aksw.org - semantic web research center
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>>
>>>>>>>>>>> Lorenz Bühmann
>>>>>>>>>> AKSW group, University of Leipzig
>>>>>>>>>> Group: http://aksw.org - semantic web research center
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>>
>>>>>>>>> Lorenz Bühmann
>>>>>>>> AKSW group, University of Leipzig
>>>>>>>> Group: http://aksw.org - semantic web research center
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>
Re: Overwrite data of ontology
Posted by Dave Reynolds <da...@gmail.com>.
On 26/09/16 18:26, kumar rohit wrote:
> May I know why this occurs usually (save data as Annotations)? I wonder
> what mistake I have actually done to encounter this.?
You would need to ask the protege folks why they put it there, protege
is nothing to do with Jena.
However, one thing to check is whether you are using the correct URI. If
you have the wrong value in the "ns" variable then you might be adding a
different property than the one you have declared.
Again, to get help you need to provide a complete, minimal example.
In this case you need a single generated ontology file with the
DatatypeProperty declaration and the instance with the corresponding
value as generated by your Jena code.
Then if the ontology files looks correct but doesn't show in protege how
you expect then you have something to talk to the protege folks about.
If the file doesn't look correct then you know there's a problem in your
jena code. In which case, if need help then show a complete, minimal
example of the code that generated the file.
Dave
> On Mon, Sep 26, 2016 at 10:22 AM, kumar rohit <ku...@gmail.com> wrote:
>
>> Hello Dave, I have Item as data type property in my Protege ontology.
>>
>> On Mon, Sep 26, 2016 at 9:28 AM, Dave Reynolds <da...@gmail.com>
>> wrote:
>>
>>> On 26/09/16 16:59, kumar rohit wrote:
>>>
>>>> I have already tried this:
>>>>
>>>> DatatypeProperty item= model.getDatatypeProperty(ns+"Item");
>>>>
>>>
>>> If the URI ns+"Item" is not already declared as a DatatypeProperty in
>>> your ontology then you'll need model.createDatatypeProperty so as to
>>> side-effect the model to include the declaration of Item.
>>>
>>> Dave
>>>
>>>
>>> Literal value = model.createTypedLiteral(Some value);
>>>>
>>>> customer.setPropertyValue(item, value);
>>>>
>>>> On Mon, Sep 26, 2016 at 8:22 AM, Lorenz Buehmann <
>>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>>
>>>> Please try to use the Apache Jena documentations first, most things are
>>>>> pretty much explained there [1]
>>>>>
>>>>>> I am sorry my problem still exists and some values are stored as data
>>>>>> property and some still as "Annotations" though I used the same
>>>>>> procedure
>>>>>> for all.
>>>>>>
>>>>>> OntResource res=model.createOntResource(ns+ value); //value come from
>>>>>>
>>>>> java
>>>>>
>>>>>> variable
>>>>>>
>>>>>> OntProperty price= model.getOntProperty(ns+"ItemPrice");
>>>>>>
>>>>> I don't understand why you still do not use a typed OWL property here,
>>>>> as I said in my previous answer?...
>>>>> OWL has object property and data property, thus, why don't you call
>>>>>
>>>>> model.getDatatypeProperty(ns+"ItemPrice")
>>>>>
>>>>> For object properties the same:
>>>>> model.getObjectProperty(String uri)
>>>>>
>>>>> [1] https://jena.apache.org/documentation/ontology/#ontology-properties
>>>>>
>>>>>> customer.setPropertyValue(price, res);
>>>>>>
>>>>>> On Mon, Sep 26, 2016 at 5:20 AM, Lorenz B. <
>>>>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>>>>
>>>>>> Yes, in that case it is supposed to be an RDF property, thus not typed
>>>>>>> as expected to be in an OWL ontology.
>>>>>>>
>>>>>>>> I used OntModel as model to read the ontology but used Property
>>>>>>>> instead
>>>>>>>>
>>>>>>> of
>>>>>>>
>>>>>>>> OntProperty, is this an issue?
>>>>>>>>
>>>>>>>> On Mon, Sep 26, 2016 at 4:34 AM, Lorenz B. <
>>>>>>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>>>>>>
>>>>>>>> For Protege it MUST be an OWL data property, otherwise the OWL API
>>>>>>>>> parser will treat it as OWL annotation property. This has to be
>>>>>>>>> explicitly declared in the ontology, the easiest way in Jena would
>>>>>>>>> be
>>>>>>>>>
>>>>>>>> to
>>>>>
>>>>>> use an OntModel
>>>>>>>>>
>>>>>>>>> Yes Lorenz sir I have written it to disk but it writes the data in
>>>>>>>>>>
>>>>>>>>> the
>>>>>
>>>>>> Annotations tab rather than in the data property.
>>>>>>>>>>
>>>>>>>>>> Customer1.setPropertyValue(price, pricevalue);
>>>>>>>>>> Customer1.setPropertyValue(quantity, value);
>>>>>>>>>>
>>>>>>>>>> I want to write as data property values.
>>>>>>>>>>
>>>>>>>>>> On Sun, Sep 25, 2016 at 7:35 AM, Lorenz B. <
>>>>>>>>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>>>>>>>>
>>>>>>>>>> Ehm, did you write the model to disk? Without seeing any code it's
>>>>>>>>>>>
>>>>>>>>>> like
>>>>>>>
>>>>>>>> to try a shot in the dark.
>>>>>>>>>>>
>>>>>>>>>>> Customer1.setPropertyValue(price, pricevalue);
>>>>>>>>>>>> Customer1.setPropertyValue(quantity, value);
>>>>>>>>>>>>
>>>>>>>>>>>> Next time after login as Customer1, previous data has not
>>>>>>>>>>>>
>>>>>>>>>>> overwritten
>>>>>
>>>>>> and
>>>>>>>>>
>>>>>>>>>> the owl file shows me old data also..
>>>>>>>>>>>>
>>>>>>>>>>>> On Sun, Sep 25, 2016 at 4:16 AM, Lorenz B. <
>>>>>>>>>>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>> Please learn to read the Javadoc [1] if you're programming in
>>>>>>>>>>>>>
>>>>>>>>>>>> Java...
>>>>>>>
>>>>>>>> And using an IDE would also help, usually this is able to show you
>>>>>>>>>>>>>
>>>>>>>>>>>> the
>>>>>>>
>>>>>>>> arguments and it's expected types.
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> [1]
>>>>>>>>>>>>> https://jena.apache.org/documentation/javadoc/jena/
>>>>>>>>>>>>> org/apache/jena/ontology/OntResource.html
>>>>>>>>>>>>>
>>>>>>>>>>>>> I used this: customer.setPropertyValue(property,
>>>>>>>>>>>>>>
>>>>>>>>>>>>> pricevariable);
>>>>>
>>>>>>
>>>>>>>>>>>>>> property here is property name:Item price and pricevariable is
>>>>>>>>>>>>>>
>>>>>>>>>>>>> int
>>>>>
>>>>>> value
>>>>>>>>>>>
>>>>>>>>>>>> but it gives me error of :
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> *int can not be converted to RDF Node*
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On Sat, Sep 24, 2016 at 8:29 AM, Dave Reynolds <
>>>>>>>>>>>>>>
>>>>>>>>>>>>> dave.e.reynolds@gmail.com>
>>>>>>>>>>>>>
>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On 24/09/16 15:37, kumar rohit wrote:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Thanks Soroka and Dave, but how I can do it dynamically? I
>>>>>>>>>>>>>>>> used
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> this
>>>>>>>>>
>>>>>>>>>> Property property=model.getProperty(name space+ "Item
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> price");
>>>>>
>>>>>> and then customer_1.addLiteral(property, Text Field value);
>>>>>>>>>>>>>>>> Now how to remove previously entered values? Any built-in
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> methods?
>>>>>>>
>>>>>>>> Read my message again, I gave you the name of a method that does
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>> the
>>>>>>>
>>>>>>>> replacement (= remove + add) in one go.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> The javadoc and documentation tutorials will help you find the
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>> many
>>>>>>>
>>>>>>>> remove
>>>>>>>>>>>>>
>>>>>>>>>>>>>> methods that are available.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Dave
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> On Sat, Sep 24, 2016 at 6:48 AM, A. Soroka <
>>>>>>>>>>>>>>> ajs6f@virginia.edu>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Remove the old triple and add a new one with the new value.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> ---
>>>>>>>>>>>>>>>>> A. Soroka
>>>>>>>>>>>>>>>>> The University of Virginia Library
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> On Sep 24, 2016, at 9:33 AM, kumar rohit <
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> kumar.eng84@gmail.com
>>>>>
>>>>>> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>> I want to save item price entered by users in file. Samsung
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Galaxy
>>>>>>>>>
>>>>>>>>>> hasPrice
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> ?value.
>>>>>>>>>>>>>>>>>> User enter some value and it is stored in the file. After
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> some
>>>>>
>>>>>> time,
>>>>>>>>>>>
>>>>>>>>>>>> another price for same Samsung Galaxy is entered and it is
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> stored.
>>>>>>>>>
>>>>>>>>>> But
>>>>>>>>>>>>>
>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> problem is that the old price is also there.
>>>>>>>>>>>>>>>>>> How can I overwrite the previous values with recently
>>>>>>>>>>>>>>>>>> entered
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> value
>>>>>>>>>
>>>>>>>>>> so
>>>>>>>>>>>>>
>>>>>>>>>>>>>> that
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> my ontology save and shows one value at a time.
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> --
>>>>>>>>>>>>> Lorenz B�hmann
>>>>>>>>>>>>> AKSW group, University of Leipzig
>>>>>>>>>>>>> Group: http://aksw.org - semantic web research center
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> --
>>>>>>>>>>> Lorenz B�hmann
>>>>>>>>>>> AKSW group, University of Leipzig
>>>>>>>>>>> Group: http://aksw.org - semantic web research center
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>> Lorenz B�hmann
>>>>>>>>> AKSW group, University of Leipzig
>>>>>>>>> Group: http://aksw.org - semantic web research center
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>> Lorenz B�hmann
>>>>>>> AKSW group, University of Leipzig
>>>>>>> Group: http://aksw.org - semantic web research center
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>
Re: Overwrite data of ontology
Posted by kumar rohit <ku...@gmail.com>.
So it means we have to use DatatypeProperty, ObjecttypeProperty instead of
just Property etc?
I still confuse, if we used OntModel, we should use DatatypeProperty or
OntProperty?
On Mon, Sep 26, 2016 at 12:19 PM, Lorenz Buehmann <
buehmann@informatik.uni-leipzig.de> wrote:
> Nothing is "saved as annotations". Without using explicit OWL types, the
> OWL API - which is quite strict -
>
> is not able to determine the type of a property, thus, it's treated as
> annotation property. and according to the OWL 2 specs, entities have to
> be typed explicitly.
>
>
> On 26.09.2016 19:26, kumar rohit wrote:
> > May I know why this occurs usually (save data as Annotations)? I wonder
> > what mistake I have actually done to encounter this.?
> >
> >
> > On Mon, Sep 26, 2016 at 10:22 AM, kumar rohit <ku...@gmail.com>
> wrote:
> >
> >> Hello Dave, I have Item as data type property in my Protege ontology.
> >>
> >> On Mon, Sep 26, 2016 at 9:28 AM, Dave Reynolds <
> dave.e.reynolds@gmail.com>
> >> wrote:
> >>
> >>> On 26/09/16 16:59, kumar rohit wrote:
> >>>
> >>>> I have already tried this:
> >>>>
> >>>> DatatypeProperty item= model.getDatatypeProperty(ns+"Item");
> >>>>
> >>> If the URI ns+"Item" is not already declared as a DatatypeProperty in
> >>> your ontology then you'll need model.createDatatypeProperty so as to
> >>> side-effect the model to include the declaration of Item.
> >>>
> >>> Dave
> >>>
> >>>
> >>> Literal value = model.createTypedLiteral(Some value);
> >>>> customer.setPropertyValue(item, value);
> >>>>
> >>>> On Mon, Sep 26, 2016 at 8:22 AM, Lorenz Buehmann <
> >>>> buehmann@informatik.uni-leipzig.de> wrote:
> >>>>
> >>>> Please try to use the Apache Jena documentations first, most things
> are
> >>>>> pretty much explained there [1]
> >>>>>
> >>>>>> I am sorry my problem still exists and some values are stored as
> data
> >>>>>> property and some still as "Annotations" though I used the same
> >>>>>> procedure
> >>>>>> for all.
> >>>>>>
> >>>>>> OntResource res=model.createOntResource(ns+ value); //value come
> from
> >>>>>>
> >>>>> java
> >>>>>
> >>>>>> variable
> >>>>>>
> >>>>>> OntProperty price= model.getOntProperty(ns+"ItemPrice");
> >>>>>>
> >>>>> I don't understand why you still do not use a typed OWL property
> here,
> >>>>> as I said in my previous answer?...
> >>>>> OWL has object property and data property, thus, why don't you call
> >>>>>
> >>>>> model.getDatatypeProperty(ns+"ItemPrice")
> >>>>>
> >>>>> For object properties the same:
> >>>>> model.getObjectProperty(String uri)
> >>>>>
> >>>>> [1] https://jena.apache.org/documentation/ontology/#
> ontology-properties
> >>>>>
> >>>>>> customer.setPropertyValue(price, res);
> >>>>>>
> >>>>>> On Mon, Sep 26, 2016 at 5:20 AM, Lorenz B. <
> >>>>>> buehmann@informatik.uni-leipzig.de> wrote:
> >>>>>>
> >>>>>> Yes, in that case it is supposed to be an RDF property, thus not
> typed
> >>>>>>> as expected to be in an OWL ontology.
> >>>>>>>
> >>>>>>>> I used OntModel as model to read the ontology but used Property
> >>>>>>>> instead
> >>>>>>>>
> >>>>>>> of
> >>>>>>>
> >>>>>>>> OntProperty, is this an issue?
> >>>>>>>>
> >>>>>>>> On Mon, Sep 26, 2016 at 4:34 AM, Lorenz B. <
> >>>>>>>> buehmann@informatik.uni-leipzig.de> wrote:
> >>>>>>>>
> >>>>>>>> For Protege it MUST be an OWL data property, otherwise the OWL API
> >>>>>>>>> parser will treat it as OWL annotation property. This has to be
> >>>>>>>>> explicitly declared in the ontology, the easiest way in Jena
> would
> >>>>>>>>> be
> >>>>>>>>>
> >>>>>>>> to
> >>>>>> use an OntModel
> >>>>>>>>> Yes Lorenz sir I have written it to disk but it writes the data
> in
> >>>>>>>>> the
> >>>>>> Annotations tab rather than in the data property.
> >>>>>>>>>> Customer1.setPropertyValue(price, pricevalue);
> >>>>>>>>>> Customer1.setPropertyValue(quantity, value);
> >>>>>>>>>>
> >>>>>>>>>> I want to write as data property values.
> >>>>>>>>>>
> >>>>>>>>>> On Sun, Sep 25, 2016 at 7:35 AM, Lorenz B. <
> >>>>>>>>>> buehmann@informatik.uni-leipzig.de> wrote:
> >>>>>>>>>>
> >>>>>>>>>> Ehm, did you write the model to disk? Without seeing any code
> it's
> >>>>>>>>>> like
> >>>>>>>> to try a shot in the dark.
> >>>>>>>>>>> Customer1.setPropertyValue(price, pricevalue);
> >>>>>>>>>>>> Customer1.setPropertyValue(quantity, value);
> >>>>>>>>>>>>
> >>>>>>>>>>>> Next time after login as Customer1, previous data has not
> >>>>>>>>>>>>
> >>>>>>>>>>> overwritten
> >>>>>> and
> >>>>>>>>>> the owl file shows me old data also..
> >>>>>>>>>>>> On Sun, Sep 25, 2016 at 4:16 AM, Lorenz B. <
> >>>>>>>>>>>> buehmann@informatik.uni-leipzig.de> wrote:
> >>>>>>>>>>>>
> >>>>>>>>>>>> Please learn to read the Javadoc [1] if you're programming in
> >>>>>>>>>>>> Java...
> >>>>>>>> And using an IDE would also help, usually this is able to show you
> >>>>>>>>>>>> the
> >>>>>>>> arguments and it's expected types.
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> [1]
> >>>>>>>>>>>>> https://jena.apache.org/documentation/javadoc/jena/
> >>>>>>>>>>>>> org/apache/jena/ontology/OntResource.html
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> I used this: customer.setPropertyValue(property,
> >>>>>>>>>>>>> pricevariable);
> >>>>>>>>>>>>>> property here is property name:Item price and pricevariable
> is
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>> int
> >>>>>> value
> >>>>>>>>>>>> but it gives me error of :
> >>>>>>>>>>>>>> *int can not be converted to RDF Node*
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> On Sat, Sep 24, 2016 at 8:29 AM, Dave Reynolds <
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>> dave.e.reynolds@gmail.com>
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>> wrote:
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> On 24/09/16 15:37, kumar rohit wrote:
> >>>>>>>>>>>>>>> Thanks Soroka and Dave, but how I can do it dynamically? I
> >>>>>>>>>>>>>>>> used
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> this
> >>>>>>>>>> Property property=model.getProperty(name space+ "Item
> >>>>>>>>>>>>>>> price");
> >>>>>> and then customer_1.addLiteral(property, Text Field value);
> >>>>>>>>>>>>>>>> Now how to remove previously entered values? Any built-in
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> methods?
> >>>>>>>> Read my message again, I gave you the name of a method that does
> >>>>>>>>>>>>>> the
> >>>>>>>> replacement (= remove + add) in one go.
> >>>>>>>>>>>>>>> The javadoc and documentation tutorials will help you find
> the
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>> many
> >>>>>>>> remove
> >>>>>>>>>>>>>> methods that are available.
> >>>>>>>>>>>>>>> Dave
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> On Sat, Sep 24, 2016 at 6:48 AM, A. Soroka <
> >>>>>>>>>>>>>>> ajs6f@virginia.edu>
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>> wrote:
> >>>>>>>>>>>> Remove the old triple and add a new one with the new value.
> >>>>>>>>>>>>>>>>> ---
> >>>>>>>>>>>>>>>>> A. Soroka
> >>>>>>>>>>>>>>>>> The University of Virginia Library
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> On Sep 24, 2016, at 9:33 AM, kumar rohit <
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> kumar.eng84@gmail.com
> >>>>>> wrote:
> >>>>>>>>>>>>>> I want to save item price entered by users in file. Samsung
> >>>>>>>>>>>>>>>>> Galaxy
> >>>>>>>>>> hasPrice
> >>>>>>>>>>>>>>>>> ?value.
> >>>>>>>>>>>>>>>>>> User enter some value and it is stored in the file.
> After
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> some
> >>>>>> time,
> >>>>>>>>>>>> another price for same Samsung Galaxy is entered and it is
> >>>>>>>>>>>>>>>>> stored.
> >>>>>>>>>> But
> >>>>>>>>>>>>>> the
> >>>>>>>>>>>>>>>>> problem is that the old price is also there.
> >>>>>>>>>>>>>>>>>> How can I overwrite the previous values with recently
> >>>>>>>>>>>>>>>>>> entered
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> value
> >>>>>>>>>> so
> >>>>>>>>>>>>>> that
> >>>>>>>>>>>>>>>>> my ontology save and shows one value at a time.
> >>>>>>>>>>>>>>>>>> --
> >>>>>>>>>>>>> Lorenz Bühmann
> >>>>>>>>>>>>> AKSW group, University of Leipzig
> >>>>>>>>>>>>> Group: http://aksw.org - semantic web research center
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> --
> >>>>>>>>>>> Lorenz Bühmann
> >>>>>>>>>>> AKSW group, University of Leipzig
> >>>>>>>>>>> Group: http://aksw.org - semantic web research center
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>> --
> >>>>>>>>> Lorenz Bühmann
> >>>>>>>>> AKSW group, University of Leipzig
> >>>>>>>>> Group: http://aksw.org - semantic web research center
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>> --
> >>>>>>> Lorenz Bühmann
> >>>>>>> AKSW group, University of Leipzig
> >>>>>>> Group: http://aksw.org - semantic web research center
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>
>
>
Re: Overwrite data of ontology
Posted by Lorenz Buehmann <bu...@informatik.uni-leipzig.de>.
Nothing is "saved as annotations". Without using explicit OWL types, the
OWL API - which is quite strict -
is not able to determine the type of a property, thus, it's treated as
annotation property. and according to the OWL 2 specs, entities have to
be typed explicitly.
On 26.09.2016 19:26, kumar rohit wrote:
> May I know why this occurs usually (save data as Annotations)? I wonder
> what mistake I have actually done to encounter this.?
>
>
> On Mon, Sep 26, 2016 at 10:22 AM, kumar rohit <ku...@gmail.com> wrote:
>
>> Hello Dave, I have Item as data type property in my Protege ontology.
>>
>> On Mon, Sep 26, 2016 at 9:28 AM, Dave Reynolds <da...@gmail.com>
>> wrote:
>>
>>> On 26/09/16 16:59, kumar rohit wrote:
>>>
>>>> I have already tried this:
>>>>
>>>> DatatypeProperty item= model.getDatatypeProperty(ns+"Item");
>>>>
>>> If the URI ns+"Item" is not already declared as a DatatypeProperty in
>>> your ontology then you'll need model.createDatatypeProperty so as to
>>> side-effect the model to include the declaration of Item.
>>>
>>> Dave
>>>
>>>
>>> Literal value = model.createTypedLiteral(Some value);
>>>> customer.setPropertyValue(item, value);
>>>>
>>>> On Mon, Sep 26, 2016 at 8:22 AM, Lorenz Buehmann <
>>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>>
>>>> Please try to use the Apache Jena documentations first, most things are
>>>>> pretty much explained there [1]
>>>>>
>>>>>> I am sorry my problem still exists and some values are stored as data
>>>>>> property and some still as "Annotations" though I used the same
>>>>>> procedure
>>>>>> for all.
>>>>>>
>>>>>> OntResource res=model.createOntResource(ns+ value); //value come from
>>>>>>
>>>>> java
>>>>>
>>>>>> variable
>>>>>>
>>>>>> OntProperty price= model.getOntProperty(ns+"ItemPrice");
>>>>>>
>>>>> I don't understand why you still do not use a typed OWL property here,
>>>>> as I said in my previous answer?...
>>>>> OWL has object property and data property, thus, why don't you call
>>>>>
>>>>> model.getDatatypeProperty(ns+"ItemPrice")
>>>>>
>>>>> For object properties the same:
>>>>> model.getObjectProperty(String uri)
>>>>>
>>>>> [1] https://jena.apache.org/documentation/ontology/#ontology-properties
>>>>>
>>>>>> customer.setPropertyValue(price, res);
>>>>>>
>>>>>> On Mon, Sep 26, 2016 at 5:20 AM, Lorenz B. <
>>>>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>>>>
>>>>>> Yes, in that case it is supposed to be an RDF property, thus not typed
>>>>>>> as expected to be in an OWL ontology.
>>>>>>>
>>>>>>>> I used OntModel as model to read the ontology but used Property
>>>>>>>> instead
>>>>>>>>
>>>>>>> of
>>>>>>>
>>>>>>>> OntProperty, is this an issue?
>>>>>>>>
>>>>>>>> On Mon, Sep 26, 2016 at 4:34 AM, Lorenz B. <
>>>>>>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>>>>>>
>>>>>>>> For Protege it MUST be an OWL data property, otherwise the OWL API
>>>>>>>>> parser will treat it as OWL annotation property. This has to be
>>>>>>>>> explicitly declared in the ontology, the easiest way in Jena would
>>>>>>>>> be
>>>>>>>>>
>>>>>>>> to
>>>>>> use an OntModel
>>>>>>>>> Yes Lorenz sir I have written it to disk but it writes the data in
>>>>>>>>> the
>>>>>> Annotations tab rather than in the data property.
>>>>>>>>>> Customer1.setPropertyValue(price, pricevalue);
>>>>>>>>>> Customer1.setPropertyValue(quantity, value);
>>>>>>>>>>
>>>>>>>>>> I want to write as data property values.
>>>>>>>>>>
>>>>>>>>>> On Sun, Sep 25, 2016 at 7:35 AM, Lorenz B. <
>>>>>>>>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>>>>>>>>
>>>>>>>>>> Ehm, did you write the model to disk? Without seeing any code it's
>>>>>>>>>> like
>>>>>>>> to try a shot in the dark.
>>>>>>>>>>> Customer1.setPropertyValue(price, pricevalue);
>>>>>>>>>>>> Customer1.setPropertyValue(quantity, value);
>>>>>>>>>>>>
>>>>>>>>>>>> Next time after login as Customer1, previous data has not
>>>>>>>>>>>>
>>>>>>>>>>> overwritten
>>>>>> and
>>>>>>>>>> the owl file shows me old data also..
>>>>>>>>>>>> On Sun, Sep 25, 2016 at 4:16 AM, Lorenz B. <
>>>>>>>>>>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>> Please learn to read the Javadoc [1] if you're programming in
>>>>>>>>>>>> Java...
>>>>>>>> And using an IDE would also help, usually this is able to show you
>>>>>>>>>>>> the
>>>>>>>> arguments and it's expected types.
>>>>>>>>>>>>>
>>>>>>>>>>>>> [1]
>>>>>>>>>>>>> https://jena.apache.org/documentation/javadoc/jena/
>>>>>>>>>>>>> org/apache/jena/ontology/OntResource.html
>>>>>>>>>>>>>
>>>>>>>>>>>>> I used this: customer.setPropertyValue(property,
>>>>>>>>>>>>> pricevariable);
>>>>>>>>>>>>>> property here is property name:Item price and pricevariable is
>>>>>>>>>>>>>>
>>>>>>>>>>>>> int
>>>>>> value
>>>>>>>>>>>> but it gives me error of :
>>>>>>>>>>>>>> *int can not be converted to RDF Node*
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On Sat, Sep 24, 2016 at 8:29 AM, Dave Reynolds <
>>>>>>>>>>>>>>
>>>>>>>>>>>>> dave.e.reynolds@gmail.com>
>>>>>>>>>>>>>
>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On 24/09/16 15:37, kumar rohit wrote:
>>>>>>>>>>>>>>> Thanks Soroka and Dave, but how I can do it dynamically? I
>>>>>>>>>>>>>>>> used
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> this
>>>>>>>>>> Property property=model.getProperty(name space+ "Item
>>>>>>>>>>>>>>> price");
>>>>>> and then customer_1.addLiteral(property, Text Field value);
>>>>>>>>>>>>>>>> Now how to remove previously entered values? Any built-in
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> methods?
>>>>>>>> Read my message again, I gave you the name of a method that does
>>>>>>>>>>>>>> the
>>>>>>>> replacement (= remove + add) in one go.
>>>>>>>>>>>>>>> The javadoc and documentation tutorials will help you find the
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>> many
>>>>>>>> remove
>>>>>>>>>>>>>> methods that are available.
>>>>>>>>>>>>>>> Dave
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> On Sat, Sep 24, 2016 at 6:48 AM, A. Soroka <
>>>>>>>>>>>>>>> ajs6f@virginia.edu>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>> Remove the old triple and add a new one with the new value.
>>>>>>>>>>>>>>>>> ---
>>>>>>>>>>>>>>>>> A. Soroka
>>>>>>>>>>>>>>>>> The University of Virginia Library
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> On Sep 24, 2016, at 9:33 AM, kumar rohit <
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> kumar.eng84@gmail.com
>>>>>> wrote:
>>>>>>>>>>>>>> I want to save item price entered by users in file. Samsung
>>>>>>>>>>>>>>>>> Galaxy
>>>>>>>>>> hasPrice
>>>>>>>>>>>>>>>>> ?value.
>>>>>>>>>>>>>>>>>> User enter some value and it is stored in the file. After
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> some
>>>>>> time,
>>>>>>>>>>>> another price for same Samsung Galaxy is entered and it is
>>>>>>>>>>>>>>>>> stored.
>>>>>>>>>> But
>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>>>> problem is that the old price is also there.
>>>>>>>>>>>>>>>>>> How can I overwrite the previous values with recently
>>>>>>>>>>>>>>>>>> entered
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> value
>>>>>>>>>> so
>>>>>>>>>>>>>> that
>>>>>>>>>>>>>>>>> my ontology save and shows one value at a time.
>>>>>>>>>>>>>>>>>> --
>>>>>>>>>>>>> Lorenz B�hmann
>>>>>>>>>>>>> AKSW group, University of Leipzig
>>>>>>>>>>>>> Group: http://aksw.org - semantic web research center
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> --
>>>>>>>>>>> Lorenz B�hmann
>>>>>>>>>>> AKSW group, University of Leipzig
>>>>>>>>>>> Group: http://aksw.org - semantic web research center
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>> Lorenz B�hmann
>>>>>>>>> AKSW group, University of Leipzig
>>>>>>>>> Group: http://aksw.org - semantic web research center
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>> Lorenz B�hmann
>>>>>>> AKSW group, University of Leipzig
>>>>>>> Group: http://aksw.org - semantic web research center
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
Re: Overwrite data of ontology
Posted by kumar rohit <ku...@gmail.com>.
May I know why this occurs usually (save data as Annotations)? I wonder
what mistake I have actually done to encounter this.?
On Mon, Sep 26, 2016 at 10:22 AM, kumar rohit <ku...@gmail.com> wrote:
> Hello Dave, I have Item as data type property in my Protege ontology.
>
> On Mon, Sep 26, 2016 at 9:28 AM, Dave Reynolds <da...@gmail.com>
> wrote:
>
>> On 26/09/16 16:59, kumar rohit wrote:
>>
>>> I have already tried this:
>>>
>>> DatatypeProperty item= model.getDatatypeProperty(ns+"Item");
>>>
>>
>> If the URI ns+"Item" is not already declared as a DatatypeProperty in
>> your ontology then you'll need model.createDatatypeProperty so as to
>> side-effect the model to include the declaration of Item.
>>
>> Dave
>>
>>
>> Literal value = model.createTypedLiteral(Some value);
>>>
>>> customer.setPropertyValue(item, value);
>>>
>>> On Mon, Sep 26, 2016 at 8:22 AM, Lorenz Buehmann <
>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>
>>> Please try to use the Apache Jena documentations first, most things are
>>>> pretty much explained there [1]
>>>>
>>>>> I am sorry my problem still exists and some values are stored as data
>>>>> property and some still as "Annotations" though I used the same
>>>>> procedure
>>>>> for all.
>>>>>
>>>>> OntResource res=model.createOntResource(ns+ value); //value come from
>>>>>
>>>> java
>>>>
>>>>> variable
>>>>>
>>>>> OntProperty price= model.getOntProperty(ns+"ItemPrice");
>>>>>
>>>> I don't understand why you still do not use a typed OWL property here,
>>>> as I said in my previous answer?...
>>>> OWL has object property and data property, thus, why don't you call
>>>>
>>>> model.getDatatypeProperty(ns+"ItemPrice")
>>>>
>>>> For object properties the same:
>>>> model.getObjectProperty(String uri)
>>>>
>>>> [1] https://jena.apache.org/documentation/ontology/#ontology-properties
>>>>
>>>>> customer.setPropertyValue(price, res);
>>>>>
>>>>> On Mon, Sep 26, 2016 at 5:20 AM, Lorenz B. <
>>>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>>>
>>>>> Yes, in that case it is supposed to be an RDF property, thus not typed
>>>>>> as expected to be in an OWL ontology.
>>>>>>
>>>>>>> I used OntModel as model to read the ontology but used Property
>>>>>>> instead
>>>>>>>
>>>>>> of
>>>>>>
>>>>>>> OntProperty, is this an issue?
>>>>>>>
>>>>>>> On Mon, Sep 26, 2016 at 4:34 AM, Lorenz B. <
>>>>>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>>>>>
>>>>>>> For Protege it MUST be an OWL data property, otherwise the OWL API
>>>>>>>> parser will treat it as OWL annotation property. This has to be
>>>>>>>> explicitly declared in the ontology, the easiest way in Jena would
>>>>>>>> be
>>>>>>>>
>>>>>>> to
>>>>
>>>>> use an OntModel
>>>>>>>>
>>>>>>>> Yes Lorenz sir I have written it to disk but it writes the data in
>>>>>>>>>
>>>>>>>> the
>>>>
>>>>> Annotations tab rather than in the data property.
>>>>>>>>>
>>>>>>>>> Customer1.setPropertyValue(price, pricevalue);
>>>>>>>>> Customer1.setPropertyValue(quantity, value);
>>>>>>>>>
>>>>>>>>> I want to write as data property values.
>>>>>>>>>
>>>>>>>>> On Sun, Sep 25, 2016 at 7:35 AM, Lorenz B. <
>>>>>>>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>>>>>>>
>>>>>>>>> Ehm, did you write the model to disk? Without seeing any code it's
>>>>>>>>>>
>>>>>>>>> like
>>>>>>
>>>>>>> to try a shot in the dark.
>>>>>>>>>>
>>>>>>>>>> Customer1.setPropertyValue(price, pricevalue);
>>>>>>>>>>> Customer1.setPropertyValue(quantity, value);
>>>>>>>>>>>
>>>>>>>>>>> Next time after login as Customer1, previous data has not
>>>>>>>>>>>
>>>>>>>>>> overwritten
>>>>
>>>>> and
>>>>>>>>
>>>>>>>>> the owl file shows me old data also..
>>>>>>>>>>>
>>>>>>>>>>> On Sun, Sep 25, 2016 at 4:16 AM, Lorenz B. <
>>>>>>>>>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>>>>>>>>>
>>>>>>>>>>> Please learn to read the Javadoc [1] if you're programming in
>>>>>>>>>>>>
>>>>>>>>>>> Java...
>>>>>>
>>>>>>> And using an IDE would also help, usually this is able to show you
>>>>>>>>>>>>
>>>>>>>>>>> the
>>>>>>
>>>>>>> arguments and it's expected types.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> [1]
>>>>>>>>>>>> https://jena.apache.org/documentation/javadoc/jena/
>>>>>>>>>>>> org/apache/jena/ontology/OntResource.html
>>>>>>>>>>>>
>>>>>>>>>>>> I used this: customer.setPropertyValue(property,
>>>>>>>>>>>>>
>>>>>>>>>>>> pricevariable);
>>>>
>>>>>
>>>>>>>>>>>>> property here is property name:Item price and pricevariable is
>>>>>>>>>>>>>
>>>>>>>>>>>> int
>>>>
>>>>> value
>>>>>>>>>>
>>>>>>>>>>> but it gives me error of :
>>>>>>>>>>>>>
>>>>>>>>>>>>> *int can not be converted to RDF Node*
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Sat, Sep 24, 2016 at 8:29 AM, Dave Reynolds <
>>>>>>>>>>>>>
>>>>>>>>>>>> dave.e.reynolds@gmail.com>
>>>>>>>>>>>>
>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>> On 24/09/16 15:37, kumar rohit wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Thanks Soroka and Dave, but how I can do it dynamically? I
>>>>>>>>>>>>>>> used
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>> this
>>>>>>>>
>>>>>>>>> Property property=model.getProperty(name space+ "Item
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>> price");
>>>>
>>>>> and then customer_1.addLiteral(property, Text Field value);
>>>>>>>>>>>>>>> Now how to remove previously entered values? Any built-in
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>> methods?
>>>>>>
>>>>>>> Read my message again, I gave you the name of a method that does
>>>>>>>>>>>>>>
>>>>>>>>>>>>> the
>>>>>>
>>>>>>> replacement (= remove + add) in one go.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> The javadoc and documentation tutorials will help you find the
>>>>>>>>>>>>>>
>>>>>>>>>>>>> many
>>>>>>
>>>>>>> remove
>>>>>>>>>>>>
>>>>>>>>>>>>> methods that are available.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Dave
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On Sat, Sep 24, 2016 at 6:48 AM, A. Soroka <
>>>>>>>>>>>>>> ajs6f@virginia.edu>
>>>>>>>>>>>>>>
>>>>>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>>> Remove the old triple and add a new one with the new value.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> ---
>>>>>>>>>>>>>>>> A. Soroka
>>>>>>>>>>>>>>>> The University of Virginia Library
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> On Sep 24, 2016, at 9:33 AM, kumar rohit <
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> kumar.eng84@gmail.com
>>>>
>>>>> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> I want to save item price entered by users in file. Samsung
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Galaxy
>>>>>>>>
>>>>>>>>> hasPrice
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> ?value.
>>>>>>>>>>>>>>>>> User enter some value and it is stored in the file. After
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> some
>>>>
>>>>> time,
>>>>>>>>>>
>>>>>>>>>>> another price for same Samsung Galaxy is entered and it is
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> stored.
>>>>>>>>
>>>>>>>>> But
>>>>>>>>>>>>
>>>>>>>>>>>>> the
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> problem is that the old price is also there.
>>>>>>>>>>>>>>>>> How can I overwrite the previous values with recently
>>>>>>>>>>>>>>>>> entered
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> value
>>>>>>>>
>>>>>>>>> so
>>>>>>>>>>>>
>>>>>>>>>>>>> that
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> my ontology save and shows one value at a time.
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> --
>>>>>>>>>>>> Lorenz Bühmann
>>>>>>>>>>>> AKSW group, University of Leipzig
>>>>>>>>>>>> Group: http://aksw.org - semantic web research center
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>> Lorenz Bühmann
>>>>>>>>>> AKSW group, University of Leipzig
>>>>>>>>>> Group: http://aksw.org - semantic web research center
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>> Lorenz Bühmann
>>>>>>>> AKSW group, University of Leipzig
>>>>>>>> Group: http://aksw.org - semantic web research center
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>> Lorenz Bühmann
>>>>>> AKSW group, University of Leipzig
>>>>>> Group: http://aksw.org - semantic web research center
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>
>>>
>>
>
Re: Overwrite data of ontology
Posted by kumar rohit <ku...@gmail.com>.
Hello Dave, I have Item as data type property in my Protege ontology.
On Mon, Sep 26, 2016 at 9:28 AM, Dave Reynolds <da...@gmail.com>
wrote:
> On 26/09/16 16:59, kumar rohit wrote:
>
>> I have already tried this:
>>
>> DatatypeProperty item= model.getDatatypeProperty(ns+"Item");
>>
>
> If the URI ns+"Item" is not already declared as a DatatypeProperty in your
> ontology then you'll need model.createDatatypeProperty so as to side-effect
> the model to include the declaration of Item.
>
> Dave
>
>
> Literal value = model.createTypedLiteral(Some value);
>>
>> customer.setPropertyValue(item, value);
>>
>> On Mon, Sep 26, 2016 at 8:22 AM, Lorenz Buehmann <
>> buehmann@informatik.uni-leipzig.de> wrote:
>>
>> Please try to use the Apache Jena documentations first, most things are
>>> pretty much explained there [1]
>>>
>>>> I am sorry my problem still exists and some values are stored as data
>>>> property and some still as "Annotations" though I used the same
>>>> procedure
>>>> for all.
>>>>
>>>> OntResource res=model.createOntResource(ns+ value); //value come from
>>>>
>>> java
>>>
>>>> variable
>>>>
>>>> OntProperty price= model.getOntProperty(ns+"ItemPrice");
>>>>
>>> I don't understand why you still do not use a typed OWL property here,
>>> as I said in my previous answer?...
>>> OWL has object property and data property, thus, why don't you call
>>>
>>> model.getDatatypeProperty(ns+"ItemPrice")
>>>
>>> For object properties the same:
>>> model.getObjectProperty(String uri)
>>>
>>> [1] https://jena.apache.org/documentation/ontology/#ontology-properties
>>>
>>>> customer.setPropertyValue(price, res);
>>>>
>>>> On Mon, Sep 26, 2016 at 5:20 AM, Lorenz B. <
>>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>>
>>>> Yes, in that case it is supposed to be an RDF property, thus not typed
>>>>> as expected to be in an OWL ontology.
>>>>>
>>>>>> I used OntModel as model to read the ontology but used Property
>>>>>> instead
>>>>>>
>>>>> of
>>>>>
>>>>>> OntProperty, is this an issue?
>>>>>>
>>>>>> On Mon, Sep 26, 2016 at 4:34 AM, Lorenz B. <
>>>>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>>>>
>>>>>> For Protege it MUST be an OWL data property, otherwise the OWL API
>>>>>>> parser will treat it as OWL annotation property. This has to be
>>>>>>> explicitly declared in the ontology, the easiest way in Jena would be
>>>>>>>
>>>>>> to
>>>
>>>> use an OntModel
>>>>>>>
>>>>>>> Yes Lorenz sir I have written it to disk but it writes the data in
>>>>>>>>
>>>>>>> the
>>>
>>>> Annotations tab rather than in the data property.
>>>>>>>>
>>>>>>>> Customer1.setPropertyValue(price, pricevalue);
>>>>>>>> Customer1.setPropertyValue(quantity, value);
>>>>>>>>
>>>>>>>> I want to write as data property values.
>>>>>>>>
>>>>>>>> On Sun, Sep 25, 2016 at 7:35 AM, Lorenz B. <
>>>>>>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>>>>>>
>>>>>>>> Ehm, did you write the model to disk? Without seeing any code it's
>>>>>>>>>
>>>>>>>> like
>>>>>
>>>>>> to try a shot in the dark.
>>>>>>>>>
>>>>>>>>> Customer1.setPropertyValue(price, pricevalue);
>>>>>>>>>> Customer1.setPropertyValue(quantity, value);
>>>>>>>>>>
>>>>>>>>>> Next time after login as Customer1, previous data has not
>>>>>>>>>>
>>>>>>>>> overwritten
>>>
>>>> and
>>>>>>>
>>>>>>>> the owl file shows me old data also..
>>>>>>>>>>
>>>>>>>>>> On Sun, Sep 25, 2016 at 4:16 AM, Lorenz B. <
>>>>>>>>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>>>>>>>>
>>>>>>>>>> Please learn to read the Javadoc [1] if you're programming in
>>>>>>>>>>>
>>>>>>>>>> Java...
>>>>>
>>>>>> And using an IDE would also help, usually this is able to show you
>>>>>>>>>>>
>>>>>>>>>> the
>>>>>
>>>>>> arguments and it's expected types.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> [1]
>>>>>>>>>>> https://jena.apache.org/documentation/javadoc/jena/
>>>>>>>>>>> org/apache/jena/ontology/OntResource.html
>>>>>>>>>>>
>>>>>>>>>>> I used this: customer.setPropertyValue(property,
>>>>>>>>>>>>
>>>>>>>>>>> pricevariable);
>>>
>>>>
>>>>>>>>>>>> property here is property name:Item price and pricevariable is
>>>>>>>>>>>>
>>>>>>>>>>> int
>>>
>>>> value
>>>>>>>>>
>>>>>>>>>> but it gives me error of :
>>>>>>>>>>>>
>>>>>>>>>>>> *int can not be converted to RDF Node*
>>>>>>>>>>>>
>>>>>>>>>>>> On Sat, Sep 24, 2016 at 8:29 AM, Dave Reynolds <
>>>>>>>>>>>>
>>>>>>>>>>> dave.e.reynolds@gmail.com>
>>>>>>>>>>>
>>>>>>>>>>>> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>> On 24/09/16 15:37, kumar rohit wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>> Thanks Soroka and Dave, but how I can do it dynamically? I used
>>>>>>>>>>>>>>
>>>>>>>>>>>>> this
>>>>>>>
>>>>>>>> Property property=model.getProperty(name space+ "Item
>>>>>>>>>>>>>>
>>>>>>>>>>>>> price");
>>>
>>>> and then customer_1.addLiteral(property, Text Field value);
>>>>>>>>>>>>>> Now how to remove previously entered values? Any built-in
>>>>>>>>>>>>>>
>>>>>>>>>>>>> methods?
>>>>>
>>>>>> Read my message again, I gave you the name of a method that does
>>>>>>>>>>>>>
>>>>>>>>>>>> the
>>>>>
>>>>>> replacement (= remove + add) in one go.
>>>>>>>>>>>>>
>>>>>>>>>>>>> The javadoc and documentation tutorials will help you find the
>>>>>>>>>>>>>
>>>>>>>>>>>> many
>>>>>
>>>>>> remove
>>>>>>>>>>>
>>>>>>>>>>>> methods that are available.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Dave
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Sat, Sep 24, 2016 at 6:48 AM, A. Soroka <ajs6f@virginia.edu
>>>>>>>>>>>>> >
>>>>>>>>>>>>>
>>>>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> Remove the old triple and add a new one with the new value.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> ---
>>>>>>>>>>>>>>> A. Soroka
>>>>>>>>>>>>>>> The University of Virginia Library
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> On Sep 24, 2016, at 9:33 AM, kumar rohit <
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>> kumar.eng84@gmail.com
>>>
>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> I want to save item price entered by users in file. Samsung
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Galaxy
>>>>>>>
>>>>>>>> hasPrice
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> ?value.
>>>>>>>>>>>>>>>> User enter some value and it is stored in the file. After
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> some
>>>
>>>> time,
>>>>>>>>>
>>>>>>>>>> another price for same Samsung Galaxy is entered and it is
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> stored.
>>>>>>>
>>>>>>>> But
>>>>>>>>>>>
>>>>>>>>>>>> the
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> problem is that the old price is also there.
>>>>>>>>>>>>>>>> How can I overwrite the previous values with recently
>>>>>>>>>>>>>>>> entered
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> value
>>>>>>>
>>>>>>>> so
>>>>>>>>>>>
>>>>>>>>>>>> that
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> my ontology save and shows one value at a time.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> --
>>>>>>>>>>> Lorenz Bühmann
>>>>>>>>>>> AKSW group, University of Leipzig
>>>>>>>>>>> Group: http://aksw.org - semantic web research center
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>> Lorenz Bühmann
>>>>>>>>> AKSW group, University of Leipzig
>>>>>>>>> Group: http://aksw.org - semantic web research center
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>> Lorenz Bühmann
>>>>>>> AKSW group, University of Leipzig
>>>>>>> Group: http://aksw.org - semantic web research center
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>> Lorenz Bühmann
>>>>> AKSW group, University of Leipzig
>>>>> Group: http://aksw.org - semantic web research center
>>>>>
>>>>>
>>>>>
>>>
>>>
>>
>
Re: Overwrite data of ontology
Posted by Dave Reynolds <da...@gmail.com>.
On 26/09/16 16:59, kumar rohit wrote:
> I have already tried this:
>
> DatatypeProperty item= model.getDatatypeProperty(ns+"Item");
If the URI ns+"Item" is not already declared as a DatatypeProperty in
your ontology then you'll need model.createDatatypeProperty so as to
side-effect the model to include the declaration of Item.
Dave
> Literal value = model.createTypedLiteral(Some value);
>
> customer.setPropertyValue(item, value);
>
> On Mon, Sep 26, 2016 at 8:22 AM, Lorenz Buehmann <
> buehmann@informatik.uni-leipzig.de> wrote:
>
>> Please try to use the Apache Jena documentations first, most things are
>> pretty much explained there [1]
>>> I am sorry my problem still exists and some values are stored as data
>>> property and some still as "Annotations" though I used the same procedure
>>> for all.
>>>
>>> OntResource res=model.createOntResource(ns+ value); //value come from
>> java
>>> variable
>>>
>>> OntProperty price= model.getOntProperty(ns+"ItemPrice");
>> I don't understand why you still do not use a typed OWL property here,
>> as I said in my previous answer?...
>> OWL has object property and data property, thus, why don't you call
>>
>> model.getDatatypeProperty(ns+"ItemPrice")
>>
>> For object properties the same:
>> model.getObjectProperty(String uri)
>>
>> [1] https://jena.apache.org/documentation/ontology/#ontology-properties
>>> customer.setPropertyValue(price, res);
>>>
>>> On Mon, Sep 26, 2016 at 5:20 AM, Lorenz B. <
>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>
>>>> Yes, in that case it is supposed to be an RDF property, thus not typed
>>>> as expected to be in an OWL ontology.
>>>>> I used OntModel as model to read the ontology but used Property instead
>>>> of
>>>>> OntProperty, is this an issue?
>>>>>
>>>>> On Mon, Sep 26, 2016 at 4:34 AM, Lorenz B. <
>>>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>>>
>>>>>> For Protege it MUST be an OWL data property, otherwise the OWL API
>>>>>> parser will treat it as OWL annotation property. This has to be
>>>>>> explicitly declared in the ontology, the easiest way in Jena would be
>> to
>>>>>> use an OntModel
>>>>>>
>>>>>>> Yes Lorenz sir I have written it to disk but it writes the data in
>> the
>>>>>>> Annotations tab rather than in the data property.
>>>>>>>
>>>>>>> Customer1.setPropertyValue(price, pricevalue);
>>>>>>> Customer1.setPropertyValue(quantity, value);
>>>>>>>
>>>>>>> I want to write as data property values.
>>>>>>>
>>>>>>> On Sun, Sep 25, 2016 at 7:35 AM, Lorenz B. <
>>>>>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>>>>>
>>>>>>>> Ehm, did you write the model to disk? Without seeing any code it's
>>>> like
>>>>>>>> to try a shot in the dark.
>>>>>>>>
>>>>>>>>> Customer1.setPropertyValue(price, pricevalue);
>>>>>>>>> Customer1.setPropertyValue(quantity, value);
>>>>>>>>>
>>>>>>>>> Next time after login as Customer1, previous data has not
>> overwritten
>>>>>> and
>>>>>>>>> the owl file shows me old data also..
>>>>>>>>>
>>>>>>>>> On Sun, Sep 25, 2016 at 4:16 AM, Lorenz B. <
>>>>>>>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>>>>>>>
>>>>>>>>>> Please learn to read the Javadoc [1] if you're programming in
>>>> Java...
>>>>>>>>>> And using an IDE would also help, usually this is able to show you
>>>> the
>>>>>>>>>> arguments and it's expected types.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> [1]
>>>>>>>>>> https://jena.apache.org/documentation/javadoc/jena/
>>>>>>>>>> org/apache/jena/ontology/OntResource.html
>>>>>>>>>>
>>>>>>>>>>> I used this: customer.setPropertyValue(property,
>> pricevariable);
>>>>>>>>>>>
>>>>>>>>>>> property here is property name:Item price and pricevariable is
>> int
>>>>>>>> value
>>>>>>>>>>> but it gives me error of :
>>>>>>>>>>>
>>>>>>>>>>> *int can not be converted to RDF Node*
>>>>>>>>>>>
>>>>>>>>>>> On Sat, Sep 24, 2016 at 8:29 AM, Dave Reynolds <
>>>>>>>>>> dave.e.reynolds@gmail.com>
>>>>>>>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> On 24/09/16 15:37, kumar rohit wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> Thanks Soroka and Dave, but how I can do it dynamically? I used
>>>>>> this
>>>>>>>>>>>>> Property property=model.getProperty(name space+ "Item
>> price");
>>>>>>>>>>>>> and then customer_1.addLiteral(property, Text Field value);
>>>>>>>>>>>>> Now how to remove previously entered values? Any built-in
>>>> methods?
>>>>>>>>>>>> Read my message again, I gave you the name of a method that does
>>>> the
>>>>>>>>>>>> replacement (= remove + add) in one go.
>>>>>>>>>>>>
>>>>>>>>>>>> The javadoc and documentation tutorials will help you find the
>>>> many
>>>>>>>>>> remove
>>>>>>>>>>>> methods that are available.
>>>>>>>>>>>>
>>>>>>>>>>>> Dave
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> On Sat, Sep 24, 2016 at 6:48 AM, A. Soroka <aj...@virginia.edu>
>>>>>>>> wrote:
>>>>>>>>>>>>> Remove the old triple and add a new one with the new value.
>>>>>>>>>>>>>> ---
>>>>>>>>>>>>>> A. Soroka
>>>>>>>>>>>>>> The University of Virginia Library
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On Sep 24, 2016, at 9:33 AM, kumar rohit <
>> kumar.eng84@gmail.com
>>>>>>>>>> wrote:
>>>>>>>>>>>>>>> I want to save item price entered by users in file. Samsung
>>>>>> Galaxy
>>>>>>>>>>>>>> hasPrice
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> ?value.
>>>>>>>>>>>>>>> User enter some value and it is stored in the file. After
>> some
>>>>>>>> time,
>>>>>>>>>>>>>>> another price for same Samsung Galaxy is entered and it is
>>>>>> stored.
>>>>>>>>>> But
>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> problem is that the old price is also there.
>>>>>>>>>>>>>>> How can I overwrite the previous values with recently entered
>>>>>> value
>>>>>>>>>> so
>>>>>>>>>>>>>> that
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> my ontology save and shows one value at a time.
>>>>>>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> Lorenz B�hmann
>>>>>>>>>> AKSW group, University of Leipzig
>>>>>>>>>> Group: http://aksw.org - semantic web research center
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>> --
>>>>>>>> Lorenz B�hmann
>>>>>>>> AKSW group, University of Leipzig
>>>>>>>> Group: http://aksw.org - semantic web research center
>>>>>>>>
>>>>>>>>
>>>>>> --
>>>>>> Lorenz B�hmann
>>>>>> AKSW group, University of Leipzig
>>>>>> Group: http://aksw.org - semantic web research center
>>>>>>
>>>>>>
>>>> --
>>>> Lorenz B�hmann
>>>> AKSW group, University of Leipzig
>>>> Group: http://aksw.org - semantic web research center
>>>>
>>>>
>>
>>
>
Re: Overwrite data of ontology
Posted by kumar rohit <ku...@gmail.com>.
I have already tried this:
DatatypeProperty item= model.getDatatypeProperty(ns+"Item");
Literal value = model.createTypedLiteral(Some value);
customer.setPropertyValue(item, value);
On Mon, Sep 26, 2016 at 8:22 AM, Lorenz Buehmann <
buehmann@informatik.uni-leipzig.de> wrote:
> Please try to use the Apache Jena documentations first, most things are
> pretty much explained there [1]
> > I am sorry my problem still exists and some values are stored as data
> > property and some still as "Annotations" though I used the same procedure
> > for all.
> >
> > OntResource res=model.createOntResource(ns+ value); //value come from
> java
> > variable
> >
> > OntProperty price= model.getOntProperty(ns+"ItemPrice");
> I don't understand why you still do not use a typed OWL property here,
> as I said in my previous answer?...
> OWL has object property and data property, thus, why don't you call
>
> model.getDatatypeProperty(ns+"ItemPrice")
>
> For object properties the same:
> model.getObjectProperty(String uri)
>
> [1] https://jena.apache.org/documentation/ontology/#ontology-properties
> > customer.setPropertyValue(price, res);
> >
> > On Mon, Sep 26, 2016 at 5:20 AM, Lorenz B. <
> > buehmann@informatik.uni-leipzig.de> wrote:
> >
> >> Yes, in that case it is supposed to be an RDF property, thus not typed
> >> as expected to be in an OWL ontology.
> >>> I used OntModel as model to read the ontology but used Property instead
> >> of
> >>> OntProperty, is this an issue?
> >>>
> >>> On Mon, Sep 26, 2016 at 4:34 AM, Lorenz B. <
> >>> buehmann@informatik.uni-leipzig.de> wrote:
> >>>
> >>>> For Protege it MUST be an OWL data property, otherwise the OWL API
> >>>> parser will treat it as OWL annotation property. This has to be
> >>>> explicitly declared in the ontology, the easiest way in Jena would be
> to
> >>>> use an OntModel
> >>>>
> >>>>> Yes Lorenz sir I have written it to disk but it writes the data in
> the
> >>>>> Annotations tab rather than in the data property.
> >>>>>
> >>>>> Customer1.setPropertyValue(price, pricevalue);
> >>>>> Customer1.setPropertyValue(quantity, value);
> >>>>>
> >>>>> I want to write as data property values.
> >>>>>
> >>>>> On Sun, Sep 25, 2016 at 7:35 AM, Lorenz B. <
> >>>>> buehmann@informatik.uni-leipzig.de> wrote:
> >>>>>
> >>>>>> Ehm, did you write the model to disk? Without seeing any code it's
> >> like
> >>>>>> to try a shot in the dark.
> >>>>>>
> >>>>>>> Customer1.setPropertyValue(price, pricevalue);
> >>>>>>> Customer1.setPropertyValue(quantity, value);
> >>>>>>>
> >>>>>>> Next time after login as Customer1, previous data has not
> overwritten
> >>>> and
> >>>>>>> the owl file shows me old data also..
> >>>>>>>
> >>>>>>> On Sun, Sep 25, 2016 at 4:16 AM, Lorenz B. <
> >>>>>>> buehmann@informatik.uni-leipzig.de> wrote:
> >>>>>>>
> >>>>>>>> Please learn to read the Javadoc [1] if you're programming in
> >> Java...
> >>>>>>>> And using an IDE would also help, usually this is able to show you
> >> the
> >>>>>>>> arguments and it's expected types.
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> [1]
> >>>>>>>> https://jena.apache.org/documentation/javadoc/jena/
> >>>>>>>> org/apache/jena/ontology/OntResource.html
> >>>>>>>>
> >>>>>>>>> I used this: customer.setPropertyValue(property,
> pricevariable);
> >>>>>>>>>
> >>>>>>>>> property here is property name:Item price and pricevariable is
> int
> >>>>>> value
> >>>>>>>>> but it gives me error of :
> >>>>>>>>>
> >>>>>>>>> *int can not be converted to RDF Node*
> >>>>>>>>>
> >>>>>>>>> On Sat, Sep 24, 2016 at 8:29 AM, Dave Reynolds <
> >>>>>>>> dave.e.reynolds@gmail.com>
> >>>>>>>>> wrote:
> >>>>>>>>>
> >>>>>>>>>> On 24/09/16 15:37, kumar rohit wrote:
> >>>>>>>>>>
> >>>>>>>>>>> Thanks Soroka and Dave, but how I can do it dynamically? I used
> >>>> this
> >>>>>>>>>>> Property property=model.getProperty(name space+ "Item
> price");
> >>>>>>>>>>> and then customer_1.addLiteral(property, Text Field value);
> >>>>>>>>>>> Now how to remove previously entered values? Any built-in
> >> methods?
> >>>>>>>>>> Read my message again, I gave you the name of a method that does
> >> the
> >>>>>>>>>> replacement (= remove + add) in one go.
> >>>>>>>>>>
> >>>>>>>>>> The javadoc and documentation tutorials will help you find the
> >> many
> >>>>>>>> remove
> >>>>>>>>>> methods that are available.
> >>>>>>>>>>
> >>>>>>>>>> Dave
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>> On Sat, Sep 24, 2016 at 6:48 AM, A. Soroka <aj...@virginia.edu>
> >>>>>> wrote:
> >>>>>>>>>>> Remove the old triple and add a new one with the new value.
> >>>>>>>>>>>> ---
> >>>>>>>>>>>> A. Soroka
> >>>>>>>>>>>> The University of Virginia Library
> >>>>>>>>>>>>
> >>>>>>>>>>>> On Sep 24, 2016, at 9:33 AM, kumar rohit <
> kumar.eng84@gmail.com
> >>>>>>>> wrote:
> >>>>>>>>>>>>> I want to save item price entered by users in file. Samsung
> >>>> Galaxy
> >>>>>>>>>>>> hasPrice
> >>>>>>>>>>>>
> >>>>>>>>>>>>> ?value.
> >>>>>>>>>>>>> User enter some value and it is stored in the file. After
> some
> >>>>>> time,
> >>>>>>>>>>>>> another price for same Samsung Galaxy is entered and it is
> >>>> stored.
> >>>>>>>> But
> >>>>>>>>>>>> the
> >>>>>>>>>>>>
> >>>>>>>>>>>>> problem is that the old price is also there.
> >>>>>>>>>>>>> How can I overwrite the previous values with recently entered
> >>>> value
> >>>>>>>> so
> >>>>>>>>>>>> that
> >>>>>>>>>>>>
> >>>>>>>>>>>>> my ontology save and shows one value at a time.
> >>>>>>>>>>>>>
> >>>>>>>> --
> >>>>>>>> Lorenz Bühmann
> >>>>>>>> AKSW group, University of Leipzig
> >>>>>>>> Group: http://aksw.org - semantic web research center
> >>>>>>>>
> >>>>>>>>
> >>>>>> --
> >>>>>> Lorenz Bühmann
> >>>>>> AKSW group, University of Leipzig
> >>>>>> Group: http://aksw.org - semantic web research center
> >>>>>>
> >>>>>>
> >>>> --
> >>>> Lorenz Bühmann
> >>>> AKSW group, University of Leipzig
> >>>> Group: http://aksw.org - semantic web research center
> >>>>
> >>>>
> >> --
> >> Lorenz Bühmann
> >> AKSW group, University of Leipzig
> >> Group: http://aksw.org - semantic web research center
> >>
> >>
>
>
Re: Overwrite data of ontology
Posted by Lorenz Buehmann <bu...@informatik.uni-leipzig.de>.
Please try to use the Apache Jena documentations first, most things are
pretty much explained there [1]
> I am sorry my problem still exists and some values are stored as data
> property and some still as "Annotations" though I used the same procedure
> for all.
>
> OntResource res=model.createOntResource(ns+ value); //value come from java
> variable
>
> OntProperty price= model.getOntProperty(ns+"ItemPrice");
I don't understand why you still do not use a typed OWL property here,
as I said in my previous answer?...
OWL has object property and data property, thus, why don't you call
model.getDatatypeProperty(ns+"ItemPrice")
For object properties the same:
model.getObjectProperty(String uri)
[1] https://jena.apache.org/documentation/ontology/#ontology-properties
> customer.setPropertyValue(price, res);
>
> On Mon, Sep 26, 2016 at 5:20 AM, Lorenz B. <
> buehmann@informatik.uni-leipzig.de> wrote:
>
>> Yes, in that case it is supposed to be an RDF property, thus not typed
>> as expected to be in an OWL ontology.
>>> I used OntModel as model to read the ontology but used Property instead
>> of
>>> OntProperty, is this an issue?
>>>
>>> On Mon, Sep 26, 2016 at 4:34 AM, Lorenz B. <
>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>
>>>> For Protege it MUST be an OWL data property, otherwise the OWL API
>>>> parser will treat it as OWL annotation property. This has to be
>>>> explicitly declared in the ontology, the easiest way in Jena would be to
>>>> use an OntModel
>>>>
>>>>> Yes Lorenz sir I have written it to disk but it writes the data in the
>>>>> Annotations tab rather than in the data property.
>>>>>
>>>>> Customer1.setPropertyValue(price, pricevalue);
>>>>> Customer1.setPropertyValue(quantity, value);
>>>>>
>>>>> I want to write as data property values.
>>>>>
>>>>> On Sun, Sep 25, 2016 at 7:35 AM, Lorenz B. <
>>>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>>>
>>>>>> Ehm, did you write the model to disk? Without seeing any code it's
>> like
>>>>>> to try a shot in the dark.
>>>>>>
>>>>>>> Customer1.setPropertyValue(price, pricevalue);
>>>>>>> Customer1.setPropertyValue(quantity, value);
>>>>>>>
>>>>>>> Next time after login as Customer1, previous data has not overwritten
>>>> and
>>>>>>> the owl file shows me old data also..
>>>>>>>
>>>>>>> On Sun, Sep 25, 2016 at 4:16 AM, Lorenz B. <
>>>>>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>>>>>
>>>>>>>> Please learn to read the Javadoc [1] if you're programming in
>> Java...
>>>>>>>> And using an IDE would also help, usually this is able to show you
>> the
>>>>>>>> arguments and it's expected types.
>>>>>>>>
>>>>>>>>
>>>>>>>> [1]
>>>>>>>> https://jena.apache.org/documentation/javadoc/jena/
>>>>>>>> org/apache/jena/ontology/OntResource.html
>>>>>>>>
>>>>>>>>> I used this: customer.setPropertyValue(property, pricevariable);
>>>>>>>>>
>>>>>>>>> property here is property name:Item price and pricevariable is int
>>>>>> value
>>>>>>>>> but it gives me error of :
>>>>>>>>>
>>>>>>>>> *int can not be converted to RDF Node*
>>>>>>>>>
>>>>>>>>> On Sat, Sep 24, 2016 at 8:29 AM, Dave Reynolds <
>>>>>>>> dave.e.reynolds@gmail.com>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> On 24/09/16 15:37, kumar rohit wrote:
>>>>>>>>>>
>>>>>>>>>>> Thanks Soroka and Dave, but how I can do it dynamically? I used
>>>> this
>>>>>>>>>>> Property property=model.getProperty(name space+ "Item price");
>>>>>>>>>>> and then customer_1.addLiteral(property, Text Field value);
>>>>>>>>>>> Now how to remove previously entered values? Any built-in
>> methods?
>>>>>>>>>> Read my message again, I gave you the name of a method that does
>> the
>>>>>>>>>> replacement (= remove + add) in one go.
>>>>>>>>>>
>>>>>>>>>> The javadoc and documentation tutorials will help you find the
>> many
>>>>>>>> remove
>>>>>>>>>> methods that are available.
>>>>>>>>>>
>>>>>>>>>> Dave
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Sat, Sep 24, 2016 at 6:48 AM, A. Soroka <aj...@virginia.edu>
>>>>>> wrote:
>>>>>>>>>>> Remove the old triple and add a new one with the new value.
>>>>>>>>>>>> ---
>>>>>>>>>>>> A. Soroka
>>>>>>>>>>>> The University of Virginia Library
>>>>>>>>>>>>
>>>>>>>>>>>> On Sep 24, 2016, at 9:33 AM, kumar rohit <kumar.eng84@gmail.com
>>>>>>>> wrote:
>>>>>>>>>>>>> I want to save item price entered by users in file. Samsung
>>>> Galaxy
>>>>>>>>>>>> hasPrice
>>>>>>>>>>>>
>>>>>>>>>>>>> ?value.
>>>>>>>>>>>>> User enter some value and it is stored in the file. After some
>>>>>> time,
>>>>>>>>>>>>> another price for same Samsung Galaxy is entered and it is
>>>> stored.
>>>>>>>> But
>>>>>>>>>>>> the
>>>>>>>>>>>>
>>>>>>>>>>>>> problem is that the old price is also there.
>>>>>>>>>>>>> How can I overwrite the previous values with recently entered
>>>> value
>>>>>>>> so
>>>>>>>>>>>> that
>>>>>>>>>>>>
>>>>>>>>>>>>> my ontology save and shows one value at a time.
>>>>>>>>>>>>>
>>>>>>>> --
>>>>>>>> Lorenz B�hmann
>>>>>>>> AKSW group, University of Leipzig
>>>>>>>> Group: http://aksw.org - semantic web research center
>>>>>>>>
>>>>>>>>
>>>>>> --
>>>>>> Lorenz B�hmann
>>>>>> AKSW group, University of Leipzig
>>>>>> Group: http://aksw.org - semantic web research center
>>>>>>
>>>>>>
>>>> --
>>>> Lorenz B�hmann
>>>> AKSW group, University of Leipzig
>>>> Group: http://aksw.org - semantic web research center
>>>>
>>>>
>> --
>> Lorenz B�hmann
>> AKSW group, University of Leipzig
>> Group: http://aksw.org - semantic web research center
>>
>>
Re: Overwrite data of ontology
Posted by kumar rohit <ku...@gmail.com>.
I am sorry my problem still exists and some values are stored as data
property and some still as "Annotations" though I used the same procedure
for all.
OntResource res=model.createOntResource(ns+ value); //value come from java
variable
OntProperty price= model.getOntProperty(ns+"ItemPrice");
customer.setPropertyValue(price, res);
On Mon, Sep 26, 2016 at 5:20 AM, Lorenz B. <
buehmann@informatik.uni-leipzig.de> wrote:
> Yes, in that case it is supposed to be an RDF property, thus not typed
> as expected to be in an OWL ontology.
> > I used OntModel as model to read the ontology but used Property instead
> of
> > OntProperty, is this an issue?
> >
> > On Mon, Sep 26, 2016 at 4:34 AM, Lorenz B. <
> > buehmann@informatik.uni-leipzig.de> wrote:
> >
> >> For Protege it MUST be an OWL data property, otherwise the OWL API
> >> parser will treat it as OWL annotation property. This has to be
> >> explicitly declared in the ontology, the easiest way in Jena would be to
> >> use an OntModel
> >>
> >>> Yes Lorenz sir I have written it to disk but it writes the data in the
> >>> Annotations tab rather than in the data property.
> >>>
> >>> Customer1.setPropertyValue(price, pricevalue);
> >>> Customer1.setPropertyValue(quantity, value);
> >>>
> >>> I want to write as data property values.
> >>>
> >>> On Sun, Sep 25, 2016 at 7:35 AM, Lorenz B. <
> >>> buehmann@informatik.uni-leipzig.de> wrote:
> >>>
> >>>> Ehm, did you write the model to disk? Without seeing any code it's
> like
> >>>> to try a shot in the dark.
> >>>>
> >>>>> Customer1.setPropertyValue(price, pricevalue);
> >>>>> Customer1.setPropertyValue(quantity, value);
> >>>>>
> >>>>> Next time after login as Customer1, previous data has not overwritten
> >> and
> >>>>> the owl file shows me old data also..
> >>>>>
> >>>>> On Sun, Sep 25, 2016 at 4:16 AM, Lorenz B. <
> >>>>> buehmann@informatik.uni-leipzig.de> wrote:
> >>>>>
> >>>>>> Please learn to read the Javadoc [1] if you're programming in
> Java...
> >>>>>>
> >>>>>> And using an IDE would also help, usually this is able to show you
> the
> >>>>>> arguments and it's expected types.
> >>>>>>
> >>>>>>
> >>>>>> [1]
> >>>>>> https://jena.apache.org/documentation/javadoc/jena/
> >>>>>> org/apache/jena/ontology/OntResource.html
> >>>>>>
> >>>>>>> I used this: customer.setPropertyValue(property, pricevariable);
> >>>>>>>
> >>>>>>> property here is property name:Item price and pricevariable is int
> >>>> value
> >>>>>>> but it gives me error of :
> >>>>>>>
> >>>>>>> *int can not be converted to RDF Node*
> >>>>>>>
> >>>>>>> On Sat, Sep 24, 2016 at 8:29 AM, Dave Reynolds <
> >>>>>> dave.e.reynolds@gmail.com>
> >>>>>>> wrote:
> >>>>>>>
> >>>>>>>> On 24/09/16 15:37, kumar rohit wrote:
> >>>>>>>>
> >>>>>>>>> Thanks Soroka and Dave, but how I can do it dynamically? I used
> >> this
> >>>>>>>>> Property property=model.getProperty(name space+ "Item price");
> >>>>>>>>> and then customer_1.addLiteral(property, Text Field value);
> >>>>>>>>> Now how to remove previously entered values? Any built-in
> methods?
> >>>>>>>>>
> >>>>>>>> Read my message again, I gave you the name of a method that does
> the
> >>>>>>>> replacement (= remove + add) in one go.
> >>>>>>>>
> >>>>>>>> The javadoc and documentation tutorials will help you find the
> many
> >>>>>> remove
> >>>>>>>> methods that are available.
> >>>>>>>>
> >>>>>>>> Dave
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> On Sat, Sep 24, 2016 at 6:48 AM, A. Soroka <aj...@virginia.edu>
> >>>> wrote:
> >>>>>>>>> Remove the old triple and add a new one with the new value.
> >>>>>>>>>> ---
> >>>>>>>>>> A. Soroka
> >>>>>>>>>> The University of Virginia Library
> >>>>>>>>>>
> >>>>>>>>>> On Sep 24, 2016, at 9:33 AM, kumar rohit <kumar.eng84@gmail.com
> >
> >>>>>> wrote:
> >>>>>>>>>>> I want to save item price entered by users in file. Samsung
> >> Galaxy
> >>>>>>>>>> hasPrice
> >>>>>>>>>>
> >>>>>>>>>>> ?value.
> >>>>>>>>>>> User enter some value and it is stored in the file. After some
> >>>> time,
> >>>>>>>>>>> another price for same Samsung Galaxy is entered and it is
> >> stored.
> >>>>>> But
> >>>>>>>>>> the
> >>>>>>>>>>
> >>>>>>>>>>> problem is that the old price is also there.
> >>>>>>>>>>> How can I overwrite the previous values with recently entered
> >> value
> >>>>>> so
> >>>>>>>>>> that
> >>>>>>>>>>
> >>>>>>>>>>> my ontology save and shows one value at a time.
> >>>>>>>>>>>
> >>>>>> --
> >>>>>> Lorenz Bühmann
> >>>>>> AKSW group, University of Leipzig
> >>>>>> Group: http://aksw.org - semantic web research center
> >>>>>>
> >>>>>>
> >>>> --
> >>>> Lorenz Bühmann
> >>>> AKSW group, University of Leipzig
> >>>> Group: http://aksw.org - semantic web research center
> >>>>
> >>>>
> >> --
> >> Lorenz Bühmann
> >> AKSW group, University of Leipzig
> >> Group: http://aksw.org - semantic web research center
> >>
> >>
> --
> Lorenz Bühmann
> AKSW group, University of Leipzig
> Group: http://aksw.org - semantic web research center
>
>
Re: Overwrite data of ontology
Posted by "Lorenz B." <bu...@informatik.uni-leipzig.de>.
Yes, in that case it is supposed to be an RDF property, thus not typed
as expected to be in an OWL ontology.
> I used OntModel as model to read the ontology but used Property instead of
> OntProperty, is this an issue?
>
> On Mon, Sep 26, 2016 at 4:34 AM, Lorenz B. <
> buehmann@informatik.uni-leipzig.de> wrote:
>
>> For Protege it MUST be an OWL data property, otherwise the OWL API
>> parser will treat it as OWL annotation property. This has to be
>> explicitly declared in the ontology, the easiest way in Jena would be to
>> use an OntModel
>>
>>> Yes Lorenz sir I have written it to disk but it writes the data in the
>>> Annotations tab rather than in the data property.
>>>
>>> Customer1.setPropertyValue(price, pricevalue);
>>> Customer1.setPropertyValue(quantity, value);
>>>
>>> I want to write as data property values.
>>>
>>> On Sun, Sep 25, 2016 at 7:35 AM, Lorenz B. <
>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>
>>>> Ehm, did you write the model to disk? Without seeing any code it's like
>>>> to try a shot in the dark.
>>>>
>>>>> Customer1.setPropertyValue(price, pricevalue);
>>>>> Customer1.setPropertyValue(quantity, value);
>>>>>
>>>>> Next time after login as Customer1, previous data has not overwritten
>> and
>>>>> the owl file shows me old data also..
>>>>>
>>>>> On Sun, Sep 25, 2016 at 4:16 AM, Lorenz B. <
>>>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>>>
>>>>>> Please learn to read the Javadoc [1] if you're programming in Java...
>>>>>>
>>>>>> And using an IDE would also help, usually this is able to show you the
>>>>>> arguments and it's expected types.
>>>>>>
>>>>>>
>>>>>> [1]
>>>>>> https://jena.apache.org/documentation/javadoc/jena/
>>>>>> org/apache/jena/ontology/OntResource.html
>>>>>>
>>>>>>> I used this: customer.setPropertyValue(property, pricevariable);
>>>>>>>
>>>>>>> property here is property name:Item price and pricevariable is int
>>>> value
>>>>>>> but it gives me error of :
>>>>>>>
>>>>>>> *int can not be converted to RDF Node*
>>>>>>>
>>>>>>> On Sat, Sep 24, 2016 at 8:29 AM, Dave Reynolds <
>>>>>> dave.e.reynolds@gmail.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> On 24/09/16 15:37, kumar rohit wrote:
>>>>>>>>
>>>>>>>>> Thanks Soroka and Dave, but how I can do it dynamically? I used
>> this
>>>>>>>>> Property property=model.getProperty(name space+ "Item price");
>>>>>>>>> and then customer_1.addLiteral(property, Text Field value);
>>>>>>>>> Now how to remove previously entered values? Any built-in methods?
>>>>>>>>>
>>>>>>>> Read my message again, I gave you the name of a method that does the
>>>>>>>> replacement (= remove + add) in one go.
>>>>>>>>
>>>>>>>> The javadoc and documentation tutorials will help you find the many
>>>>>> remove
>>>>>>>> methods that are available.
>>>>>>>>
>>>>>>>> Dave
>>>>>>>>
>>>>>>>>
>>>>>>>> On Sat, Sep 24, 2016 at 6:48 AM, A. Soroka <aj...@virginia.edu>
>>>> wrote:
>>>>>>>>> Remove the old triple and add a new one with the new value.
>>>>>>>>>> ---
>>>>>>>>>> A. Soroka
>>>>>>>>>> The University of Virginia Library
>>>>>>>>>>
>>>>>>>>>> On Sep 24, 2016, at 9:33 AM, kumar rohit <ku...@gmail.com>
>>>>>> wrote:
>>>>>>>>>>> I want to save item price entered by users in file. Samsung
>> Galaxy
>>>>>>>>>> hasPrice
>>>>>>>>>>
>>>>>>>>>>> ?value.
>>>>>>>>>>> User enter some value and it is stored in the file. After some
>>>> time,
>>>>>>>>>>> another price for same Samsung Galaxy is entered and it is
>> stored.
>>>>>> But
>>>>>>>>>> the
>>>>>>>>>>
>>>>>>>>>>> problem is that the old price is also there.
>>>>>>>>>>> How can I overwrite the previous values with recently entered
>> value
>>>>>> so
>>>>>>>>>> that
>>>>>>>>>>
>>>>>>>>>>> my ontology save and shows one value at a time.
>>>>>>>>>>>
>>>>>> --
>>>>>> Lorenz B�hmann
>>>>>> AKSW group, University of Leipzig
>>>>>> Group: http://aksw.org - semantic web research center
>>>>>>
>>>>>>
>>>> --
>>>> Lorenz B�hmann
>>>> AKSW group, University of Leipzig
>>>> Group: http://aksw.org - semantic web research center
>>>>
>>>>
>> --
>> Lorenz B�hmann
>> AKSW group, University of Leipzig
>> Group: http://aksw.org - semantic web research center
>>
>>
--
Lorenz B�hmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
Re: Overwrite data of ontology
Posted by kumar rohit <ku...@gmail.com>.
I used OntModel as model to read the ontology but used Property instead of
OntProperty, is this an issue?
On Mon, Sep 26, 2016 at 4:34 AM, Lorenz B. <
buehmann@informatik.uni-leipzig.de> wrote:
> For Protege it MUST be an OWL data property, otherwise the OWL API
> parser will treat it as OWL annotation property. This has to be
> explicitly declared in the ontology, the easiest way in Jena would be to
> use an OntModel
>
> > Yes Lorenz sir I have written it to disk but it writes the data in the
> > Annotations tab rather than in the data property.
> >
> > Customer1.setPropertyValue(price, pricevalue);
> > Customer1.setPropertyValue(quantity, value);
> >
> > I want to write as data property values.
> >
> > On Sun, Sep 25, 2016 at 7:35 AM, Lorenz B. <
> > buehmann@informatik.uni-leipzig.de> wrote:
> >
> >> Ehm, did you write the model to disk? Without seeing any code it's like
> >> to try a shot in the dark.
> >>
> >>> Customer1.setPropertyValue(price, pricevalue);
> >>> Customer1.setPropertyValue(quantity, value);
> >>>
> >>> Next time after login as Customer1, previous data has not overwritten
> and
> >>> the owl file shows me old data also..
> >>>
> >>> On Sun, Sep 25, 2016 at 4:16 AM, Lorenz B. <
> >>> buehmann@informatik.uni-leipzig.de> wrote:
> >>>
> >>>> Please learn to read the Javadoc [1] if you're programming in Java...
> >>>>
> >>>> And using an IDE would also help, usually this is able to show you the
> >>>> arguments and it's expected types.
> >>>>
> >>>>
> >>>> [1]
> >>>> https://jena.apache.org/documentation/javadoc/jena/
> >>>> org/apache/jena/ontology/OntResource.html
> >>>>
> >>>>> I used this: customer.setPropertyValue(property, pricevariable);
> >>>>>
> >>>>> property here is property name:Item price and pricevariable is int
> >> value
> >>>>> but it gives me error of :
> >>>>>
> >>>>> *int can not be converted to RDF Node*
> >>>>>
> >>>>> On Sat, Sep 24, 2016 at 8:29 AM, Dave Reynolds <
> >>>> dave.e.reynolds@gmail.com>
> >>>>> wrote:
> >>>>>
> >>>>>> On 24/09/16 15:37, kumar rohit wrote:
> >>>>>>
> >>>>>>> Thanks Soroka and Dave, but how I can do it dynamically? I used
> this
> >>>>>>>
> >>>>>>> Property property=model.getProperty(name space+ "Item price");
> >>>>>>> and then customer_1.addLiteral(property, Text Field value);
> >>>>>>> Now how to remove previously entered values? Any built-in methods?
> >>>>>>>
> >>>>>> Read my message again, I gave you the name of a method that does the
> >>>>>> replacement (= remove + add) in one go.
> >>>>>>
> >>>>>> The javadoc and documentation tutorials will help you find the many
> >>>> remove
> >>>>>> methods that are available.
> >>>>>>
> >>>>>> Dave
> >>>>>>
> >>>>>>
> >>>>>> On Sat, Sep 24, 2016 at 6:48 AM, A. Soroka <aj...@virginia.edu>
> >> wrote:
> >>>>>>> Remove the old triple and add a new one with the new value.
> >>>>>>>> ---
> >>>>>>>> A. Soroka
> >>>>>>>> The University of Virginia Library
> >>>>>>>>
> >>>>>>>> On Sep 24, 2016, at 9:33 AM, kumar rohit <ku...@gmail.com>
> >>>> wrote:
> >>>>>>>>> I want to save item price entered by users in file. Samsung
> Galaxy
> >>>>>>>>>
> >>>>>>>> hasPrice
> >>>>>>>>
> >>>>>>>>> ?value.
> >>>>>>>>> User enter some value and it is stored in the file. After some
> >> time,
> >>>>>>>>> another price for same Samsung Galaxy is entered and it is
> stored.
> >>>> But
> >>>>>>>> the
> >>>>>>>>
> >>>>>>>>> problem is that the old price is also there.
> >>>>>>>>> How can I overwrite the previous values with recently entered
> value
> >>>> so
> >>>>>>>> that
> >>>>>>>>
> >>>>>>>>> my ontology save and shows one value at a time.
> >>>>>>>>>
> >>>> --
> >>>> Lorenz Bühmann
> >>>> AKSW group, University of Leipzig
> >>>> Group: http://aksw.org - semantic web research center
> >>>>
> >>>>
> >> --
> >> Lorenz Bühmann
> >> AKSW group, University of Leipzig
> >> Group: http://aksw.org - semantic web research center
> >>
> >>
> --
> Lorenz Bühmann
> AKSW group, University of Leipzig
> Group: http://aksw.org - semantic web research center
>
>
Re: Overwrite data of ontology
Posted by "Lorenz B." <bu...@informatik.uni-leipzig.de>.
For Protege it MUST be an OWL data property, otherwise the OWL API
parser will treat it as OWL annotation property. This has to be
explicitly declared in the ontology, the easiest way in Jena would be to
use an OntModel
> Yes Lorenz sir I have written it to disk but it writes the data in the
> Annotations tab rather than in the data property.
>
> Customer1.setPropertyValue(price, pricevalue);
> Customer1.setPropertyValue(quantity, value);
>
> I want to write as data property values.
>
> On Sun, Sep 25, 2016 at 7:35 AM, Lorenz B. <
> buehmann@informatik.uni-leipzig.de> wrote:
>
>> Ehm, did you write the model to disk? Without seeing any code it's like
>> to try a shot in the dark.
>>
>>> Customer1.setPropertyValue(price, pricevalue);
>>> Customer1.setPropertyValue(quantity, value);
>>>
>>> Next time after login as Customer1, previous data has not overwritten and
>>> the owl file shows me old data also..
>>>
>>> On Sun, Sep 25, 2016 at 4:16 AM, Lorenz B. <
>>> buehmann@informatik.uni-leipzig.de> wrote:
>>>
>>>> Please learn to read the Javadoc [1] if you're programming in Java...
>>>>
>>>> And using an IDE would also help, usually this is able to show you the
>>>> arguments and it's expected types.
>>>>
>>>>
>>>> [1]
>>>> https://jena.apache.org/documentation/javadoc/jena/
>>>> org/apache/jena/ontology/OntResource.html
>>>>
>>>>> I used this: customer.setPropertyValue(property, pricevariable);
>>>>>
>>>>> property here is property name:Item price and pricevariable is int
>> value
>>>>> but it gives me error of :
>>>>>
>>>>> *int can not be converted to RDF Node*
>>>>>
>>>>> On Sat, Sep 24, 2016 at 8:29 AM, Dave Reynolds <
>>>> dave.e.reynolds@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> On 24/09/16 15:37, kumar rohit wrote:
>>>>>>
>>>>>>> Thanks Soroka and Dave, but how I can do it dynamically? I used this
>>>>>>>
>>>>>>> Property property=model.getProperty(name space+ "Item price");
>>>>>>> and then customer_1.addLiteral(property, Text Field value);
>>>>>>> Now how to remove previously entered values? Any built-in methods?
>>>>>>>
>>>>>> Read my message again, I gave you the name of a method that does the
>>>>>> replacement (= remove + add) in one go.
>>>>>>
>>>>>> The javadoc and documentation tutorials will help you find the many
>>>> remove
>>>>>> methods that are available.
>>>>>>
>>>>>> Dave
>>>>>>
>>>>>>
>>>>>> On Sat, Sep 24, 2016 at 6:48 AM, A. Soroka <aj...@virginia.edu>
>> wrote:
>>>>>>> Remove the old triple and add a new one with the new value.
>>>>>>>> ---
>>>>>>>> A. Soroka
>>>>>>>> The University of Virginia Library
>>>>>>>>
>>>>>>>> On Sep 24, 2016, at 9:33 AM, kumar rohit <ku...@gmail.com>
>>>> wrote:
>>>>>>>>> I want to save item price entered by users in file. Samsung Galaxy
>>>>>>>>>
>>>>>>>> hasPrice
>>>>>>>>
>>>>>>>>> ?value.
>>>>>>>>> User enter some value and it is stored in the file. After some
>> time,
>>>>>>>>> another price for same Samsung Galaxy is entered and it is stored.
>>>> But
>>>>>>>> the
>>>>>>>>
>>>>>>>>> problem is that the old price is also there.
>>>>>>>>> How can I overwrite the previous values with recently entered value
>>>> so
>>>>>>>> that
>>>>>>>>
>>>>>>>>> my ontology save and shows one value at a time.
>>>>>>>>>
>>>> --
>>>> Lorenz B�hmann
>>>> AKSW group, University of Leipzig
>>>> Group: http://aksw.org - semantic web research center
>>>>
>>>>
>> --
>> Lorenz B�hmann
>> AKSW group, University of Leipzig
>> Group: http://aksw.org - semantic web research center
>>
>>
--
Lorenz B�hmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
Re: Overwrite data of ontology
Posted by kumar rohit <ku...@gmail.com>.
Yes Lorenz sir I have written it to disk but it writes the data in the
Annotations tab rather than in the data property.
Customer1.setPropertyValue(price, pricevalue);
Customer1.setPropertyValue(quantity, value);
I want to write as data property values.
On Sun, Sep 25, 2016 at 7:35 AM, Lorenz B. <
buehmann@informatik.uni-leipzig.de> wrote:
> Ehm, did you write the model to disk? Without seeing any code it's like
> to try a shot in the dark.
>
> > Customer1.setPropertyValue(price, pricevalue);
> > Customer1.setPropertyValue(quantity, value);
> >
> > Next time after login as Customer1, previous data has not overwritten and
> > the owl file shows me old data also..
> >
> > On Sun, Sep 25, 2016 at 4:16 AM, Lorenz B. <
> > buehmann@informatik.uni-leipzig.de> wrote:
> >
> >> Please learn to read the Javadoc [1] if you're programming in Java...
> >>
> >> And using an IDE would also help, usually this is able to show you the
> >> arguments and it's expected types.
> >>
> >>
> >> [1]
> >> https://jena.apache.org/documentation/javadoc/jena/
> >> org/apache/jena/ontology/OntResource.html
> >>
> >>> I used this: customer.setPropertyValue(property, pricevariable);
> >>>
> >>> property here is property name:Item price and pricevariable is int
> value
> >>> but it gives me error of :
> >>>
> >>> *int can not be converted to RDF Node*
> >>>
> >>> On Sat, Sep 24, 2016 at 8:29 AM, Dave Reynolds <
> >> dave.e.reynolds@gmail.com>
> >>> wrote:
> >>>
> >>>> On 24/09/16 15:37, kumar rohit wrote:
> >>>>
> >>>>> Thanks Soroka and Dave, but how I can do it dynamically? I used this
> >>>>>
> >>>>> Property property=model.getProperty(name space+ "Item price");
> >>>>> and then customer_1.addLiteral(property, Text Field value);
> >>>>> Now how to remove previously entered values? Any built-in methods?
> >>>>>
> >>>> Read my message again, I gave you the name of a method that does the
> >>>> replacement (= remove + add) in one go.
> >>>>
> >>>> The javadoc and documentation tutorials will help you find the many
> >> remove
> >>>> methods that are available.
> >>>>
> >>>> Dave
> >>>>
> >>>>
> >>>> On Sat, Sep 24, 2016 at 6:48 AM, A. Soroka <aj...@virginia.edu>
> wrote:
> >>>>> Remove the old triple and add a new one with the new value.
> >>>>>> ---
> >>>>>> A. Soroka
> >>>>>> The University of Virginia Library
> >>>>>>
> >>>>>> On Sep 24, 2016, at 9:33 AM, kumar rohit <ku...@gmail.com>
> >> wrote:
> >>>>>>> I want to save item price entered by users in file. Samsung Galaxy
> >>>>>>>
> >>>>>> hasPrice
> >>>>>>
> >>>>>>> ?value.
> >>>>>>> User enter some value and it is stored in the file. After some
> time,
> >>>>>>> another price for same Samsung Galaxy is entered and it is stored.
> >> But
> >>>>>> the
> >>>>>>
> >>>>>>> problem is that the old price is also there.
> >>>>>>> How can I overwrite the previous values with recently entered value
> >> so
> >>>>>> that
> >>>>>>
> >>>>>>> my ontology save and shows one value at a time.
> >>>>>>>
> >>>>>>
> >> --
> >> Lorenz Bühmann
> >> AKSW group, University of Leipzig
> >> Group: http://aksw.org - semantic web research center
> >>
> >>
> --
> Lorenz Bühmann
> AKSW group, University of Leipzig
> Group: http://aksw.org - semantic web research center
>
>
Re: Overwrite data of ontology
Posted by "Lorenz B." <bu...@informatik.uni-leipzig.de>.
Ehm, did you write the model to disk? Without seeing any code it's like
to try a shot in the dark.
> Customer1.setPropertyValue(price, pricevalue);
> Customer1.setPropertyValue(quantity, value);
>
> Next time after login as Customer1, previous data has not overwritten and
> the owl file shows me old data also..
>
> On Sun, Sep 25, 2016 at 4:16 AM, Lorenz B. <
> buehmann@informatik.uni-leipzig.de> wrote:
>
>> Please learn to read the Javadoc [1] if you're programming in Java...
>>
>> And using an IDE would also help, usually this is able to show you the
>> arguments and it's expected types.
>>
>>
>> [1]
>> https://jena.apache.org/documentation/javadoc/jena/
>> org/apache/jena/ontology/OntResource.html
>>
>>> I used this: customer.setPropertyValue(property, pricevariable);
>>>
>>> property here is property name:Item price and pricevariable is int value
>>> but it gives me error of :
>>>
>>> *int can not be converted to RDF Node*
>>>
>>> On Sat, Sep 24, 2016 at 8:29 AM, Dave Reynolds <
>> dave.e.reynolds@gmail.com>
>>> wrote:
>>>
>>>> On 24/09/16 15:37, kumar rohit wrote:
>>>>
>>>>> Thanks Soroka and Dave, but how I can do it dynamically? I used this
>>>>>
>>>>> Property property=model.getProperty(name space+ "Item price");
>>>>> and then customer_1.addLiteral(property, Text Field value);
>>>>> Now how to remove previously entered values? Any built-in methods?
>>>>>
>>>> Read my message again, I gave you the name of a method that does the
>>>> replacement (= remove + add) in one go.
>>>>
>>>> The javadoc and documentation tutorials will help you find the many
>> remove
>>>> methods that are available.
>>>>
>>>> Dave
>>>>
>>>>
>>>> On Sat, Sep 24, 2016 at 6:48 AM, A. Soroka <aj...@virginia.edu> wrote:
>>>>> Remove the old triple and add a new one with the new value.
>>>>>> ---
>>>>>> A. Soroka
>>>>>> The University of Virginia Library
>>>>>>
>>>>>> On Sep 24, 2016, at 9:33 AM, kumar rohit <ku...@gmail.com>
>> wrote:
>>>>>>> I want to save item price entered by users in file. Samsung Galaxy
>>>>>>>
>>>>>> hasPrice
>>>>>>
>>>>>>> ?value.
>>>>>>> User enter some value and it is stored in the file. After some time,
>>>>>>> another price for same Samsung Galaxy is entered and it is stored.
>> But
>>>>>> the
>>>>>>
>>>>>>> problem is that the old price is also there.
>>>>>>> How can I overwrite the previous values with recently entered value
>> so
>>>>>> that
>>>>>>
>>>>>>> my ontology save and shows one value at a time.
>>>>>>>
>>>>>>
>> --
>> Lorenz B�hmann
>> AKSW group, University of Leipzig
>> Group: http://aksw.org - semantic web research center
>>
>>
--
Lorenz B�hmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
Re: Overwrite data of ontology
Posted by kumar rohit <ku...@gmail.com>.
Customer1.setPropertyValue(price, pricevalue);
Customer1.setPropertyValue(quantity, value);
Next time after login as Customer1, previous data has not overwritten and
the owl file shows me old data also..
On Sun, Sep 25, 2016 at 4:16 AM, Lorenz B. <
buehmann@informatik.uni-leipzig.de> wrote:
> Please learn to read the Javadoc [1] if you're programming in Java...
>
> And using an IDE would also help, usually this is able to show you the
> arguments and it's expected types.
>
>
> [1]
> https://jena.apache.org/documentation/javadoc/jena/
> org/apache/jena/ontology/OntResource.html
>
> > I used this: customer.setPropertyValue(property, pricevariable);
> >
> > property here is property name:Item price and pricevariable is int value
> > but it gives me error of :
> >
> > *int can not be converted to RDF Node*
> >
> > On Sat, Sep 24, 2016 at 8:29 AM, Dave Reynolds <
> dave.e.reynolds@gmail.com>
> > wrote:
> >
> >> On 24/09/16 15:37, kumar rohit wrote:
> >>
> >>> Thanks Soroka and Dave, but how I can do it dynamically? I used this
> >>>
> >>> Property property=model.getProperty(name space+ "Item price");
> >>> and then customer_1.addLiteral(property, Text Field value);
> >>> Now how to remove previously entered values? Any built-in methods?
> >>>
> >> Read my message again, I gave you the name of a method that does the
> >> replacement (= remove + add) in one go.
> >>
> >> The javadoc and documentation tutorials will help you find the many
> remove
> >> methods that are available.
> >>
> >> Dave
> >>
> >>
> >> On Sat, Sep 24, 2016 at 6:48 AM, A. Soroka <aj...@virginia.edu> wrote:
> >>> Remove the old triple and add a new one with the new value.
> >>>> ---
> >>>> A. Soroka
> >>>> The University of Virginia Library
> >>>>
> >>>> On Sep 24, 2016, at 9:33 AM, kumar rohit <ku...@gmail.com>
> wrote:
> >>>>> I want to save item price entered by users in file. Samsung Galaxy
> >>>>>
> >>>> hasPrice
> >>>>
> >>>>> ?value.
> >>>>> User enter some value and it is stored in the file. After some time,
> >>>>> another price for same Samsung Galaxy is entered and it is stored.
> But
> >>>>>
> >>>> the
> >>>>
> >>>>> problem is that the old price is also there.
> >>>>> How can I overwrite the previous values with recently entered value
> so
> >>>>>
> >>>> that
> >>>>
> >>>>> my ontology save and shows one value at a time.
> >>>>>
> >>>>
> >>>>
> --
> Lorenz Bühmann
> AKSW group, University of Leipzig
> Group: http://aksw.org - semantic web research center
>
>
Re: Overwrite data of ontology
Posted by "Lorenz B." <bu...@informatik.uni-leipzig.de>.
Please learn to read the Javadoc [1] if you're programming in Java...
And using an IDE would also help, usually this is able to show you the
arguments and it's expected types.
[1]
https://jena.apache.org/documentation/javadoc/jena/org/apache/jena/ontology/OntResource.html
> I used this: customer.setPropertyValue(property, pricevariable);
>
> property here is property name:Item price and pricevariable is int value
> but it gives me error of :
>
> *int can not be converted to RDF Node*
>
> On Sat, Sep 24, 2016 at 8:29 AM, Dave Reynolds <da...@gmail.com>
> wrote:
>
>> On 24/09/16 15:37, kumar rohit wrote:
>>
>>> Thanks Soroka and Dave, but how I can do it dynamically? I used this
>>>
>>> Property property=model.getProperty(name space+ "Item price");
>>> and then customer_1.addLiteral(property, Text Field value);
>>> Now how to remove previously entered values? Any built-in methods?
>>>
>> Read my message again, I gave you the name of a method that does the
>> replacement (= remove + add) in one go.
>>
>> The javadoc and documentation tutorials will help you find the many remove
>> methods that are available.
>>
>> Dave
>>
>>
>> On Sat, Sep 24, 2016 at 6:48 AM, A. Soroka <aj...@virginia.edu> wrote:
>>> Remove the old triple and add a new one with the new value.
>>>> ---
>>>> A. Soroka
>>>> The University of Virginia Library
>>>>
>>>> On Sep 24, 2016, at 9:33 AM, kumar rohit <ku...@gmail.com> wrote:
>>>>> I want to save item price entered by users in file. Samsung Galaxy
>>>>>
>>>> hasPrice
>>>>
>>>>> ?value.
>>>>> User enter some value and it is stored in the file. After some time,
>>>>> another price for same Samsung Galaxy is entered and it is stored. But
>>>>>
>>>> the
>>>>
>>>>> problem is that the old price is also there.
>>>>> How can I overwrite the previous values with recently entered value so
>>>>>
>>>> that
>>>>
>>>>> my ontology save and shows one value at a time.
>>>>>
>>>>
>>>>
--
Lorenz B�hmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
Re: Overwrite data of ontology
Posted by kumar rohit <ku...@gmail.com>.
I used this: customer.setPropertyValue(property, pricevariable);
property here is property name:Item price and pricevariable is int value
but it gives me error of :
*int can not be converted to RDF Node*
On Sat, Sep 24, 2016 at 8:29 AM, Dave Reynolds <da...@gmail.com>
wrote:
> On 24/09/16 15:37, kumar rohit wrote:
>
>> Thanks Soroka and Dave, but how I can do it dynamically? I used this
>>
>> Property property=model.getProperty(name space+ "Item price");
>> and then customer_1.addLiteral(property, Text Field value);
>> Now how to remove previously entered values? Any built-in methods?
>>
>
> Read my message again, I gave you the name of a method that does the
> replacement (= remove + add) in one go.
>
> The javadoc and documentation tutorials will help you find the many remove
> methods that are available.
>
> Dave
>
>
> On Sat, Sep 24, 2016 at 6:48 AM, A. Soroka <aj...@virginia.edu> wrote:
>>
>> Remove the old triple and add a new one with the new value.
>>>
>>> ---
>>> A. Soroka
>>> The University of Virginia Library
>>>
>>> On Sep 24, 2016, at 9:33 AM, kumar rohit <ku...@gmail.com> wrote:
>>>>
>>>> I want to save item price entered by users in file. Samsung Galaxy
>>>>
>>> hasPrice
>>>
>>>> ?value.
>>>> User enter some value and it is stored in the file. After some time,
>>>> another price for same Samsung Galaxy is entered and it is stored. But
>>>>
>>> the
>>>
>>>> problem is that the old price is also there.
>>>> How can I overwrite the previous values with recently entered value so
>>>>
>>> that
>>>
>>>> my ontology save and shows one value at a time.
>>>>
>>>
>>>
>>>
>>
>
Re: Overwrite data of ontology
Posted by Dave Reynolds <da...@gmail.com>.
On 24/09/16 15:37, kumar rohit wrote:
> Thanks Soroka and Dave, but how I can do it dynamically? I used this
>
> Property property=model.getProperty(name space+ "Item price");
> and then customer_1.addLiteral(property, Text Field value);
> Now how to remove previously entered values? Any built-in methods?
Read my message again, I gave you the name of a method that does the
replacement (= remove + add) in one go.
The javadoc and documentation tutorials will help you find the many
remove methods that are available.
Dave
> On Sat, Sep 24, 2016 at 6:48 AM, A. Soroka <aj...@virginia.edu> wrote:
>
>> Remove the old triple and add a new one with the new value.
>>
>> ---
>> A. Soroka
>> The University of Virginia Library
>>
>>> On Sep 24, 2016, at 9:33 AM, kumar rohit <ku...@gmail.com> wrote:
>>>
>>> I want to save item price entered by users in file. Samsung Galaxy
>> hasPrice
>>> ?value.
>>> User enter some value and it is stored in the file. After some time,
>>> another price for same Samsung Galaxy is entered and it is stored. But
>> the
>>> problem is that the old price is also there.
>>> How can I overwrite the previous values with recently entered value so
>> that
>>> my ontology save and shows one value at a time.
>>
>>
>
Re: Overwrite data of ontology
Posted by kumar rohit <ku...@gmail.com>.
Thanks Soroka and Dave, but how I can do it dynamically? I used this
Property property=model.getProperty(name space+ "Item price");
and then customer_1.addLiteral(property, Text Field value);
Now how to remove previously entered values? Any built-in methods?
On Sat, Sep 24, 2016 at 6:48 AM, A. Soroka <aj...@virginia.edu> wrote:
> Remove the old triple and add a new one with the new value.
>
> ---
> A. Soroka
> The University of Virginia Library
>
> > On Sep 24, 2016, at 9:33 AM, kumar rohit <ku...@gmail.com> wrote:
> >
> > I want to save item price entered by users in file. Samsung Galaxy
> hasPrice
> > ?value.
> > User enter some value and it is stored in the file. After some time,
> > another price for same Samsung Galaxy is entered and it is stored. But
> the
> > problem is that the old price is also there.
> > How can I overwrite the previous values with recently entered value so
> that
> > my ontology save and shows one value at a time.
>
>
Re: Overwrite data of ontology
Posted by "A. Soroka" <aj...@virginia.edu>.
Remove the old triple and add a new one with the new value.
---
A. Soroka
The University of Virginia Library
> On Sep 24, 2016, at 9:33 AM, kumar rohit <ku...@gmail.com> wrote:
>
> I want to save item price entered by users in file. Samsung Galaxy hasPrice
> ?value.
> User enter some value and it is stored in the file. After some time,
> another price for same Samsung Galaxy is entered and it is stored. But the
> problem is that the old price is also there.
> How can I overwrite the previous values with recently entered value so that
> my ontology save and shows one value at a time.