In the UML diagram, in the Class diagram, what does stereotype mean <<compound>>?

43 Views Asked by At

I'm looking at the Class diagram and creating an instance in RDF/XML format. For example, suppose you model a banking system. This system has an Account Class and had <<Compound>> stereotype. This class has owner, balance, account_Number as its attributes. There is another class, Bank Class.

What does a Bank Class mean if it has an account: Account [0..1] as an attribute and how does it represent it as an instance?

Here's my guess. But this is clearly outside the RDF standard.

<cim:Bank rdf:ID="495151912155">
<cim:Bank.account>
    <owner>Bill</owner>
    <balance>9,005,000</balance>
    <account_Number>20-021-154-3214</account_Number>
</cim:Bank.account>
</cim:Bank>
2

There are 2 best solutions below

0
qwerty_so On BEST ANSWER

Without further ado: «compound» is neither an UML defined stereotype nor keyword. So it must belong to a specific profile. You need to ask the model author which profile has been used and depending on the answer you might get a picture of what has been meant.

0
Henriette Harmse On

How you translate UML class diagrams is very dependent on your motivation for doing so. I.e., I have done work on translating UML class diagrams to OWL/RDF in order to be able to reason on it and to determine inconsistencies. In this case, for representing attributes one needs to make use of OWL. I have written about this here and you can find the UML to OWL reference here and I am working on a converter for UML to OWL.

Typically when translating UML class diagrams for use in semantic web technologies, stereotypes are ignored and all implementation related concerns like interfaces, which I have written about here.

Your example could be represented as follows using Turtle syntax. As example data I assumed you have a bank called bankABC. A bank can have more than 1 account. An example account is account123 with owner John Smith, balance 300000 and account number 123.

  @prefix : <http://www.semanticweb.org/henriette007/ontologies/2024/2/untitled-ontology-1087/> .
  @prefix owl: <http://www.w3.org/2002/07/owl#> .
  @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
  @prefix xml: <http://www.w3.org/XML/1998/namespace> .
  @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
  @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
  @base <http://www.semanticweb.org/henriette007/ontologies/2024/2/untitled-ontology-1087/> .

  <http://henrietteharmse.com/uml/bankexample.owl> rdf:type owl:Ontology ;
                                                    owl:versionIRI <http://henrietteharmse.com/uml/v0.0.1/bankexample.owl> .

  #################################################################
  #    Object Properties
  #################################################################

  ###  http://henrietteharmse.com/uml/bankexample.owl#account
  :account rdf:type owl:ObjectProperty ;
          rdfs:range :Account .


  #################################################################
  #    Data properties
  #################################################################

  ###  http://henrietteharmse.com/uml/bankexample.owl#accountNumber
  :accountNumber rdf:type owl:DatatypeProperty ;
                rdfs:range xsd:string .


  ###  http://henrietteharmse.com/uml/bankexample.owl#balance
  :balance rdf:type owl:DatatypeProperty ;
          rdfs:range xsd:integer .


  ###  http://henrietteharmse.com/uml/bankexample.owl#owner
  :owner rdf:type owl:DatatypeProperty ;
        rdfs:range xsd:string .


  #################################################################
  #    Classes
  #################################################################

  ###  http://henrietteharmse.com/uml/bankexample.owl#Account
  :Account rdf:type owl:Class ;
          rdfs:subClassOf [ rdf:type owl:Restriction ;
                            owl:onProperty :accountNumber ;
                            owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger ;
                            owl:onDataRange owl:rational
                          ] ,
                          [ rdf:type owl:Restriction ;
                            owl:onProperty :balance ;
                            owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger ;
                            owl:onDataRange owl:rational
                          ] ,
                          [ rdf:type owl:Restriction ;
                            owl:onProperty :owner ;
                            owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger ;
                            owl:onDataRange owl:rational
                          ] .


  ###  http://henrietteharmse.com/uml/bankexample.owl#Bank
  :Bank rdf:type owl:Class ;
        rdfs:subClassOf [ rdf:type owl:Restriction ;
                          owl:onProperty :account ;
                          owl:someValuesFrom :Account
                        ] .


  #################################################################
  #    Individuals
  #################################################################

  ###  http://henrietteharmse.com/uml/bankexample.owl#account123
  :account123 rdf:type owl:NamedIndividual ;
              :accountNumber 123 ;
              :balance 300000 ;
              :owner "John Smith" .


  ###  http://henrietteharmse.com/uml/bankexample.owl#bankABC
  :bankABC rdf:type owl:NamedIndividual ;
          :account :account123 .