Upload
others
View
18
Download
0
Embed Size (px)
Citation preview
Fakultät Informatik - Institut Software- und Multimediatechnik - Softwaretechnologie – Prof. Aßmann - CBSE
12. Finding Components with Metadata in Component Repositories
Prof. Dr. Uwe Aßmann
Technische Universität Dresden
Institut für Software- und Multimediatechnik
http://st.inf.tu-dresden.de/teaching/cbse
Version 16-0.1, 29.03.16
1. Component Search with Metadata
2. Searching and Browsing with Faceted Classications
3. Faceted Metadata
4. UML Components
5. Searching by Conformance to Protocols
Component-Based Software Engineering (CBSE)
Obligatory Literature
► R. Prieto-Diaz. Implementing Faceted Classification for Software Reuse. CACM May 1991, vol 34(5). In the ACM digital library.
► U. Aßmann. Reuse in Semantic Applications. REWERSE summer school 2005, La Valetta, Malta. Lecture Notes In Computer Science (LNCS) 3564.
■ http://www.springerlink.com/content/blx9yfthkq5xjtjg/
Component-Based Software Engineering (CBSE)
References
• http://simile.mit.edu/wiki/Longwell • http://simile.mit.edu/exhibit • http://flamenco.berkeley.edu • http://search.express.ebay.com • http://base.google.com ► FacetMap: Greg Smith, Mary Czerwinski, Brian Meyers, Daniel
Robbins, George Robertson, Desney S. Tan. FacetMap: A Scalable Search and Browse Visualization. IEEE Transactions on visualization and computer graphics, vol.12 , No. 5, september/october 2006.
► Thorsten Teschke. Semantische Komponentensuche auf Basis von Geschäftsprozessmodellen. Dissertation. Universität Oldenburg, 2003.
► Facet-based search of computer science literature in DBLP repository ► http://dblp.l3s.de/?q=&newQuery=yes&resTableName=query_resultOsC5mC
Ø Luca de Alfaro and Thomas A. Henzinger, Interface automata, ACM SIGSOFT FSE/ESEC, 2001
http://doi.acm.org/10.1145/503209.503226
Fakultät Informatik - Institut Software- und Multimediatechnik - Softwaretechnologie – Prof. Aßmann - CBSE
12.1. Component Search in Component Repositories
• It should be as easy to find good quality reusable software assets as it is to find a book on the internet
• http://softwarereuse.nasa.gov/
Component-Based Software Engineering (CBSE)
Component Repositories
Ø Components must be stored in component repositories with metadata (markup, attributes) to find them again
Ø Description by Metadata: • Attributes: Keywords, Author data • Contracts (Usage protocols, behavioral specifications)
§ State machines § Sequence diagrams § Contracts (pre/post/invariants)
Ø Examples of Component Repositories • CORBA
§ implementation registry § interface registry
• COM+ registry • Commercial Component Stores www.componentsource.com • Debian Linux Component System (apt, dpkg) • CTAN TeX Archive
Component-Based Software Engineering (CBSE)
Why Searching Components?
Ø A public component repository is called a market, managed by a trader (broker) • Distributing or selling components • Companies can register components at the the trader • Customers can search components in the markets and buy or rent them
Ø Searching for functionality (interface, contract, protocol) • Reuse instead of build • Searching for components to replace own ones • Semantic substituability (CM-S) should be ensured
Ø Searching for quality features • Performance, energy consumption, reliability
Fakultät Informatik - Institut Software- und Multimediatechnik - Softwaretechnologie – Prof. Aßmann - CBSE
12.2 Searching and Browsing with Faceted Classifications
(thanks to Jan Polowinski)
Component-Based Software Engineering (CBSE)
Faceted Classification for Better Matchmaking
► A facet is a dimension of a classification ■ Facets simplify search: Facet classification has been invented in library science to
simplify the description and search for books [Ranganathan]. ■ A component (or service) is described in several facets, dimensions, which are
orthogonal to each other ► Matchmaking engines can look up a service by stating the desired properties
for all facets. ► Classifications can be arranged in facets if several partitions of a group of
objects exist that are orthogonal ■ In domain modelling, this is often the case ■ Without facets, multiple inheritance hierarchies have to be specified, which are
often clumsy and error-prone ► Idea: use facets for better matchmaking
Component-Based Software Engineering (CBSE) 9
Comparison
Standard Classification ► V Vögel
■ V1 Atmung der Vögel ■ V2 Fortpflanzung der Vögel
► F Fische ■ F1 Atmung der Fische ■ F2 Fortpflanzung der Fische
► S Säugetiere ■ S1 Atmung der Säugetiere ■ S2 Fortpflanzung der Säugetiere
► I Insekten ■ I1 Atmung der Insekten ■ I2 Fortpflanzung der Insekten
• Kiemen: F1 Example: Wikipedia
Faceted Classification ► Prozeßfacette
■ P Physiologie . PA Atmung . PF Fortpflanzung
► Tierfacette ■ 1 Vögel ■ 2 Fische ■ 3 Säugetiere ■ 4 Insekten
• Kiemen: PA 2
Component-Based Software Engineering (CBSE)
Facetted Browsing
► Here Facet means: an interesting property of an object orthogonal to other properties
► Incremental refinement of a set of results by restricting values of the data's facets
► Empty result views impossible ► Many application domains
Component-Based Software Engineering (CBSE)
Component-Based Software Engineering (CBSE)
Facet
Facet
Facet
Facet
Component-Based Software Engineering (CBSE)
Widget for Restriction of Facet Values
Component-Based Software Engineering (CBSE)
Sorting and Grouping
Mechanisms
Component-Based Software Engineering (CBSE)
Result Set
Component-Based Software Engineering (CBSE)
More Examples of Facetted Browsers
► Flamenco ■ FLexible information Access using MEtadata in Novel
COmbinations ■ University of California, Berkeley ■ Browses DB
► Longwell ■ SIMILE-Project ■ Browses RDF
► Exhibit ■ SIMILE-Project
► mSpace ■ University of Southampton
► FacetMap ■ Microsoft Research
Component-Based Software Engineering (CBSE)
Facetted Browsing in e-Commerce
Component-Based Software Engineering (CBSE)
Component-Based Software Engineering (CBSE)
Component-Based Software Engineering (CBSE)
Component-Based Software Engineering (CBSE)
Fakultät Informatik - Institut Software- und Multimediatechnik - Softwaretechnologie – Prof. Aßmann - CBSE
12.3 Faceted Metadata for Search in Component Repositories
Component-Based Software Engineering (CBSE)
Example: Service Facets in a UNIX System
► To describe the services of a UNIX system, [Prieto-Diaz] employed a 4-faceted scheme ■ function ■ logical object ■ implementation object ■ tool
► UNIX services can be described with appropriate facet values and looked up in a repository
► Example: “append a line to a file with a text editor” ■ (function = append, logical class = line, implementation class = file, tool = text
editor):
Function Logical class
Implementation Class
Tool
edit Line File Text editor
Component-Based Software Engineering (CBSE)
Example: Services in a UNIX System
► [Prieto-Diaz] already suggested to use controlled vocabulary (domain ontologies) to improve the effectiveness of the search: ■ If every facet is described by an ontology, the service descriptions are
standardized for a user group and improve understanding of service semantics. ► Facets simplified the description of the components, improved the
understanding of their domain, and facilitated the search in component libraries.
Component-Based Software Engineering (CBSE) And for Components?
Component-Based Software Engineering (CBSE) And for Components?
Component-Based Software Engineering (CBSE)
Other Advantages
► The facet classification is rather immune to extensions ■ Extending one facet leaves all others invariant ■ Example: If Europe is extended with a new member state, the matchmaking
algorithm can deliver new courses from the new member state, without affecting the rest of the semantic specifications at all
► The accuracy can be improved by synonym lists (thesauri) ■ Synonyms increase the chances for a match ■ They permit to search not only for keywords, but also for their synonyms
(assembled in a thesaurus) ■ Beyond synonyms other refinement relations of concepts can be used to improve
the search
■ Example: Great Britain is used as a synonym for England, Scotland, and Wales. Synonyms allows for matchmaking on any of the keywords, so that students looking for a course need not bother about geographic and political details.
Component-Based Software Engineering (CBSE)
The Use of Ontologies in Faceted Matchmaking
► Ontologies simplify matchmaking by standardization ■ Since they provide standardized terminology and standardized
ontological relations between the terms, queries can specify . keywords with a precise, shared, and standardized meaning (semantic
search), . contextual information for search in context, where the context is defined by
the ontological relations of the terms. ► Example:
■ A web course on IT basics can be queried by the standardized word IT-basics (being semantic search)
■ also in context, by relating it to courses such as IT-advanced or IT-preparatory (contextual search)
. “find me an IT basics course, which has a preceding preparatory IT course and has a follow-up advanced IT course“
Component-Based Software Engineering (CBSE)
Putting up a Component Repository for Your Company
► Define facets for component metadata ■ If possible, reuse an ontology for a facet ■ Form a thesaurus for synonyms ■ Store the metadata as a tuple in the database
► Realize a search algorithm that uses facets together with thesauri ► Or use a faceted browser with the metadata
Fakultät Informatik - Institut Software- und Multimediatechnik - Softwaretechnologie – Prof. Aßmann - CBSE
12.4 UML Components
Component-Based Software Engineering (CBSE)
Natural and Dependent Types
Ø An object with a natural type (entity type) lives on its own and exists independent of context and collaborators (see DPF) ■ The type does not depend on other types (independent type) ■ Types that depend on others are called dependent types. ■ Role types, facet types, part types are dependent types.
. Hotel vs. HotelRoom
. Car vs. Screw or Motor
. Book vs. Reader Ø A big object (bob) is complex, hierarchical object with a natural type
• Usually, it has subobjects with dependent types, role types and others. ► A business object (domain object) is a bob with a natural type of the
domain model (business model) ► Usually, business objects (domain objects) are large hierarchical objects ■ They can consist of thousands of smaller objects of dependent types (part-of
relation) ■ They can play many roles with context-based types
Component-Based Software Engineering (CBSE)
Component Specification with UML Components
• A UML component is a hierarchical class for big objects with provided and required interfaces (roles)
• Provided interfaces (provided roles) use „lollipop“ notation • Required interfaces (required roles) use „plug“ notation
• UML components can specify big objects with one natural core object and many dependent subobjects Some components are required to use specific other interfaces
<<comp spec>> CompanyMgr ICompanyMgt
<<comp spec>> CompanyMgr
ICompanyMgt
IAddressMgt
<<comp spec>> AdressMgr
Component-Based Software Engineering (CBSE)
Ports of UML Components
Ø A port is a connection point of a UML component. • A port has a set of roles (interfaces) • It may be represented by a port object (gate)
System
Port Provided interfaces Required
interfaces
Component-Based Software Engineering (CBSE)
Lollipops und Plugs (Balls and Sockets)
► For a UML component, provided and required interfaces can be distinguished n A required interface specifies what the current class needs to execute.
<<provided>> Addresses
<<required>> Text AddressManager
listAdresses() listAdresses() sort()
Adresses
Text
Component-Based Software Engineering (CBSE)
Ports
► Ports consist of port classes with interfaces and behavior in form of interface automata
n provided: normal, offered interface n required: used, necessary interface
Component
<<provided>> Port class
<<required>> Port class
Component
Port
Component-Based Software Engineering (CBSE)
Nesting of UML Components
► UML components n Ports are connected by links (connections) n Delegation link: links outer and inner port
DocumentSystem Link/connection Delegator
Text Manager
Address Manager Adresses
email Manager
Text
Forms
Buffer
Lines TextRep
IText
IForm
Component-Based Software Engineering (CBSE)
Refinement of UML Components
► UML components are nested, i.e., are bobs. ► Nesting is indicated by aggregation and part-of relationship. ► Nesting is introduced by an encapsulation operator encapsulate.
Document System
Document System
Text Manager
Address Manager Adresses
email email
Manager
Text
Forms
Buffer
Lines TextRep
IText
IForm
encapsulate
decompose
Component-Based Software Engineering (CBSE)
Encapsulation means Aggregation
► Nesting means Aggregation n A UML component is a package and a façade for all subcomponents
DocumentSystem
Text Manager
Address Manager Adresses
email Manager
Text
Forms
Buffer
Lines TextRep
IText
IForm
DocumentSystem
Text Manager
Address Manager
Adresses
email Manager
Text
Forms
Buffer
Lines
TextRep
IText
IForm
Fakultät Informatik - Institut Software- und Multimediatechnik - Softwaretechnologie – Prof. Aßmann - CBSE
12.5 Searching in Component Repositories by Contract Conformance• Contract Conformance means semantic substituability
Component-Based Software Engineering (CBSE)
Ports can be Equipped with Interface Automata Contracts
► Ports consist of port classes with interfaces and behavior in form of interface automata (port automata, protocol automata)
n provided: normal, offered interface n required: used, necessary interface
Component
<<provided>> Port class
<<required>> Port class
Component Port
Interface automaton
Interface automaton
Component-Based Software Engineering (CBSE)
Component Protocols with Operational Contracts
Ø The port protocol automata can be composed to a component protocol automaton
Ø Components may have a protocol automaton in which their ports, services, procedures should be called, invoked, or signalled
• The provided protocol specifies in which order the services can be invoked (given by a provided interface automaton)
• The required protocol specifies in which order the services can be invoked (given by a requried interface automaton)
Ø The order of component invocation can be specified by a language over the alphabet of the ports, services, procedures (state-based protocol contract, operational contract)
• Language contains sets of paths ofer the alphabet • Finite state automaton (regular language) specify regular sets of paths
§ UML state chart (Hierarchical finite state machine, prococol machines) § Data flow diagram
• Stack machine (context-free language) • Petri net (regular dialects, context-free and context-sensitive dialects)
Ø The contract provides an abstraction of the implementation of the component
• Implementations must be proven to be conformant to the procotol
Ø The conformance checking is decidable if the protocol language is decidable
Ø Sets of paths over states (words over state and edge alphabet)
Component-Based Software Engineering (CBSE)
The Golden Rules of Substitutability
Ø Component A can replace component B if it offers more and requires less
Ø Two conditions: • A‘s provided protocol must be stronger (richer, larger) than B‘s – it must
guarantee more • A‘s required protocol must be weaker (smaller) than B‘s – it must assume less
Ø If those conditions hold for all component instances of two component types AT and BT, we say that AT can substitute BT in a program.
Component-Based Software Engineering (CBSE)
Subsumption of Single Interface/Port Protocols
Ø A provided-port protocol Pr(P1) is-contained-in (is smaller than, is-weaker-than) a provided-port protocol Pr(P2), if Pr(P1) <= Pr(P2), i.e, if the set of guaranteed call sequences to P1 is smaller-equal than that to P2
Ø A port protocol Pr(P1) subsumes (contains, is-stronger-than) a port protocol Pr(P2), if Pr(P1) > Pr(P2), i.e., if the set of guaranteed call sequences of P1 is larger than that of P2, i.e., it delivers more
• Then, port P1 is conformant to P2 and P1 can substitute P2 in connections, because P1 delivers less paths of states than P2
• Subsumption checking of ports, and thus, conformance checking, should be decidable (protocol language should be decidable)
Pr(P1) = a b b* c <= Pr(P2) = a b* c
P1:Component
<<provided>> Port Class
P1 a b
c b
P2:Component
<<provided>> Port Class
P2 a b c
<=
corrected
Component-Based Software Engineering (CBSE)
D:Component
r r r s t
<<provided>> Port Class 2
Subsumption of all Guarantees (Provided Protocols)
Ø A component‘s guarantee (provided protocol) G(C1) is-contained-in (is-weaker-than, offers-less) a second component‘s guarantee G(C2), if forall ports P in C1.providedPorts: exists Q in C2.providedPorts: Pr(P) <= Pr(Q)
• C1 offers/delivers on every port less than C2 on the corresponding port
Ø A component‘s guarantee G(C1) subsumes (is-stronger-than, offers-more) a second component‘s guarantee G(C2), if for all ports P in C1.providedPorts: exists Q in C2.providedPorts: Pr(P) > Pr(Q)
• Then, C1 is guarantee-conformant to C2 and can substitute it in output connections
a b b* c
<<provided>> Port Class 1
<= E:Component
r* s t
<<provided>> Port Class 2
a b* c
<<provided>> Port Class 1
Pr(D.PortClass1) = a b b* c <= Pr(E.PortClass1) = a b* c Pr(D.PortClass2) = r r r s t <= Pr(E.PortClass2) = r* s t
Component-Based Software Engineering (CBSE)
Protocol Subsumption is Pairwise Port Subsumption
Ø Every port of D must find a matching port of E, in whom it is contained
D:Component
r r r s t
<<provided>> Port Class 2
a b b* c
<<provided>> Port Class 1
<= E:Component
r* s t
<<provided>> Port Class 2
a b* c
<<provided>> Port Class 1
new
Component-Based Software Engineering (CBSE)
D:Component
r* s t
<<required>> Port Class 2
Subsumption of Assumptions (Required Protocols)
Ø A component‘s assumption (required protocol) A(C1) contains (is-stronger-than, demands-more) a second component‘s assumption A(C2), if for all ports P in C1.requiredPorts holds:
• Exists Q in C2.requiredPorts: Pr(P) > Pr(Q) (required ports of C2 have smaller or less assumptions) • Q‘s required ports require less assumptions than P‘s required ports
Ø A component‘s assumption A(C1) subsumes (is-contained-in, is-weaker-than, demands-less) a second component‘s assumption A(C2), if for all ports P in C1.requiredPorts holds:
• Exists Q in C2.requiredPorts: Pr(P) <= Pr(Q) (required ports of C2 have larger and more assumptions) • Then, C1 is assumption-conformant to C2 and can substitute it in input connections
a b* c
<<required>> Port Class 1
> E:Component
r s t
<<required>> Port Class 2
a b c
<<required>> Port Class 1
A(E.ReqPortClass1) = a b c <= G(D.ReqPortClass1) = a b* c A(E.ReqPortClass2) = r s t <= G(D.ReqPortClass2) = r* s t
corrected
Component-Based Software Engineering (CBSE)
Subsumption of Guarantees and Counterwise Subsumption of Assumptions
Ø A component protocol Prot(C1) can subsume a component protocol Prot(C2) if G(C1) >= G(C2) and A(C2) <= A(C1)
• If C1‘s assumptions are weaker than C2‘s • And if C1‘s guarantees are stronger than C2‘s
Ø Then, C1 is conformant to C2 and C1 can substitute C2 in input and output connections
Ø C1 can be substituted for C2, if • C1 delivers more or equal than C2 and (more performant, less guarantueeing) • C1 demands less or equal than C2 (less demanding, less assuming)
Component-Based Software Engineering (CBSE)
Component
Subsumption of Protocols
Ø A component protocol P(C1) can subsume a component protocol P(C2) • P(C1) <= P(C2) • For finite automata: P(C1) P(C2)
Ø Then, C1 is conformant to C2 and C1 can substitute C2 Ø Subsumption checking and thus, conformance checking, should be decidable
(protocol language should be decidable) • Fortunately, automata can be decided on containment
⊆
<<provided>> Port class
<<required>> Port class
Component-Based Software Engineering (CBSE)
Searching by Protocol
Ø A component C can be found in a repository, if a query protocol Q is given with Q <= P(C)
Ø Search consists of subsumption checking with all component protocols in the repository
Ø Query protocols can be: • Metadata about the component • Provided protocols • Required protocols • Provided and required protocols
Component-Based Software Engineering (CBSE)
Declarative Protocols
Ø A protocol can also be specified as predicates over the states of a component (declarative contract) • Preconditions (assumptions) • Postconditions (guarantees) • Invariants
Ø Then, the protocol consists of logic expressions. The logic should be decidable • OCL • Description logic • Datalog • Temporal logic (propositional logic with temporal quantifiers, such as LTL and
CTL) Ø Subsumption checking of protocols and conformance can be done by
reasoning • E.g., by subsumption checking of an OWL class hierarchy
Component-Based Software Engineering (CBSE)
The End - Acknowledgements
Ø Faceted browsing slides are courtesy to Jan Polowinski.
Component-Based Software Engineering (CBSE)
Example: Finding Courses in Europe based on Ontologies
► A course in the unified Bologna world of European education can be described by several facets: ■ topic area (computer science, music, literature, etc.), ■ level of advancement (undergraduate, graduate), ■ cost (free, non-free), ■ country (Germany, Italy, WesternEurope, EasternEurope, etc.)
► Every facet can be described by an ontology, in this case on ■ topic area ■ level ■ cost ■ country
► A semantic description of a course selects one value for each facet and forms a tuple ■ A free undergraduate music course could be described by the tuple (topic area =
music, advancement = undergraduate, cost = free, country = WesternEurope).
Component-Based Software Engineering (CBSE)
Ex. Finding Courses in Europe
► Searching a course throughout the course databases in Europe consists of comparing the tuple point-wise to database entries.
► The values need not match exactly, ■ Subsumption (inheritance) in the facet ontologies can be used to deliver
refinement of matchings. ■ Example: if free-course is subsumed by non-free-course, the matcher can yield a
free course, even if the client desired a non-free one. ■ Example: a matchmaker can return a (music, undergraduate, non-free, Germany)-
course which should fit the client's desires.