OWL: only one property among many properties exists - xsd

I want to express the xs:choice element from XSD in OWL:
XML Schema choice element allows only one of the elements contained in the declaration to be present within the containing element.
I think maybe I should first define a property group in OWL, and then specify only one of the properties in the group is allowed exists. Any help?

I think maybe I should first define a property group in OWL, and then
specify only one of the properties in the group is allowed exists. Any
help?
There's no notion of "property group" in OWL, but you could get a similar effect using subproperties and disjoint properties. For instance, you could have a property hierarchy like this:
hasVehicleChoice
hasCar
hasTruck
Then, you can declare that hasCar and hasTruck are disjoint. That means that a individual can't have the same value for both properties. That means that you can't say:
x hasCar vechicle72
x hasTruck vechicle72
That's not enough to say that they can't have different values though. You could still have
x hasCar vechicle72
x hasTruck vechicle75
To avoid that, you could make hasVehicleChoice be a functional property (meaning each individual has 0 or 1 values for it, but no more), or use a subclass axiom with a restriction, like
Person subClassOf (hasVehicleChoice exactly 1)
Then, each person would have exactly one vehicle choice, and since hasCar and hasTruck are disjoint, the person can't have both.
All that said, this isn't a common pattern in OWL ontologies, and there's not a particularly convenient way of encoding it. If you don't need it all that often, you might be better off just using the subclass axioms and property restrictions directly. E.g.,
Person subClassOf ((hasCar exactly 1) and (hasTruck exactly 0)) or ((hasCar exactly 0) and (hasTruck exactly 1))

Related

Define the multiplicity of an association by an attribute

In the example I made every object of the type "Folder" have an array of type "File" with the name "content" a size of "n" as a private attribute (just saying my understanding of it to make sure that I am not already wrong there). That's how I see it in most examples but I never understand what "n" now is. Is it another attribute of the "Folder" object or is it something that we specify in another part of an UML diagram or something else completely?
What I am trying to achieve is that every object of the type "Folder" has an additional attribute that specifies the size of the "content" array.
Of course, you can not only write 0..*, but use any concrete number, too. If that number has some external definition, you can use there n, as you have it.
The external definition means "not defined by class diagram elements, except notes". Everything that you need to be said on a class diagram page, but can't because of the UML limitations, should be put in a note.
So, n can be defined in appropriate note on the page or in some different document or both.
As #Kilian had mentioned, in the case of some more complicated dependencies of such variables you can use constraints. This way seems to me the most powerful.
But if n has no objective definition or dependency, but is a simple variable that can have any meaning, then it will be correct to use a rule, such as 0..*, or 1..*, or maybe 3..5, according to the reality you are working with.

why I don't always get ItemElementName in wsdl+xsd code generation from choice-element with WSCF blue?

I use WSCF blue to generate web service code from wsdl. Sometimes choice-element in xsd is generated to Item and ItemElementName. Sometimes just Item. Couldn't find any logic in this.
The answer it that there must be choice-elements of same type in schema. E.g. 2 int choices or 2 string choices so it can't be known anymore only by type. In my example had three different types in choice -> no ItemElementName enumeration and property.

In RDFa, difference between property="" & rel="", and resource="" & about=""?

I am currently teaching myself RDFa Core 1.1 after successfully learning RDFa Lite rather easily. Straight to the point, I can't understand two things: the difference between property and rel, and the difference between resource and about.
Please explain to me in simpler terms than the spec :)
property vs. rel:
Both attributes indicate a predicate of a triple, e.g. rel="http://purl.org/dc/terms/creator, which is the predicate ... has as a creator: ....
The difference is, from where they take their object. Slightly simplified, the rules for property are: The object is taken ...
from a valid content attribute or, if this is not present in the tag,
(if no datatype attr is present in the tag:) from a valid resource attribute or, if this is not present in the tag,
(if no datatype attr is present in the tag:) from a valid href attribute or, if this is not present in the tag,
(if no datatype attr is present in the tag:) from a valid src attribute or, if this is not present in the tag,
from the inner content of the element started by the tag.
Slightly simplified, rel differs in two aspects:
It takes its object only from a resource or a href or a src attribute.
It takes its object not only from an attribute of the same tag, but may also take it from descendant tags. The whole mechanism is called "chaining": "This is the main difference between #property and #rel: the latter induces chaining, whereas the former, usually, does not." 1 Usually, but property can induce chaining if used with typeof (cf. 2).
about vs resource:
about is the attribute to indicate the subject of a triple. The rules for resource are more complicated: It may indicate a subject or an object, and chaining plays a role here, too.
IMHO, chaining is the most complicated and confusing part of RDFa (and does not give you more than syntactic sugar). I would avoid chaining. This is possible by avoiding the attributes rel, rev, resource and typeof, which brings some further simplification at the same time. Thus, I use only the following attributes:
about for the subject
property for the predicate
content or href or src (or the inner content of the element) for the object, following the rules outlined above
lang for a language tag for object literals, e.g. lang="en"
datatype for a datatype tag for object literals
prefix (but only once in a document), so that I can abbreviate URLs by prefixing, e.g. property="dc:creator"
vocab (rarely and at the most once in a document), so that I can abbreviate URLs implicitly, e.g. property="creator".
(And I use the tag <base href="..."> to indicate the URL base value of the document.)
This is a strict, safe, easy-to-use and easy-to-parse subset of RDFa and allows to express any triple you want.
I would personally recommend to ignore / avoid using rel and about, they are not really necessary to write RDFa if you follow the rule of thumb that you should not try to be too smart by stuffing as many attributes as possible in a given HTML element. There are around for backward compatibility reasons. The other attributes from 1.1 are worth learning though: content and datatype.
Stephan's advice is in general conformance with RDF Lite 1.1, which does not include #rel or #about for precisely these reasons.
Another good rule of thumb is to not try to include markup of more than one entity on a given element, which was often an example of specifying an images license.
#property and #rel are very similar to each others, but served different purposes in RDFa 1.0, but this was confusing, even for experts. (Formerly, #rel was used for specifying objects which are other nodes, and #property was used for specifying literal values. While there are some remaining differences, but sticking to non-clever markup, you can do everything with #property that you could do with #rel.
Similarly, #about can be avoided to just use #resource. The difference is that #about sets the current subject and #resource the current object, but for child nodes the parent object (taken from the parent's current object becomes the current subject. There were another minor differences concerning the presence of #typeof, but if you only use #resource, it pretty much does what you want.
To summarize the best practices from RDFa Lite 1.1 you can also check out the RDFa 1.1 Primer:
stick to #vocab, #prefix, #property, #resource, and #typeof
avoid making more than one statement in a given element

How to draw a relationship between a property and a class in ArgoUML?

In ArgoUML, I have the ability to put a class Type to any property of a class. For example, I can declare a customer property with a Customer type in the Order class.
I can also easily draw a relationship from class to class:
But I can't figure out how to "draw" the link from the customer property to the Customer class. The link is never really connected to the property, but rather to the entire Order class.
I can move the position of the link manually:
But it's never really "locked" to the customer property, and can be moved automatically by the software at any moment.
Is there a way to do this?
You can not have an association in UML which is not connecting the entire two classes. It is not possible to touch the property inside the class.
Workarounds are:
add a note linked to the property
add an icon to the property which would be designed like an association.
I don't know if this advanced icons customization is available in this free tool but it is in other tools.
I found a flash demo which shows the association attribute with an icon. Look at : http://www.download-omondo.com/show_association_member.swf
If you need to understand what mean an association in UML and code generation in Java then have a look at this demo: http://www.download-omondo.com/association.swf
Hope this help.
ArgoUML follows the UML specification. Associations are drawn from one class to another. Attributes are drawn inside the 2nd compartment of a class.
The association type closest in meaning to an attribute is composition, but they are not equivalent.
You should never portray something AND as an attribute of a class, AND as a separate class associated to it.
E.g. 1. an Order may have a Number, that may be used by the customer to identify his Order. The Number is best portrayed as an attribute (in the 2nd compartment of the class).
E.g. 2. an Order may be associated to the Customer who placed the order. The Customer is best portrayed as a separate class, since it has its own lifespan (behavior), associated with the Order. This allows to show multiplicities and roles at both ends of the association line.

Add nullable attribute to a class in enterprise architect

I am using enterprise architect for UML. I need to generate code from the model.
I need have a nullable double attribute in a class.
I am able to add a double attribute but don't know how to make it nullable.
Do anyone have any idea how to add a nullable attribute.
There is a small problems with your question, let me first answer the part about the EA, and get to it later.
In UML you denote nullable type as
+attributeName : TypeName [0..1]
+fromUser : User [0..1]
in EA this is done in the Multiplicity section Select the class->Hit F9->Select the attribute->Click detail
Lower bound and Upper bound are the fields you are looking for, if each are 1 this attribute has a single value [1] usually not depicted in the diagram
[0..1] can have a value of null.
[*] can have any amount of values.
[1..*] collection that contains at least one value
[n..m] collection that contains between n and m values. n and m are replaced by concrete numbers
in many languages double is a primitive/value type you can not make it null. If you need to, you have to use Double. Note the first letter is capital.

Resources