Thursday, December 17, 2009

UML Profile for OWL, Part 2: RDF Resource

In my previous posting (Part 1), I introduced UML profiles to prepare for this posting. In this posting (Part 2), I will describe the top of the UML stereotype specialization hierarchy for defining an OWL ontology. In subsequent postings I plan to descend the specialization hierarchy and describe each specialization in detail.

The top of the specialization hierarchy is the «RDF Resource» stereotype. One of the ambiguities in RDF and RDFS is the capitalization of the word "resource". In RDF, "resource" is a thing with a URI and possibly a namespace prefix; whereas in RDF-S, "Resource" is the class of all RDF resources. I capitalize the first letter of the words in both stereotypes and qualify them with RDF or RDFS because classes and metaclasses always have the first letter of every word capitalized (in every convention I've ever seen except for one, and you know who you are :-) ), and stereotypes are virtual specializations of UML metaclasses.

The «RDF Resource» stereotype tells the transformation software to transform a UML metaclass into an rdf:resource. Although I haven't thought of a reason why this would be a useful thing to do yet, mainly because the specializations I'll be introducing in subsequent postings are so much more useful, I don't want to disallow its use because everything identifiable by a URI is an rdf:resource. (Please feel free to leave a comment if you have an opinion!)

As with rdf:resource, the «RDF Resource» stereotype has a URI and may have a namespace prefix. The URI is a String that can either be a fragment (e.g., "Person") or a full URI (e.g., "http://somewhere.com/myOntology.owl"). In this profile the URI is optional because the transformation software can often derive it from the UML metaclass' name and owning element's URI. For example, a UML Package stereotyped as an «RDF Resource» might represent an ontology file's URI. The transformation software can then automatically determine the URI fragment of a UML Class based on that Class' name. (More about this in a subsequent posting on the «Ontology» stereotype.)

The namespace prefix is a String that represents the URI with a much shorter name (e.g., the first three characters in "rdf:resource"). Whatever UML metaclass stereotyped as «RDF Resource» that has both a URI and a namespace prefix defines their equivalence for use in other places. For example, when you want to re-use a property in another namespace, you can set that property's namespace prefix to it's real owner. Normally, when you don't specify a property's namespace prefix or URI, the transformation software derives it from the owning UML Class' Package, which must be stereotyped as an «Ontology». I'll explain more about this as I descend the stereotype hierarchy.

I get the feeling I'm being too abstract in this posting, but at this level in the hierarchy, I'm having trouble coming up with a good example. I plan to give better examples as I work down the stereotype hierarchy and can show some actual UML diagrams. (Gentle feedback is welcome!)

Reblog this post [with Zemanta]

No comments: