WSMO D3.2: Use Case and Testing Part 2: Syntax and Running
Example2nd F2F meeting SDK cluster working group on Semantic
Web ServicesLausanne, Switzerland, 14-06-2004
Holger LausenDigital Enterprise Research Institute
2
Session Structure
• WSML– Ontologies– Mediators– Goal as ground fact– Capability: pre and post conditions as
restrictions
• Run time environment– Mapping to flora2– „Demo“
3
Ontologies
• Use case shows how to apply the meta constructs outlined in D2
• Simple meta model with basic concepts:– Concepts, Relations, Instances, Axioms– More complex patterns like transetivity are for
the moment encoded as axioms (e.g. inverse, or transetive)
• Use case also illustrates– modelling consensus is not easy
• Ontologies try to be as specific as possible (e.g. avoiding unambiguty by assigning a string as range)
4
Ontologies – Meta Information
ontology http://www.wsmo.org/2004/d3/d3.2/v0.1/20040607/resources/loc.wsml namespace
default=http://www.wsmo.org/2004/d3/d3.2/v0.1/20040607/resources/loc.wsml#, dc=http://purl.org/dc/elements/1.1#, wsml=http://www.wsmo.org/2004/d16/d16.1/v0.2/20040418#, cnt=http://www.wsmo.org/2004/d3/d3.2/v0.1/20040607/resources/owlFactbookMediator.wsml#, ad=http://www.wsmo.org/2004/d3/d3.2/v0.1/20040607/resources/owlAddressMediator.wsml#, xsd=http://www.w3.org/2001/XMLSchema#
non-functional-properties dc:title "Locations Ontology" dc:date "2004-06-07" dc:type http://www.wsmo.org/2004/d2/v0.3/20040329/#ontos dc:language "en-US" dc:relation
http://www.daml.org/2001/09/countries/fips-10-4-ont, http://www.daml.org/2001/09/countries/iso-3166-ont, http://www.daml.org/2003/09/factbook/factbook-ont, http://daml.umbc.edu/ontologies/ittalks/address
dc:rights http://www.deri.org/privacy.html version "$Revision: 1.4 $" usedMediators
http://www.wsmo.org/2004/d3/d3.2/v0.1/20040607/resources/owlFactbookMediator.wsml, http://www.wsmo.org/2004/d3/d3.2/v0.1/20040607/resources/owlAddressMediator.wsml
5
Ontologies - Signatures
• Only well typed ontologies have a model, i.e. everything has to be declared explicitly:– Concepts (including attributes &
methods)– Relations– Function Symbols– Variables
6
Ontologies – Concepts / Instances
concept time hourOfDay oftype hourOfDay minuteOfHour oftype minuteOfHoursecondOfMinute oftype secondOfMinute
comment: “A link to large set of instances is missing in WSMO. Therefore, in this version of the ontology we only include some example instances. The inclusion of links to large set of instances will be considered in future versions of WSMO“
instance noon hourOfDay hasValue 12minuteOfHour hasValue 00secondOfMinute hasValue 00
7
Ontologies – Function & Relation
Declarationsfunction julianDayNumber non-functional-properties dc:description "The Julian Day Count is a uniform count of days from a remote epoch
in the past (about 4712 BC). At this instant, the Julian Day Number is 0. Once you have the Julian Day Number of a particular date in history, it is easy to calculate time elapsed between it and any other Julian Day Number"
dc:source http://quasar.as.utexas.edu/BillInfo/JulianDatesG.html parameter instant oftype instant range oftype xsd:integer
relation contains non-functional-properties dc:description "(interval, intervalOrInstant) is a tuple of the binary relation if and only if
interval contains intervalOrInstant and below typing constraints are not violated" parameter interval oftype interval parameter intervalOrInstant oftype (instant or interval)
• Note: The actual range respectively truth value is defined via axioms.
8
Ontologies – Axioms / Variables
Some variable declarations from the data and time ontology:variable X, Y, Z, D1, D2 oftype topConceptvariable A, B, C, D, E, F, JDN, JDN_D1, JDN_D2, SFM_T1, SFM_T2 oftype
xsd:integer variable T, T1, T2 oftype time variable JulianDayNumber, Difference, SecondsFromMidnight oftype xsd:integervariable Instant, Instant1, Instant2 oftype instant
Axioms:axiom intervalContainment logical-expression contains(X, Y) <- X memberOf interval and Y memberOf interval and X.start <= Y.start and X.end >= Y.end.axiom instantContainment logical-expression contains(X, Y) <- X memberOf interval and Y memberOf instant and X.start <= Y and X.end > = Y.
9
Axioms as integrity constraints
• Are written in WSML as rules with empty heads
axiom depatureBeforeArrival non-functional-properties dc:description "Integrity Constraint: that the departure of a trip has to be before
the arrival date" logical-expression <- T memberOf trip[ departure hasvalue D, arrival hasvalue A] and A > D.
10
Ontologies – Use Case Results Revisited
• The use case as test bed for WSMO– Introduced namespaces
• Everything is a Literal or a Resource
– Introduced XSD data types• Literal / value-space mapping and facets
(e.g. ordering)
– Introduced function symbols– Introduced variable declerations– Introduced anonymous IDs
11
Session Structure
• WSML– Ontologies– Mediators– Goal as ground fact– Capability: pre and post conditions as
restrictions
• Run time environment– Mapping to flora2– „Demo“
12
OO-Mediators
• Mediators that import ontologies and resolve possible representation mismatches between ontologies.
• In the Use Case:– Converting between different syntaxes (e.g.
importing OWL ontology into WSML)– Aligning specifications (e.g. refining or
dropping a concept)
• Declerative description of the latter out of the scope of the use case
13
OO MediatorooMediator
http://www.wsmo.org/2004/d3/d3.2/v0.1/20040607/resources/owlAddressMediator.wsml
namespace dc=http://purl.org/dc/elements/1.1#, wsml=http://www.wsmo.org/2004/d16/d16.1/v0.2/20040418/# sourceComponent ontology http://daml.umbc.edu/ontologies/ittalks/address/ targetComponent ontology http://www.wsmo.org/2004/d3/d3.2/v0.1/20040607/resources/loc.wsml mediationService comment: not yet implemented. mediationService http://138.232.65.151:8080/TranslatorService/OWL2WSML/ comment: This source ontology might overlap with the owl person ontology. comment: Not yet checked. In case, we should have one mediator importing both comment: and resolving possible overlaps/conflicts.
14
Session Structure
• WSML– Ontologies– Mediators– Goal as ground fact– Capability: pre and post conditions as
restrictions
• Run time environment– Mapping to flora2– „Demo“
15
Goal & Capability
• We achieved discovery by:– Formulating a query out of the restriction given in the
pre- and post condition of the service capability – Formulating the goal as a (possible incomplete) ground
fact (an instance)
Set of facts constrained by the restrictions given in the pre- and post condition of the capability
The goal describes one fact, if it is within the restrictions defined by pre- and post conditionthe service might fulfill the users desire
16
Goalpostcondition axiom buyATicketForItinerary logical-expression someItinerary memberOf tc:itinerary[ tc:passenger hasvalue _# memberOf prs:person[ prs:firstName hasvalue "Tim", prs:lastName hasvalue "Berners-Lee", prs:email hasvalue "[email protected]“ ], tc:trip hasvalue _# memberOf tc:trainTrip[ tc:start hasvalue tc:innsbruckHbf, tc:end hasvalue tc:frankfurtHbf, tc:departure hasvalue _# memberOf dt:dateAndTime[ dt:date hasvalue _# memberOf dt:date[ dt:dayOfMonth hasvalue 17, dt:monthOfYear hasvalue 7, dt:year
hasvalue 2004 ], dt:time hasvalue _# memberOf dt:time[ dt:hourOfDay hasvalue 18 ] ] ] ].
17
Capability – Pre Conditionprecondition axiom capPrecondition
logical-expression InputBuyer memberOf po:buyer[ po:shipTo hasvalue BuyerAddress memberOf loc:address, po:billTo hasvalue BuyerAddress memberOf loc:address, po:purchaseIntention hasvalue X1 and X1 memberOf tc:itinerary[ tc:trip hasvalue X2 and X2 memberOf tc:trainTrip[ tc:start hasvalue X3 and X3 memberOf tc:station[ tc:locatedIn hasvalue StartCountry ], tc:end hasvalue X4 and X4 memberOf tc:station[ tc:locatedIn hasvalue EndCountry ], tc:departure hasvalue X5 and X5 memberOf dt:dateAndTime[dt:date hasvalue
DepartureDate ] ] ], po:hasPayment Payment memberOf po:creditCard ] and (StartCountry=tc:austria or StartCountry=tc:germany) and (EndCountry=tc:austria or EndCountry=tc:germany) and DepartureDate > currentDate and ( (currentDate.date.year < Payment.expYear) or ( (currentDate.date.year = Payment.expYear) and ((currentDate.date.monthOfyear
<= Payment.expMonth)))
18
Capability Post Conditionpostcondition axiom capPostcondition non-functional-properties dc:description "the output of the service is an itinerary with a trainTrip for which
the start and end locations, and the departure date, are the ones in the precondition. The constraints on the start and end locations, and on the departure date, are, therefore, the ones in the precondition"
logical-expression OutputItinerary memberOf tc:itinerary[ tc:trip hasvalue InputBuyer.purchaseIntention.trip ].
19
Session Structure
• WSML– Ontologies– Mediators– Goal as ground fact– Capability: pre and post conditions as
restrictions
• Run time environment– Mapping to flora2– „Demo“
20
FLORA-goalmygoal[postcondition-> myTicket:ticket[ itinerary -> _#:itinerary[ startLocation -> innsbruckHbf, endLocation -> frankfurtHbf, departure -> _#:dateAndTime[ date -> _#:date[ dayOfMonth->17, monthOfYear->5, year->2004 ], time.hourOfDay -> 18:hourOfDay ] ], traveller->_#:traveller[name -> 'Dieter Fensel'] ]].
21
FLORA-capabilityoebbCap[postcondition] :- X:ticket[ itinerary->Y:itinerary[ startLocation -> StartLoc, endLocation -> EndLoc, departure -> Departure ], (StartLoc..locatedIn=austria ; StartLoc..locatedIn=germany), (EndLoc..locatedIn=austria ; EndLoc..locatedIn=germany), after(Departure, currentDate).
Discovery:?- X:capability[postcondition], X:capability[effect].
22
Further Resources
• Flora2 implementation:– http://flora.sourceforge.net
• Latest flora2 encodings:– http://cvs.deri.at/cgi-bin/viewcvs.cgi/ws
mo/d3/d32/resources/
</ WSMO D3.2 Use Case and Testing >
Next: Michael Kiefer „Discovery using transaction
logic reasoning“