|
Situation: I define a class, and instances of this class are likely to have a title. I want to say that, - when giving a title to an instance of this class, one should use dc:title - when searching for instances of this class by title, one will get good results using dc:title Some ideas: - I can add a dc:comment to the class, but that's not machine understandable - I can create a myTitle property, with range MyClass, and make it a subProperty of dc:title. But this requires some work when handling the queries (I can then have instances with either dc:title or my:myTitle) - I can make MyClass a subclass of the things which have a dc:Title - but not all instances of MyClass have a title What do you suggest? TIA |
|
Here's my suggestion: Don't try to make such "recommendations" part of the model itself. What you are about here is a "soft" pragmatic aspect of your model ("one should use An alternative would be to introduce a special set of OWL annotations to indicate what should be done. OWL already has annotations for deprecation and for (in)compatibility between ontologies, which do not have a real effect on the model, and one could easily extend this set of annotations to whatever one wishes to have. One could and should do this outside the core OWL standardization process and may do it even outside W3C, but it would require some kind of standardization effort to make it into something that is widely used. So this would certainly be more of a future thing. I believe the SO is looking for some way to make the constraints machine interpretable, not just recommended practice documents. As you state, one needs to look outside of OWL for such solutions. OTOH, SPIN constraint checking is built for just this use case. |
|
So the question is that you want to communicate to the modeler that they should use dc:title, and you want some machine operable way to detect when this convention is violated. Using RDFS/OWL you could set up a way to create an inconsistency when dc:title is missing. For example, infer all members of classes without a dc:title to be members of some "non-title" class and assert that all classes are owl:disjointWith that class. Any instance that is a member of the "non-title" class and one of the classes it is disjoint with will be flagged as an inconsistency. There are two issues with that solution. First, computing complements in OWL is both troublesome (some may disagree with me on this) and computationally expensive. Second, reasoners tend to poorly support how inconsistencies are reported. At best you will get a list of model inconsistencies that include your convention and you get to sort out which ones you want to expose to the modeler creating the instance. An alternative, which is more general than the notion of model consistency, is the SPIN notion of constraint checking. This defines a constraint check in a SPARQL query that can directly specify the semantics you need. For example, your rule would be:
The rule is defined for a class and is applied to all members of the class, pre-binding ?this to each instance before running the rule. Any instance not having a dc:title is flagged as having a constraint violation. This could be displayed on the instance view of your editor. TopBraid Composer and the Web-based application builder TopBraid Ensemble both do this. I.e. when the user creates an instance and forgets dc:title, a warning appears in the view. In addition the comment line is used in the warning, giving you a way to communicate the rule's intent. (I work for TopQuadrant, so feel free to ask more questions here or on our forum.) Either of these approaches would work, but I find the consistency check method to be more aligned with your needs. I worry about the statement I can make MyClass a subclass of the things which have a dc:Title - but not all instances of MyClass have a title…as it seems to assume that instances inherit object attributes. This is simply not the case in RDFS/OWL. Unlike attributes in OO modeling, adding a property to a class definition in RDFS/OWL will have NO IMPLICATIONS on instances. Instances can have any eoprrties and the only way it is known that an instance is a member is through the type triple - {:thing rdf:type :someClass}. You may understand this already, but I'm not getting the gist of the solution you propose so I thought I'd throw this out as a possible misconception. You cannot specify in RDFS/OWL that a title has to be provided. You cannot impose anything to be provided. OWL just expresses facts and facts are independent of what is provided. As a side note, complement is really not an issue, not any more than intersection, union, quantifiers etc. What creates computational issues is the combination of certain constructs. Concerning your last paragraph, I have the impression that you may have a possible misconception. Depends what you mean by attribute (a notion that does not exist in OWL). Consider fps statement: "I can make My use of the term "attribute" was to point out that OO semantics of instantiation do not apply here. I was trying to understand the expectations from the SO. Your points are well-taken and well-known. Edited last para for clarity per comments by @Antoine. @scotthenninger That Ah, yes, this is one of those corner cases where they differ. Edited for correctness.
showing 5 of 6
show 1 more comments
|


Thanks for the answers, all interesting. There is some ambiguity in the title of my question: "recommend or require" are different things. I am currently more concerned by the way to "recommend", but also interested in the constraint checking. I understand the "fact vs requirement" discussion about OWL semantics. However, knowing the fact, for instance, that any instance of AClass has a dc:title is a very useful hint when setting up a GUI to help creating instances, or when writing SPARQL queries. (Note that this is not exactly what I want to say about MyClass, but that's not the point here)