naming conventions for properties, is and has verbs versus nouns (resulting in getters in java)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

naming conventions for properties, is and has verbs versus nouns (resulting in getters in java)

Nikolaj Berntsen

I have been programming java for many years and I very much like simple
java objects with getters and setters for properties, i.e.

class Foo {
   private Object bar;
   public Object getBar();
   public void setBar(Object bar);
}

My latest project has an OWL ontology as basis for its domain model (but
there is nothing owl specific to this question I think). Reading up on
ontologies and rdf there seem to consensus on naming properties prefixed
with 'is' or 'has' (at least in a majority of cases), e.g. the class Foo
would have a property 'hasBar' to my understanding. In my java world I
would only use 'is' for boolean properties. I have not seen 'has'
around, but it sounds like a boolean getter too, in my years.

Since I generate java classes from my owl file (using jastor which I had
most luck with), I have observed that if I use nouns for properties,
e.g., 'bar' or 'title' (as does dublin core), I get the java classes I
am used to, with properly named getters and setters.

It appears to me that there is a clash between two naming conventions
here, but I fail to see a way to reconcile nicely.

Anyone with more semantic web experience that could illuminate me on
this observation?

Cheers,
/\/ikolaj

-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html