Semantic Modeling
With OWL
A Gentle Introduction
Gerald McCollam
OpenMine, LLC
My background Principal Consultant, OpenMine, LLC
10 years as a web developer and systems integrator.
Reuters Health, Razorfish, Opsware, EDS, Bladelogic
Current Project: The Design Library, NY
OpenMine, LLC
Charles Sanders PeirceFounder of Pragmatism, a theorist of logic, language, communication, and the general theory of signs (semiotics).
Image {has repeating} elementElement {has attribute of} medium density
Element {has attribute of} diagonal orientationElement {is} figurative
Image {has a} background Background {is} solid Background {is} black
Image {has a} foreground Foreground {has repeating} elementForeground {is} white
Element {is} foregroundElement {is a} bird
OpenMine, LLC
Data modeling for the Semantic Web
RDF (W3C recommendation since 2003.)
RDF Schema (RDFS) (W3C recommendation since 2003.)
RDF Plus (also known as OWL-Fast, considered a subset of WOL, not currently a recommendation.)
OWL (W3C recommendation since 2003.)
What will we cover?
Semantic Web for the Working Ontologist: Effective Modeling in RDFS and OWL - Dean Allemang and Jim Hendler (2007) Morgan Kaufman.
OpenMine, LLC
Full details of OWL.
Tools available for building SW apps.
Pitfalls and gotchas of this technology.
Arguments for or against, flame wars, or anything controversial.
What we won’t cover
Why A Semantic Web?
Part of the original design idea for the WWW (as proposed by Sir Tim Berners-Lee).
Very Basic Idea is to use metadata to add (and extract) meaning to (and from) documents.
An Even Better Idea is to utilize Semantic Web methodologies to create a web of data in addition to the current web of documents.
Misconception: Semantic Web is just AI for the Web.
Misconception: One must learn formal logic to use Semantic Web technology.
Misconception: Everything must be converted!
.
OpenMine, LLCOpenMine, LLC
water molecule ‘triple’
Foundational RDF:
Rdf:Resource Anything that can be defined in terms of a triple.
Rdf:PropertyResources that are used as predicates.
Rdf:StatementA resource that reifies a triple.
OpenMine, LLC
Where is Semantic Web being applied today?
OpenMine, LLC
66%
Jorge Cardoso, “The Semantic Web Vision: Where are We?” IEEE Intelligent Systems, September/October 2007, pp.22-26, 2007.
Vodafone, a leading mobile phone company, has used RDF to describe and search ring tones, games and pictures in their Web site. As a result, the page viewed per download has decreased by 50% and revenues have risen by 20%.
OpenMine, LLC
Where are ontologies being applied?
OpenMine, LLC
Jorge Cardoso, “The Semantic Web Vision: Where are We?” IEEE Intelligent Systems, September/October 2007, pp.22-26, 2007.
The basic challenge for ontology: identifying the subject, the object and any relationships between the two.
OpenMine, LLCOpenMine, LLC
Simple ontologies: Guitars and Cars
Making sense of RDF, RDF Schema, etc.
OpenMine, LLCOpenMine, LLC
Resource Description Framework (RDF).
RDF Schema.
RDF Plus.
OWL.
RDF – The Resource Description Framework
OpenMine, LLCOpenMine, LLC
A W3C specification for representing information so that it can be shared between applications without ambiguity.
A standard way to make statements about resources on the Web (and elsewhere).
Examples:
SubjectPredicate Object
Led Zeppelin wrote Stairway To Heaven
Jimmy Page is a guitarist
Jimmy Page is part of Led Zeppelin
Historical noteThe triplet form of RDF adheres to the triadic form found in Peircean semiotics. Peirce refers to the subject as the ‘representamen’, the form the sign takes, the object as what the sign refers to, and the predicate or ‘interpretant’ as the sense the sign makes.
Definition:The base element of the RDF model is the triple: a resource (the subject) is linked to another resource (the object) through an arc labeled with a third resource (the predicate).
RDF – Managing conflicting interpretations.
OpenMine, LLCOpenMine, LLC
Jimmy Page’s Index Finger
Led Zeppelin
Jimmy Page
Jimmy Page’s Index Finger
Led Zeppelin
Jimmy Page
Subject Predicate Object Jimmy Page is part of Led Zeppelin Jimmy Page’s index finger is part of Jimmy Page
Is Jimmy Page’s index finger really part of Led Zeppelin?
We will see how two interpretations can exist side by side.
Interpretation #1 Interpretation #2
Given the following triples:
RDF – Managing a more ‘dramatic’ merge.
OpenMine, LLCOpenMine, LLC
Subject Predicate Object Wm. Shakespeare wrote King Lear Wm. Shakespeare wrote Hamlet Anne Hathaway married Wm. Shakespeare Wm. Shakespeare lived in Stratford Stratford is part of England England is part of U.K.
Shakespeare
King Lear Hamlet
Anne Hathaway
Stratford England U.K.
married
wrote
lived in
part of part of
Subject Predicate Object Wm. Shakespeare author of The Tempest Wm. Shakespeare author of As You Like It Wm. Shakespeare author of Othello Wm. Shakespeare author of King Lear
ShakespeareThe Tempest
As You Like It
Othello
author of
King Lear
RDF – Identity issues when merging triple stores
OpenMine, LLCOpenMine, LLC
Subject Predicate Object Wm. Shakespeare ns1:wrote King Lear Wm. Shakespeare ns1:wrote Hamlet Wm. Shakespeare ns1:author of Hamlet Wm. Shakespeare ns2:author of The Tempest Wm. Shakespeare ns2:author of As You Like It Wm. Shakespeare ns2:author of Othello Anne Hathaway ns1:married Wm. Shakespeare Wm. Shakespeare ns1:lived in Stratford Stratford ns1:is part of England England ns1:is part of U.K.
Shakespeare
King Lear
Hamlet
Anne Hathaway
Stratford England U.K.
ns1:married
ns1:wrote
ns1:lived in
ns1:part of ns1:part of
The Tempest
As You Like It
Othello
ns2:author of
When is a node in one graph the same as a node in another graph?”
King Lear
RDF – Namespaces, the URI and Equivalence
OpenMine, LLCOpenMine, LLC
RDF applies the notion of the URI to resolve the identity problem in graph merging. A node from one graph is merged with a node from another graph, only if they have the same URI.
Using the URI as a standard for global identifiers allows for a world-wide reference for any symbol.
Wm. Shakespeare ns1:wrote King Lear Wm. Shakespeare ns2:author of King Lear
"http://someplace.org/ns1/relations/#wrote”"http://otherplace.org/ns2/relations/#authorOf"
Comment:RDF and the Semantic Web are primarily about describing resources. Resources are always named by URIs, and anything can have a URI.While designed to handle resources on a network, RDF may be used to describe potentially anything.
RDF – Summary
OpenMine, LLCOpenMine, LLC
RDF is a base specification for representing data (things and the relationships between things) on the Semantic Web.
The elemental form is the triple consisting of a subject, an object, and a predicate.
RDF is intended to provide a simple way to make statements about resources and to build up ontologies based on collections of statements.
Next: RDF Schema
RDFS – Adding inference capability to data.
OpenMine, LLCOpenMine, LLC
RDFS is a specification for representing relationships between data.
Examples: rdfs:subClassOf, rdfs:subPropertyOf, rdfs:domain, rdfs:range.
RDFS is based on inference. If we say that ‘X is a subclass of Y’ we’re saying that every member of class X is also a member of class Y. If x is a member of X, then x is also a member of Y. In this way we can derive new information.
http://www.w3c.org/2000/01/rdf-schema#subClassOf
http://blah.org/stuff/Vehicle
http://blah.org/stuff/passengerVehicle http://blah.org/stuff/Van http://blah.org/stuff/Truck
http://blah.org/stuff/Minivan
http://www.w3c.org/2000/01/rdf-schema#subClassOf
http://www.w3c.org/2000/01/rdf-schema#subClassOf
Note: We’re using the full URI expression above. An equivalent expression is the corresponding ‘qname’, for example rdfs:subClassOf.
RDFS – Inference via Type Propagation
OpenMine, LLCOpenMine, LLC
By the rules defined for rdfs:subClassOf we know that a van is a type of vehicle and a minivan is a type of van. These are explicitly defined as part of our ontology.
Through the same inference rule we know implicitly that a minivan is also a type of vehicle. We infer this information from what is already defined.
This very simple example indicates the potential cumulative effect of deriving new information from what is previously defined.
http://blah.org/stuff/Vehicle
http://blah.org/stuff/passengerVehicle http://blah.org/stuff/Van http://blah.org/stuff/Truck
http://blah.org/stuff/Minivan
RDFS – Inference via Relationship Propagation
OpenMine, LLCOpenMine, LLC
Just as the case for classes of things, the properties that relate classes together may also propagate.
For example, by the rules defined for rdfs:subPropertyOf we know that an individual ‘A’ who freelances to company ‘B’ also works for company ‘B’.
http://blah.org/stuff/#worksFor
http://blah.org/stuff/#contractsTo http://blah.org/stuff/#isEmployedBy
http://blah.org/stuff/#freelancesTo http://blah.org/stuff/#subContractsTo
http://www.w3c.org/2000/01/rdf-schema#subPropertyOf http://www.w3c.org/2000/01/rdf-schema#subPropertyOf
http://www.w3c.org/2000/01/rdf-schema#subPropertyOf http://www.w3c.org/2000/01/rdf-schema#subPropertyOf
Note: We’re using the full URI expression above. An equivalent expression is the corresponding ‘qname’, for example rdfs:subPropertyOf.
RDFS – Distinctions vs. Object Modeling (OOP)
OpenMine, LLCOpenMine, LLC
The construct rdfs:subPropertyOf has no analog in object-oriented programming, where properties are not first-class entities.
In OO modeling properties or attributes are never related to one another independent of the class in which they are defined. This sort of relationship can and does occur in SW applications.
Further, the SW definition for rdfs:subClassOf is only partially consistent with the definition of subclass or extension in OOP. In either case, an instance of a class may respond in the same way as instances of its super-class. However In SW classes there is no notion of an over-ride.
So how does multiple inheritance work in Semantic Web modeling? We just apply the subClassOf rule twice!
RDFS – rdfs:range and rdfs:domain
OpenMine, LLCOpenMine, LLC
Any property P can have an rdfs:domain and/or an rdfs:range. Each is defined as:
We interpret this to mean that the relation P relates values from class D to values from class R.
The domain refers to the subject of any triple that uses P as its predicate. The range refers to the object of any such triple.
If property P has domain D (or range R) we may infer that the subject (or object, if range) of the triple is in class D (or R, if range).
Unlike the case of XML Schema, RDF Schema will never flag an input as invalid. It will infer the correct type information.
P rdfs:domain D . P rdfs:range R .
RDFS – RDF Schema vs. XML Schema
OpenMine, LLCOpenMine, LLC
XML is intended as a markup language for arbitrary document structure. RDF is intended as a semantic representation language for arbitrary data.
The RDF Schema mechanism provides a basic type system for use in RDF data models.
The XML Schema mechanism provides a basic type system for use in XML documents.
XML addresses doc typing and doc structure while RDF provides a data model that can be extended to address ontology representation. Each are standards for improving machine readability.
Flame wars between the two seem misguided.
RDFS – Interaction of rdfs:subClassOf and rdfs:domain
OpenMine, LLCOpenMine, LLC
Given the above graph, if we state that some person Alice has the maiden name Jones, we can infer the following:
Further, we can infer up the rdfs:subClassOf relation and state:
We needn’t know anything more about Alice (beyond the fact that she has a maiden name) in order to make these inferences.
If we have domain or range information with regard to a predicate, we can infer additional information regarding the type of any element based solely on its use in the triple.
Woman
MarriedWomanhasMaidenNamerdfs:domain
rdfs:subClassOf
:Alice rdf:type :MarriedWoman .
:Alice rdf:type :Woman .
RDFS – Summary
OpenMine, LLCOpenMine, LLC
RDFS is the RDF schema language. It describes types of objects (classes), relates types to one another (via rdfs:subClassOf), organizes properties and the relations between them that describe other objects. (via rdfs:subPropertyOf).
Two key RDF Schema constructs are rdfs:subClassOf and rdfs:subPropertyOf.
RDF objects may be instances of one or more classes. The rdfs:subClassOf property permits the specification of an hierarchical structure for such classes. rdfs:subPropertyOf does the same for properties.
Constraints on properties can be further specified using rdfs:domain and rdfs:range constructs.
RDFS is expressed itself in RDF.
Next: OWL Full, briefly
OWL Full – The Web Ontology Language
OpenMine, LLCOpenMine, LLC
Provides a fuller and more systematic treatment of information description
Used to explicitly represent the meaning of terms in vocabularies and the relationships between those terms.
Facilitates greater machine interpretability of Web content than that supported by XML, RDF, and RDF Schema (RDFS). OWL provides additional vocabulary along with a formal semantics.
OWL Full – OWL examples not covered
OpenMine, LLCOpenMine, LLC
owl:Restriction - a fundamental building block in OWL that describes classes by restricting the values allowed for certain properties.
owl:hasValue - a type of restriction that refers to a single value for a property.
owl:someValuesFrom - a type of restriction that refers to a set from which some value for a property must come.
owl:allValuesFrom - used to produce a restriction class of the form, “the individuals for which all values of the property P come from class C.
owl:onProperty - link from a restriction to the property it restricts.
OWL Full – Using a subset at the start
OpenMine, LLCOpenMine, LLC
A complete language for making ontological statements, developed as a follow-on from RDF and RDFS.
All of OWL’s elements (classes, properties and individuals) are defined as RDF resources, and identified by URIs.
OWL provides support for representing union and intersection, enumeration of sets, differentiating individuals and groups, and cardinality.
Let’s see OWL in action using RDF-Plus
Next: RDF-Plus
RDF-Plus – A Subset of OWL
OpenMine, LLCOpenMine, LLC
As a gentle step toward OWL we consider only a subset of OWL known as RDF-Plus.
RDFS provides an important set of inference capabilities but it is limited.
RDF-Plus builds upon what is already familiar in RDFS.
The following set of constructs might be implemented using any number of a variety of inference technologies, thus lessening dependency on any specific technology or platform.
As is the case for RDFS, RDF-Plus (aka as OWL-Fast) is expressed entirely in RDF. OWL includes a number of additional resource constructs in the owl: namespace.
RDF-Plus – What part of OWL we’ll consider
OpenMine, LLCOpenMine, LLC
owl:equivalentClass – Members of each class are also members of the other.
owl:equivalentProperty – Relations that hold for each property also hold for the other.
owl:sameAs – All statements about one instance hold as well for the other.
owl:inverseOf – Allows for the exchange of subject and object.
owl:transitiveProperty – Collapses a chain of relations into one.
owl:symmetricProperty – A property that is its own inverse.
Equality
Property Characteristics
RDF-Plus – owl:equivalentClass
OpenMine, LLCOpenMine, LLC
Note: The use of owl:equivalentClass does not imply class equality. It only says that two classes have the same members. The concept of "President of the US" is related to, but not equal to the concept of the principal resident of 1600 Pennsylvania Avenue.
This OWL property has rdf:Class as both its domain and range.
Members of each class are members of the other.
<owl:Class rdf:about="#US_President"> <equivalentClass rdf:resource="#PrincipalResidentOfWhiteHouse"/></owl:Class>
:Analyst rdfs:subClassOf :Researcher . :Researcher rdfs:subClassOf :Analyst .
:Analyst owl:equivalentClass :Researcher .
RDF-Plus – owl:equivalentProperty
OpenMine, LLCOpenMine, LLC
Relations that hold for each property also hold for the other.
<owl:Class rdf:about=”#MarriedWomen"> <equivalentClass rdf:resource=”#hasMaidenName"/></owl:Class>
Note: The use of owl:equivalentProperty does not imply property equality. The property of being a married woman is related with but not equal to the property of having a maiden name.
This OWL property has rdf:Property as both its domain and range.
:borrows rdfs:subPropertyOf :checkedOut . :checkedOut rdfs:subPropertyOf :borrows . :borrows owl:equivalentProperty :checkedOut .
RDF-Plus – owl:symmetricProperty
OpenMine, LLCOpenMine, LLC
Specifies that an Attribute relation is valid in two directions.
<owl:ObjectProperty rdf:ID="adjacentRegion"> <rdf:type rdf:resource="&owl;SymmetricProperty" /> <rdfs:domain rdf:resource="#Region" /> <rdfs:range rdf:resource="#Region" /></owl:ObjectProperty>
<Region rdf:ID=”TerrebonneParishRegion"> <locatedIn rdf:resource=”#LouisianaRegion" /> <adjacentRegion rdf:resource=”#LafourcheParishRegion" /></Region>
Note: The TerrebonneParish region is adjacent to the LafourcheParish region and vice-versa. The TerrebonneParish region is located in the LouisianaRegion but not vice versa.
RDF-Plus – owl:inverseOf
OpenMine, LLCOpenMine, LLC
Allows for the exchange of subject and object.
<owl:ObjectProperty rdf:ID=”#possessedBy"> <owl:inverseOf rdf:resource="#hasPossession"/></owl:ObjectProperty>
Note: Properties generally have direction from domain to range. If we state that a person is married to another person, the inverse relation may not be necessarily implied. For a relation like ‘marriage’ it is useful to define the relation in both directions. As another example, people own cars, and cars are owned by people.
Possessed by hasPossession
owl:inverseOf owl:inverseOf owl:inverseOf . owl:inverseOf rdf:type :owl:symmetricProperty .
owl:inverseOf
Possessed by hasPossessionowl:inverseOf
RDF-Plus – owl:sameAs
OpenMine, LLCOpenMine, LLC
All statements about one instance hold equally for the other.
<rdf:Description rdf:about="#WilliamClinton"> <owl:sameAs rdf:resource="#BillClinton"/></rdf:Description>
Note: The owl:sameAs statement is often used to define mappings between ontologies. This is useful when merging data stores.
In this example we are using OWL to extend OWL.
owl:sameAs rdf:type owl:SymmetricProperty . :WilliamClinton owl:sameAs :BillClinton .
RDF-Plus – owl:transitiveProperty
OpenMine, LLCOpenMine, LLC
Collapses a chain of relations into one.
<owl:ObjectProperty rdf:ID="subRegionOf"> <rdf:type rdf:resource="&owl;TransitiveProperty"/> <rdfs:domain rdf:resource="#Region"/> <rdfs:range rdf:resource="#Region"/></owl:ObjectProperty>
Note: A transitive property can link from a Object from a special Type to another Object of the same Type – or a sublcass of this type. We can use this relation to express containment.
:LafayetteRegion owl:subRegionOf :AcadianaRegion .:AcadianaRegion owl:subRegionOf :LouisianaRegion .
:LafayetteRegion owl:subRegionOf :LouisianaRegion .
RDF-Plus – Bringing it all back home.
OpenMine, LLCOpenMine, LLC
Let’s make some Gumbo!
Very Simple Recipe for making gumbo:
- In large pot place medium size chicken and cook under low heat for 1 hour. Debone chicken meat and put aside. - Chop up one bell pepper, one large onion, one bunch celery. Cook over low fire until brown. Put aside.
- In a large flat skillet heat and slowly stir bacon fat with flour until dark brown.
- Add roux in with vegetables, garlic, thyme, seasoning. Simmer under low heat.
- Add in meat shortly before serving.
:dependsOn owl:inverseOf :enables .
RDF-Plus – Gumbo workflow triples:
OpenMine, LLCOpenMine, LLC
:boilWater wf:enables :cookChicken .:cookChicken wf:enables :deboneChicken .:cutVegetables wf:enables :cookVegetables .:heatBaconFat wf:enables :addFlour .:addFlour wf:enables :makeRoux .:makeRoux wf:enables :mixinVegetables .:addDeboneChicken wf:enables : serveGumbo .
:serveGumbo wf:dependsOn :addDeboneChicken .:makeRoux wf:dependsOn :heatBaconFat .:makeRoux wf:dependsOn :addFlour .:cookVegetables wf:dependsOn :cutVegetables .:deboneChicken wf:dependsOn :cookChicken .:cookChicken wf:dependsOn :boilWater .
Question: For any step in the process, we want to know all the steps it depends on, or all the steps that depend on it. How can we accomplish this, using the constructs we’ve already seen?
RDF-Plus – Jimmy Page’s Index Finger Revisited
OpenMine, LLCOpenMine, LLC
Subject Predicate Object Jimmy Page is part of Led Zeppelin Jimmy Page’s index finger is part of Jimmy Page
Is Jimmy Page’s index finger part of Led Zeppelin?
Index Finger
Jimmy Page
Led Zeppelin
We can resolve this by defining two versions of the ‘part of’ property in separatenamespaces. One will be a subPropertyOf the other, with the super property declared as transitive.
ns1:partOf rdfs:subPropertyOf ns2:partOf .ns2:partOf rdf:type owl:transitiveProperty .
The application can query the appropriate property depending on which interpretation of part of is required.
RDF-Plus – Gumbo dependency tree
OpenMine, LLCOpenMine, LLC
boilWater
cookChicken
deboneChicken
cutVeggies
cookVeggies
stirBaconFat
addFlour
makeRoux
mixinVeggies
addDeboneChick
serveGumbo
simmerGumbo
wf:dependsOn
wf:dependsOn wf:dependsOn
wf:enables
wf:enables
wf:enables
wf:dependsOn rdfs:subPropertyOf wf:hasPrerequisite .wf:hasPrerequisite rdf:type owl:transitiveProperty .
wf:enables rdfs:subPropertyOf wf:preRequisiteFor . wf:preRequisiteFor rdf:type owl:transitiveProperty .
We’re going to use the rdfs:subPropertyOf and owl:transitiveProperty pattern for each wf:dependsOn and wf:enables property.
We define wf:hasPrerequisite and wf:preRequisiteFor in terms of dependsOn and enables and make each super property transitive.
RDF-Plus – Mixing up RDF, RDFS and OWL
OpenMine, LLCOpenMine, LLC
owl: transitiveProperty
wf:prerequisiteFor wf:hasPrerequisite
wf:enables wf:dependsOnowl:inverseOf
rdfs:subPropertyOfrdfs:subPropertyOf
rdf:type rdf:type
Transitive Properties wf:hasPrerequisite and wf:prerequisiteFor defined in terms of wf:dependsOn and wf:enables.
RDF-Plus – Grouping gumbo dependencies
OpenMine, LLCOpenMine, LLC
boilWater
cookChicken
deboneChicken
wf:enables
wf:dependsOn
addDeboneChicken
:addDeboneChicken wf:hasPrequisite :deboneChicken ; wf:hasPrequisite :cookChicken; wf:hasPrequisite :boilWater .
cutVeggies
cookVeggies
wf:enables
mixinVegetables :mixinVegetables wf:hasPrequisite :cookVegetables ; wf:hasPrequisite :cutVegetables;
wf:dependsOn
RDF-Plus – Summary
OpenMine, LLCOpenMine, LLC
The constructs we’ve seen in RDF-Plus represent a subset of OWL. We’ve been considering OWL all along.
RDF-Plus is recommended as a primer for OWL. A lot can be accomplished with just this subset.
owl:functionalProperty, owl:inverseFunctionalProperty
owl:objectProperty, owl:datatypeProperty
Example application of a subset of OWL: FOAF
Last: Concluding remarks
SW - Data Modeling Workflow
OpenMine, LLCOpenMine, LLC
Figure out what you want to model!
Find and study related ontologies.
Create an ontology by borrowing.
Create an ‘instance’ of your ontology.
Test your ontology using test cases.
Conclusion
OpenMine, LLCOpenMine, LLC
Classes, subclasses, properties and instances have been the bread and butter of knowledge modeling for years. SW continues in this tradition.
What’s different about SW’s use of these terms and approaches? The distributed nature of the Web and other networks. The idea that information should be available.
Having the right knowledge at the right time is clearly an advantage in any endeavor.
The Web can brings significant knowledge to the user’s attention. But if that information is not represented in one place, the onus of integration rests with the user.
SW isn’t on the web; it is the web!
RDF-based apps now!
OpenMine, LLCOpenMine, LLC
Top Related