Vocabulary base class / interface etc #3188
Replies: 6 comments
-
We have had several attempts to create some abstract class or interface for vocabularies in the past, including a design using enums, but they all had various downsides and were never really adopted (see a.o. https://openrdf.atlassian.net/browse/SES-1850). One problem is that static constants and inheritance don't really mix well, so you often end up with an abstract class that gives a template, but then every concrete vocabulary just reimplements/hides the whole lot again to make it work. That being said, happy to discuss a fresh design attempt. Perhaps more modern Java techniques open up new options. |
Beta Was this translation helpful? Give feedback.
-
As for a tool to generate Java classes from OWL: I assume you are "merely" talking about creating vocabulary constants here, and not about some sort of OO mapper? |
Beta Was this translation helpful? Give feedback.
-
If we are introducing new packages I think we should consider also moving away from the ALL_CAPS naming scheme. So we can have RDF.type and RDF.Property. I don't think we should go as far as to lowercase the class names, e.g rdf.type. |
Beta Was this translation helpful? Give feedback.
-
Correct, just creating a Java class (using a template engine or just string concatenation) with final static URIs for properties and classes, not an OO mapper |
Beta Was this translation helpful? Give feedback.
-
It would help for vocabularies that have similar named properties and classes (which is a questionable practice IMHO), e.g. DCAT with dcat:dataset (property) and dcat:Dataset (class). Currently we have to use something like HAS_DATASET and DATASET to avoid name clashes...
Indeed, that would look a bit... weird ... |
Beta Was this translation helpful? Give feedback.
-
The vocabulary generator could (also) be part of the Console tool |
Beta Was this translation helpful? Give feedback.
-
Maybe over-engineering / over-thinking this a bit:
Beta Was this translation helpful? Give feedback.
All reactions