You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by DHOMAS HATTA FUDHOLI <df...@students.latrobe.edu.au> on 2012/07/16 03:48:51 UTC

Rename Properties in Jena API?

Hi All,

Is there any method in Jena API to rename ObjectProperty or DatatypeProperty?

I could find only the way to rename Resource, maybe Class, using renameResource() method in ResourceUtils class.

Thanks in advance for any advise.

regards,
Dhomas Hatta Fudholi

Re: Rename Properties in Jena API?

Posted by Dave Reynolds <da...@gmail.com>.
On 16/07/12 02:48, DHOMAS HATTA FUDHOLI wrote:
> Hi All,
>
> Is there any method in Jena API to rename ObjectProperty or DatatypeProperty?
>
> I could find only the way to rename Resource, maybe Class, using renameResource() method in ResourceUtils class.

There's nothing built-in, you would have to write it. It's pretty 
straightforward. The code in ResourceUtils might give helpful hints.

Dave

RE: Rename Properties in Jena API?

Posted by DHOMAS HATTA FUDHOLI <df...@students.latrobe.edu.au>.
Thanks All, all comments is appreciated.

regards,
Dhomas Hatta Fudholi

________________________________________
From: Stefan Scheffler [sscheffler@avantgarde-labs.de]
Sent: Monday, July 16, 2012 7:13 PM
To: users@jena.apache.org
Subject: Re: Rename Properties in Jena API?

On 16.07.2012 09:52, Dave Reynolds wrote:
> On 16/07/12 08:45, Ian Dickinson wrote:
>> Hi Dhomas,
>> On 16/07/12 02:48, DHOMAS HATTA FUDHOLI wrote:
>>> Hi All,
>>>
>>> Is there any method in Jena API to rename ObjectProperty or
>>> DatatypeProperty?
>>>
>>> I could find only the way to rename Resource, maybe Class, using
>>> renameResource() method in ResourceUtils class.
>>>
>>> Thanks in advance for any advise.
>> If you look at the Java class hierarchy, all of the ObjectProperty,
>> DatatypeProperty, OntClass, etc are also subclasses of Resource. This
>> conforms to the RDF semantics, in which a property is a special kind of
>> resource which plays a particular role in the RDF graph. So in summary:
>> use renameResource() to rename any kind of resource in a Jena model,
>> including an ObjectProperty.
>
> I don't think, so the code for renameResource does not rename usages
> in the predicate position. Unless that's changed recently (my local
> copy is out of date).
>
> Dave
Hi Thomas.
I think it is very difficult to rename resources and especially
properties in a rdf-graph, because if you do this you have to refresh
all entities within the store. One simple way would be to run over all
resources, delete the statement with the old property and add a new
statement with the new property. But on large complex graphs, this will
be very slow. Maybe it is an alternative to change the property and
reload the data.

Greetings
Stefan

--
Stefan Scheffler
Avantgarde Labs GmbH
Löbauer Straße 19, 01099 Dresden
Telefon: + 49 (0) 351 21590834
Email: sscheffler@avantgarde-labs.de


Re: Rename Properties in Jena API?

Posted by Stefan Scheffler <ss...@avantgarde-labs.de>.
On 16.07.2012 09:52, Dave Reynolds wrote:
> On 16/07/12 08:45, Ian Dickinson wrote:
>> Hi Dhomas,
>> On 16/07/12 02:48, DHOMAS HATTA FUDHOLI wrote:
>>> Hi All,
>>>
>>> Is there any method in Jena API to rename ObjectProperty or
>>> DatatypeProperty?
>>>
>>> I could find only the way to rename Resource, maybe Class, using
>>> renameResource() method in ResourceUtils class.
>>>
>>> Thanks in advance for any advise.
>> If you look at the Java class hierarchy, all of the ObjectProperty,
>> DatatypeProperty, OntClass, etc are also subclasses of Resource. This
>> conforms to the RDF semantics, in which a property is a special kind of
>> resource which plays a particular role in the RDF graph. So in summary:
>> use renameResource() to rename any kind of resource in a Jena model,
>> including an ObjectProperty.
>
> I don't think, so the code for renameResource does not rename usages 
> in the predicate position. Unless that's changed recently (my local 
> copy is out of date).
>
> Dave
Hi Thomas.
I think it is very difficult to rename resources and especially 
properties in a rdf-graph, because if you do this you have to refresh 
all entities within the store. One simple way would be to run over all 
resources, delete the statement with the old property and add a new 
statement with the new property. But on large complex graphs, this will 
be very slow. Maybe it is an alternative to change the property and 
reload the data.

Greetings
Stefan

-- 
Stefan Scheffler
Avantgarde Labs GmbH
Löbauer Straße 19, 01099 Dresden
Telefon: + 49 (0) 351 21590834
Email: sscheffler@avantgarde-labs.de


Re: Rename Properties in Jena API?

Posted by Ian Dickinson <ia...@epimorphics.com>.
On 16/07/12 08:52, Dave Reynolds wrote:
> On 16/07/12 08:45, Ian Dickinson wrote:
>> Hi Dhomas,
>> On 16/07/12 02:48, DHOMAS HATTA FUDHOLI wrote:
>>> Hi All,
>>>
>>> Is there any method in Jena API to rename ObjectProperty or
>>> DatatypeProperty?
>>>
>>> I could find only the way to rename Resource, maybe Class, using
>>> renameResource() method in ResourceUtils class.
>>>
>>> Thanks in advance for any advise.
>> If you look at the Java class hierarchy, all of the ObjectProperty,
>> DatatypeProperty, OntClass, etc are also subclasses of Resource. This
>> conforms to the RDF semantics, in which a property is a special kind of
>> resource which plays a particular role in the RDF graph. So in summary:
>> use renameResource() to rename any kind of resource in a Jena model,
>> including an ObjectProperty.
>
> I don't think, so the code for renameResource does not rename usages in
> the predicate position. Unless that's changed recently (my local copy is
> out of date).
Yes, that's true - if renaming a property includes updating any existing 
triples with that property as predicate, then renameResource will not do 
that. I guess I was thinking of that as a separate requirement, but I 
can see that it would be reasonable for a property renamer to update 
existing triples.

Ian


Re: Rename Properties in Jena API?

Posted by Dave Reynolds <da...@gmail.com>.
On 16/07/12 08:45, Ian Dickinson wrote:
> Hi Dhomas,
> On 16/07/12 02:48, DHOMAS HATTA FUDHOLI wrote:
>> Hi All,
>>
>> Is there any method in Jena API to rename ObjectProperty or
>> DatatypeProperty?
>>
>> I could find only the way to rename Resource, maybe Class, using
>> renameResource() method in ResourceUtils class.
>>
>> Thanks in advance for any advise.
> If you look at the Java class hierarchy, all of the ObjectProperty,
> DatatypeProperty, OntClass, etc are also subclasses of Resource. This
> conforms to the RDF semantics, in which a property is a special kind of
> resource which plays a particular role in the RDF graph. So in summary:
> use renameResource() to rename any kind of resource in a Jena model,
> including an ObjectProperty.

I don't think, so the code for renameResource does not rename usages in 
the predicate position. Unless that's changed recently (my local copy is 
out of date).

Dave

Re: Rename Properties in Jena API?

Posted by Ian Dickinson <ia...@epimorphics.com>.
Hi Dhomas,
On 16/07/12 02:48, DHOMAS HATTA FUDHOLI wrote:
> Hi All,
>
> Is there any method in Jena API to rename ObjectProperty or
> DatatypeProperty?
>
> I could find only the way to rename Resource, maybe Class, using
> renameResource() method in ResourceUtils class.
>
> Thanks in advance for any advise.
If you look at the Java class hierarchy, all of the ObjectProperty, 
DatatypeProperty, OntClass, etc are also subclasses of Resource. This 
conforms to the RDF semantics, in which a property is a special kind of 
resource which plays a particular role in the RDF graph. So in summary: 
use renameResource() to rename any kind of resource in a Jena model, 
including an ObjectProperty.

Ian