Introduction to visual rules modeling

13
Adrian Giurca, eBusiness Technologies, Craiova, March 2009 eBusiness Technologies (ebTech) Introduction to visual rules modeling Dr. Adrian Giurca Brandenburg University of Technology Cottbus, Germany

Transcript of Introduction to visual rules modeling

Page 1: Introduction to visual rules modeling

Adrian Giurca, eBusiness Technologies, Craiova, March 2009

eBusiness Technologies (ebTech)

Introduction to visual rules modeling

Dr. Adrian GiurcaBrandenburg University of Technology

Cottbus, Germany

Page 2: Introduction to visual rules modeling

Adrian Giurca, eBusiness Technologies, Craiova, March 2009

Rules in "real life"

• IF the customer is a gold customer and its current shopping cart is more than 150 EUR THEN set a 5% discount to the shopping cart.

• IF the customer is a platinum customer and its current shopping cart is more than 500 EUR THEN set a 15% discount to the shopping cart.

• All platinum customers are gold customers.

Page 3: Introduction to visual rules modeling

Adrian Giurca, eBusiness Technologies, Craiova, March 2009

Real rules are based on vocabularies

• Classeso Customero Shopping cart

• Propertieso discounto customerName

• Q: How we discover them? • A: As in Software Engineering Design

Page 4: Introduction to visual rules modeling

Adrian Giurca, eBusiness Technologies, Craiova, March 2009

Vocabularies (1)

• Software engineers represents vocabularies with the help of UML class diagrams

• Different constraints are expressed with OCL

Page 5: Introduction to visual rules modeling

Adrian Giurca, eBusiness Technologies, Craiova, March 2009

Vocabularies (2)

• Semantic Web community represents vocabularies with RDFS and/or OWL

<rdf:RDF xmlns:rdf="..." xmlns:rdfs="..."><rdfs:Class rdf:ID="ex:Customer"/> <rdfs:Class rdf:ID="ex:GoldCustomer"><rdfs:subclassOf rdf:resource="ex:Customer"/></rdfs:Class><rdf:Property rdf:ID="yearSpending"><rdfs:domain rdf:resource="ex:Customer"/><rdfs:range rdf:datatype="xs:double"/></rdf:Property></rdf:RDF>

Page 6: Introduction to visual rules modeling

Adrian Giurca, eBusiness Technologies, Craiova, March 2009

A Short Comparison

• UML provides a visual notation but a more complex XML serialization (XMI)

• RDFS/OWL provides XML syntax but no visual notation. The XML syntax is not based on XML Schema/RelaxNG therefore special validators are necessary

• UML provides support for packaging • RDFS/OWL use XML namespaces

Page 7: Introduction to visual rules modeling

Adrian Giurca, eBusiness Technologies, Craiova, March 2009

Modeling Rules

• Q: Why to use a modeling language for rules?

• A: Simply because natural language is sometimes ambiguous and we don't know how to encode the rule

• Remember also the logic controversy...• Do you remember it?

Page 8: Introduction to visual rules modeling

Adrian Giurca, eBusiness Technologies, Craiova, March 2009

Vocabularies and rules

Rule:If rental car is stored at the branch and rental car is not assigned to any rental and it is not a rental car scheduled for service then rental car is available at the branch.

Page 9: Introduction to visual rules modeling

Adrian Giurca, eBusiness Technologies, Craiova, March 2009

UML-based Rule Modeling Language

• Any person being a male and is not a husband is a bachelor.

bachelor(X):- male(X), not(husband(X)).

Page 10: Introduction to visual rules modeling

Adrian Giurca, eBusiness Technologies, Craiova, March 2009

If-Then-Else Rule

• If the order value is less than 1000 give a discount of 3% otherwise give 6%.

Page 11: Introduction to visual rules modeling

Adrian Giurca, eBusiness Technologies, Craiova, March 2009

Derived Association Rule Example

Page 12: Introduction to visual rules modeling

Adrian Giurca, eBusiness Technologies, Craiova, March 2009

Your knowledge on rules

• Do you know rule languages?

Drools?

• Do you use rule languages?

Drools?

• What rule-based applications you built?

Have you finished your first Drools example?

I will not work for you

Page 13: Introduction to visual rules modeling

Adrian Giurca, eBusiness Technologies, Craiova, March 2009

Do you like rule-based applications?

Tower of Babel - Pieter Bruegel (1563)