Re: java annotations & the semantic web

On 26 Aug 2005, at 10:34, Danny Ayers wrote:
> Hi Henry,
>
> Looks promising, the idea of leveraging Java annotations to improve
> the mapping is neat.

Thanks. I hope by presenting it this way I can help the 4 million  
java programmers
get an initial grasp on the Semantic Web in something close to 10  
minutes. Ok. So
perhaps only 5% of those currently have a good grasp of annotations  
(just guessing).
But that would be a good starting point. In any case a set of  
standards could be
developed along these lines it should greatly increase the usage of  
RDF. And of course
that would greatly increase the availability of tools (you don't  
think I am doing
this for purely non selfish reasons, now do you? ;-)

> One wording adjustment I'd make (on your blog):
> "It reduces everything to named triples..." - the triples aren't  
> named.

yes, there are anonymous nodes too. I'll fix that.

> What I'd like to see explained more is you're squaring the circle in a
> couple of places: between object's set/get and RDF's kind of
> append-only open worldiness - e.g. what if the value you're getting
> doesn't have a known value in your graph?

That is a good question. My current framework returns null when the  
value is
not set. But I am completely open to suggestions on this. The  
getAllXXX method
returns an empty Collection if there are no values set.

There is another policy type decision that one may want to make,  
namely if one
wants to allow setXXX methods to set something more than once  
(inevitably
overwriting  thereby the old value). To sort out these types of  
questions I think
I need a community of developers working on this. These questions  
should sort
themselves out over time.

I can imagine Martin Fowler would be the type of person to have some
  good things to say on this.


> Also what about the difference in class semantics, e.g. how would you
> express this:
>
> X rdfs:subClassOf Y
> Y rdfs:subClassOf X
> =>
> X owl:equivalentClass Y
> but *not*
> X owl:sameAs Y

Now you are going into real advanced details :-) Reading the spec

<http://www.w3.org/TR/2004/REC-owl-guide-20040210/#owl_equivalentClass>

I understand that this is a distinction between what can be said in  
OWL DL and OWL Full.
owl:sameAs is saying what in philosophy I believe we used to call  
intensional equivalence,
ie  we are taking meaning into account. (or something along those  
lines). owl:equivalentClass
is extensional identity.

It may be that in the Java world we don't need the full power of OWL  
Full, it may be
that a good solid subset may do the trick.

One could I suppose have an annotation @owlEquivalentClass("http:// 
example.org/tea")
to express this and an @owlSameAs("http://example.org/tee"). What the  
engine using these
annotations would make of this distinction I am not sure.

Btw. There is one type of thing that I cannot think of an easy way to  
use annotations
with, and that is my combined inverse functional properties.

class Person {

    String firstName;
    String lastName;

    @functional dateOfBirth;

}


I would like firstName and lastName combined to be an inverse  
functional property. (speaking
in an imaginary world where no two people have the same first and  
last name).

Perhaps one has to do it like this:

class Person {
     String names = new String[2];

     @functional String getFirstName() { return names[0]; }
     @functional String getLastName() { return names[1]; }

     @functional dateOfBirth;

     @inverseFunctional List getNames() { return names; }
}

((from a hint by timbl on irc, as to how he dealt with this in N3 ))

But there is something here that the annotation fails to capture it  
seems and that
is the relation between firstName, lastName and names. The relation  
is in the code here,
not the annotations.

There are of course a lot of other interesting problems. One of the  
most intriguing things
is how to get identity to work correctly and nicely with Java. As  
data is added to the
database two objects that previously may not have been thought the  
sameAs each other, may
suddenly become so. How would this affect hash tables? This is a  
problem if one works with
the RDF Java Beans sitting on top of an inferencing database, which  
would be pretty
interesting.

Henry

> Cheers,
> Danny.
>
> On 8/25/05, Henry Story <Henry.Story@sun.com> wrote:
>
>>
>> I have posted this now on my Sun blog at:
>>
>> http://blogs.sun.com/roller/page/bblfish/
>>
>> with some of improvements suggested by your feedback.  I'll keep
>> working on this.
>>
>>
>>      Henry Story
>>
>>
>> On 25 Aug 2005, at 11:24, Kirkham, Pete (UK) wrote:
>>
>>
>>>
>>> In terms of representing intensional classes, yes. But such
> [snip]

Received on Friday, 26 August 2005 12:23:26 UTC