TopQuadrant TopMIND Semantic Web Technology Trainings & Workshops
© Copyright 2001-2006, TopQuadrant Inc.
The information in this presentation is proprietary to TopQuadrant and should not be duplicated, used or disclosed without permission.
“Ontology Modelingwith
TopBraid Composer™ ”
Irene Polikoff,Holger Knublauch and Dean Allemang,
TopQuadrant, Inc.
Fifth Semantic Interoperability for E-Government Conference
MITRE McLean October 11, 2006
© Copyright 2001-2006 TopQuadrant Inc., “Building Ontologies using TopBraid Composer”, slide 2
TopQuadrant
Who is TopQuadrant?
Formed 2001 First Semantic Web Consulting
Company in the US Providing:
Implementation of Semantic Web Solutions Semantic Web Tools and Platforms Training and Consulting
East Coast Office - Alexandria, VA 225 Reinekers Lane, Suite 410
Alexandria, VA 22314(724) 846-9300
West Coast Office - Mountain View, CA NASA Research Park
Building 19, Suite 2017 Moffett Field, California 94035
© Copyright 2001-2006 TopQuadrant Inc., “Building Ontologies using TopBraid Composer”, slide 3
TopQuadrant
Agenda – part 1
Set up and introductions ~ 8:30 am Quick overview of RDF, RDFS and OWL Create a simple ontology with TopBraid Composer
owl:class, owl:objectProperty, rdfs:domain, rdfs:range Convert XML files from http://www.mddl.org/default.asp
site into RDF creating an ontology of US states Work with multiple ontologies
Use imports Create bridging axioms – rdfs:subClassOf, rdfs:subPropertyOf Combine modular models to describe regions of the US
Query RDF data using SPARQL Review an ontology of French regions from
http://rdf.insee.fr/geo/ site Bring together US regions and French regions Break ~ 10:00 am
© Copyright 2001-2006 TopQuadrant Inc., “Building Ontologies using TopBraid Composer”, slide 4
TopQuadrant
Agenda – part 2
Create classes using OWL restrictions Convert the database of US zipcodes from
http://www.civicspacelabs.org/home/zipcoded web site into a triple form
Run queries in a multi-user mode against a Sesame back-end
Create a proxy ontology for RDB Use SPARQL to query relational data directly (using MySQL) Merge data from MySQL with the data in the owl files
Run SPARQL queries over merged data
Geo view and mashups Review RDFa – a standard for embedding RDF tags in HTML Experience RDFa in action Open to Q&A with Holger Knublauch ~ 11:15
SPARQL Construct queries, SWRL Rules, More?
© Copyright 2001-2006 TopQuadrant Inc., “Building Ontologies using TopBraid Composer”, slide 5
TopQuadrant
Installing and setting up TopBraid Composer
Instructions at:http://www.topbraidcomposer.com/
download.html Also at TopBraid Composer web site are:
Screencam demos Getting Started Guide Both can be found on the features page:
http://www.topbraidcomposer.com/features.html
We recommend that you go through at least some of the exercises in the Getting Started guide before following this tutorial
© Copyright 2001-2006 TopQuadrant Inc., “Building Ontologies using TopBraid Composer”, slide 6
TopQuadrant
The elementary unit in RDF is the Resource The basic thing being described in RDF Resources are generally identified by URIs Two resources are the same exactly if they have the same
URI Properties
A characteristic or attribute of a resource Properties are resources too!
RDF Basics
offers
resourceshttp://www.travel.com/hotel#Yellowstone http://www.travel.com/hotel#offers http://www.activity.com/sport#Backpacking
URI’s
YellowstoneBackpacking
© Copyright 2001-2006 TopQuadrant Inc., “Building Ontologies using TopBraid Composer”, slide 7
TopQuadrant
Triple is always a triple - schema and data are expressed as triples
Triples connect together to form graphs XML is just one way of serializing a graph
Triples connect to form graphs
rdf:type
resources
Location
owl:Thing
Yellowstone
rdfs:subClassOf
offers
Backpacking
© Copyright 2001-2006 TopQuadrant Inc., “Building Ontologies using TopBraid Composer”, slide 8
TopQuadrant
<rdfs:Class rdf:ID=“City”><rdfs:subClassOf
rdf:resource=“VacationDestination”/></rdfs:Class>
RDFS Classes
Classes are categories into which resources can be grouped
Members of classes are instances subClassOf creates a hierarchy of classes Multiple inheritance is allowed/encouraged
subClassOf
rdfs:Class
rdf:type
City
VacationDestination
Syntax
© Copyright 2001-2006 TopQuadrant Inc., “Building Ontologies using TopBraid Composer”, slide 9
TopQuadrant
Interpretation of classes as sets
Classes can be organized in a hierarchy (by subClassOf)
Direct instances of subclass are also (inferred) instances of any super classes
This reflects ordinary understanding of subclass as set inclusion
NewYorkCity
Newark
Oxford
London
© Copyright 2001-2006 TopQuadrant Inc., “Building Ontologies using TopBraid Composer”, slide 10
TopQuadrant
Properties
Domains and RangesSpecify limits on the types of objects that can be the subject
of a property and what types can be the object
<rdfs:Property rdf:ID=“hasAccomodation”> <rdfs:domain
rdf:resource=“#VacationDestination”/> <rdfs:range rdf:resource=“#Hotel”/></rdfs:Property>
Syntax
hasAccomodationrdfs:domai
nrdfs:range
VacationDestination Hotel
© Copyright 2001-2006 TopQuadrant Inc., “Building Ontologies using TopBraid Composer”, slide 11
TopQuadrant
OWL vs. RDF vs. RDFS
rdfs:subClassOf rdfs:subClassOf rdfs:subClassOf
Use RDFS to extend itself. OWL terms are defined in terms of old RDFS ones.
rdfs:Class
owl:Class owl:DatatypeProperty
rdf:Property
owl:ObjectProperty
owl:Restriction
rdfs:subClassOf
owl:SymmetricProperty
rdfs:subClassOf
…
…owl:TransitiveProperty
© Copyright 2001-2006 TopQuadrant Inc., “Building Ontologies using TopBraid Composer”, slide 12
TopQuadrant
Exercise 1
Create a folder where you will store models created during this exercise
Create a new ontology, call it geo-regions.owl Create a class Region Create two properties, inverses of each other:
hasSubregion, isSubregionOf Set domain and range of hasSubregion to be
Region Examine the source code in different
serializations Create a prefix for your namespace, call the
prefix ‘region’ Hint: Use Resources -> Navigate to Ontology menu option
© Copyright 2001-2006 TopQuadrant Inc., “Building Ontologies using TopBraid Composer”, slide 13
TopQuadrant
Re-using existing XML data
© Copyright 2001-2006 TopQuadrant Inc., “Building Ontologies using TopBraid Composer”, slide 14
TopQuadrant
Exercise 2
Convert XML file of the US states into RDF http://www.mddl.org/ext/scheme/uspsStatePossession.xml
Create a new OWL/RDF file, call it US-states.owl Create a class called ‘value’ Create two datatype properties: short and full Save and close, then open the file with the text editor
Hint: to open the file with the text editor, right click on the file in the Navigator View and select ‘Open with …’
Click on the XML file above Once it is opened in the browser, right click and select View
Source Copy and paste the XML into your RDF/OWL file
Hint: Copy everything from the first <value> tag to the last </value> tag Paste right before the </rdf:RDF> tag
Save US-states.owl file, close it and re-open with TopBraid Composer
Select value class and click on Instances view. You should see all the states as instances of the class value
Rename the class to USPostalState Create a prefix for your namespace, call the prefix states
© Copyright 2001-2006 TopQuadrant Inc., “Building Ontologies using TopBraid Composer”, slide 15
TopQuadrant
SPARQL
SPARQL is for query-based access to RDF graphs. A specification of the RDF Data Access Working Group, SPARQL is currently a W3C Candidate Recommendation.
SPARQL = Query Language + Protocol + XML Results Format
© Copyright 2001-2006 TopQuadrant Inc., “Building Ontologies using TopBraid Composer”, slide 16
TopQuadrant
SPARQL Query
PREFIX dc: <http://purl.org/dc/elements/1.1/>
SELECT ?title2WHERE{ ?doc dc:title "SPARQL at speed" . ?doc dc:creator ?c . ?docOther dc:creator ?c . ?docOther dc:title ?title2
}
• On an abstracts/papers database:“Find other papers by the authors of a given paper.
Adapted from: Andy Seaborne, “Publishing data on the Web (with SPARQL)”, Semantic and Adaptive Systems Dept., HP, 2006
© Copyright 2001-2006 TopQuadrant Inc., “Building Ontologies using TopBraid Composer”, slide 17
TopQuadrant
Exercise 3
Create new OWL/RDF file, call it US-regions.owl Using owl:import statements merge with it US-states
and geo-region models Create a SPARQL query to fetch all states with their full
names Hint: Your query may look something likeSELECT ?subject ?fullnameWHERE { ?subject states:full ?fullname } Hint: import sparql.owl found in the TBC folder (one of the libraries
you have downloaded from the web during the install process). To save your query as part of the model:
select USPostalState class, drag and drop j.0:query annotation property on to the form, copy and paste your query into the resulting widget
Create regions NorthEast, West, etc. Connect regions and states using isSubregionOf property Hint: Drag and drop into the form directly from the SPARQL results
panel
© Copyright 2001-2006 TopQuadrant Inc., “Building Ontologies using TopBraid Composer”, slide 18
TopQuadrant
© Copyright 2001-2006 TopQuadrant Inc., “Building Ontologies using TopBraid Composer”, slide 19
TopQuadrant
© Copyright 2001-2006 TopQuadrant Inc., “Building Ontologies using TopBraid Composer”, slide 20
TopQuadrant
Schema and Inference
Schema is used to derive information that was not in the given data – in this case based on the range of the property
rdf:type
isSubregionOf
rdf:type isSubregionOfrdfs:domain
rdfs:range
New York
Region Region
NorthEast
© Copyright 2001-2006 TopQuadrant Inc., “Building Ontologies using TopBraid Composer”, slide 21
TopQuadrant
Exercise 4
Create SPARQL query to get all regions that consist of other regions Hint: It may look something like:SELECT ?region ?subregion ?subnameWHERE { ?region rdf:type region:Region.?region region:hasSubregion ?subregion.?subregion states:full ?subname }
Run inferences Hint: You can invoke inferences using Inference menu
option. You can also specify the level of inferencing when you run the query using Preferences icon in the SPARQL view
Re-run the query Hint: You can see all the inferences in the Inferences view.
Additionally, when you look at any resource, information with the light blue-grey background is inferred
© Copyright 2001-2006 TopQuadrant Inc., “Building Ontologies using TopBraid Composer”, slide 22
TopQuadrant
© Copyright 2001-2006 TopQuadrant Inc., “Building Ontologies using TopBraid Composer”, slide 23
TopQuadrant
Exercise 5
Download and open ontology of France regions from http://rdf.insee.fr/geo/ Hint: When you save the owl file, you can save it directly into your
workspace directory. Refresh the folder in the workspace to see the downloaded file. To refresh right click on the folder and select Refresh.
Download RDF files for regions and departments Adjust namespaces for regions and departments file
Open the files in the text editor and modify the URL in the xml:base statement
The url should be the same as the one that is indicated by rdf:about in the rdf:Description statement – see example in the next slide
Open regions file Hint: You will get a warning statement about adding import
statement, click ‘yes’
© Copyright 2001-2006 TopQuadrant Inc., “Building Ontologies using TopBraid Composer”, slide 24
TopQuadrant
© Copyright 2001-2006 TopQuadrant Inc., “Building Ontologies using TopBraid Composer”, slide 25
TopQuadrant
Exercise 6
Create world-regions.owl Import models representing US Regions (the
one we have created in the earlier exercise) and France Regions (the one we have downloaded)
Make geo:subdivision rdf:subPropertyOf region:hasSubregion
Make geo:nom rdf:subPropertyOf states:full Re-run SPARQL query for subregions
You will now see regions from the US, we have created, as well as French regions
Open departments file Experiment with transitivity
© Copyright 2001-2006 TopQuadrant Inc., “Building Ontologies using TopBraid Composer”, slide 26
TopQuadrant
© Copyright 2001-2006 TopQuadrant Inc., “Building Ontologies using TopBraid Composer”, slide 27
TopQuadrant
Key take aways
RDF makes it easy to merge data from different sources
Often a single axiom is enough to make significant merges possible
RDFS and OWL statements are defined in terms of inferences they entail
It is not necessary to agree with (or even fully understand) an ontology created by another party to make use of it
Smaller is better - modularity is key to Re-use and Manageability
It is possible to bring in and query a new knowledge base without changing queries your application is already using
© Copyright 2001-2006 TopQuadrant Inc., “Building Ontologies using TopBraid Composer”, slide 28
TopQuadrant
A new data source: Database of zip codes
© Copyright 2001-2006 TopQuadrant Inc., “Building Ontologies using TopBraid Composer”, slide 29
TopQuadrant
Exercise 7
Create connection to Sesame database Hint: Select File -> New -> Other and then select OWL/RDFS Sesame
Repository Connection in the dialog that pops up You will need to know connection strings and password for the Sesame
repository. To use TopQuadrant’s Sesame server, specify the following:ServiceURL=http://204.15.1.11:8080/sesameRemoteUser=RemotePassword=opensesameRemoteRepositoryID=zipcodesBaseURI=http://www.owl-ontologies.com/zipCodes.owl
Once connection is established, you will be able to browse the zip code data directly from the RDF (triple) store
Sesame is a multi-user environment where multiple people could be viewing and modifying the content, but you will only have read access
Hint: You are looking at the data converted from the relational database into RDF store. You can user Composer to perform the conversion
Use the Geo view in Composer for mashups Hint: To have the Geography view show up, go to Window -> Show View ->
Other, then select Geography and click OK Select any instances of the Zipcode class and have them show up on the
map
© Copyright 2001-2006 TopQuadrant Inc., “Building Ontologies using TopBraid Composer”, slide 30
TopQuadrant
© Copyright 2001-2006 TopQuadrant Inc., “Building Ontologies using TopBraid Composer”, slide 31
TopQuadrant
Exercise 8
Download the database from the Civic Space site Hint: You will need to have MySQL running
Create proxy ontology for MySQL database Hint: Use Import -> OWL/RDFS View on Relational
Database
Query database data using SPARQL Hint: This may be a good query to try:Select ?z Where { ?z schema:zipcodes_state "NY"^^xsd:string .}
Merge data in the database with the US-regions model
© Copyright 2001-2006 TopQuadrant Inc., “Building Ontologies using TopBraid Composer”, slide 32
TopQuadrant
© Copyright 2001-2006 TopQuadrant Inc., “Building Ontologies using TopBraid Composer”, slide 33
TopQuadrant
© Copyright 2001-2006 TopQuadrant Inc., “Building Ontologies using TopBraid Composer”, slide 34
TopQuadrant
RDFa – embedding RDF in HTML pages
Web pages are a great source of data – who, what, and where is commonly shown.
Old question: How can someone reading a page reverse engineer (“scrape”) structured data from HTML?
New question: How can a page author embed structured information in a page, to make it easy to get out?
© Copyright 2001-2006 TopQuadrant Inc., “Building Ontologies using TopBraid Composer”, slide 35
TopQuadrant
<td width="1" rowspan="2" valign="top" class="bodytext"
<h3 style="BodyHeading; text-align:center; margin-top:15px"> <font face="Arial Black" size="5"
>Getting Ready for the Semantic Web</font></h3> <h3 style="BodyHeading; text-align:center"> <i>Next Classes:</i> Oct. 30 - Nov. 2, 2006 .
<td width="1" rowspan="2" valign="top" class="bodytext" about="http://www.topquadrant.com/seminars/topmind.htm#Fall06" rel="rdf:type" href="http://www.w3.org/2002/12/cal/ical#Vevent" >
<h3 style="BodyHeading; text-align:center; margin-top:15px"> <font face="Arial Black" size="5" property="cal:summary" datatype="xsd:string“ >Getting Ready for the Semantic Web</font></h3> <h3 style="BodyHeading; text-align:center"> <i>Next Classes:</i> <span property="cal:dtstart" content="20061030T0900"> Oct. 30</span> - <span property="cal:dtend" content="20061102T0500"> Nov. 2, 2006</span>.. . .
Extra markup within HTML
© Copyright 2001-2006 TopQuadrant Inc., “Building Ontologies using TopBraid Composer”, slide 36
TopQuadrant
cal:dtend
RDFa markup parses as triples
Fall06
cal:Vevent
rdf:type
“Getting Ready for the Semantic Web”^^xsd:string
cal:summary
“Oct. 30, 2006 9:00 am^^xsd:datetime
“Nov 2, 2006 5:00 pm^^xsd:datetime
cal:dtsart
© Copyright 2001-2006 TopQuadrant Inc., “Building Ontologies using TopBraid Composer”, slide 37
TopQuadrant
cal:dtsart
rdf:type
cal:dtend
Fall06
cal:Vevent
“Getting Ready for the Semantic Web”
cal:summary
“Oct. 30, 2006 9:00 am”
“Nov 2, 2006 5:00 pm”
rdf:type
cal:dtsart
:teaches
Federating info from multiple sources
cal:dtend
Spring07
“Getting Ready for the Semantic Web”
cal:summary
“Feb 12, 2007 9:00 am”
“Feb 15, 2007 5:00 pm”
Person1“Dean Allemang”
foaf:name
FEARMO
“FEA Ontology Modeling White Paper”
foaf:maker
dc:title
“1800 Diagonal Road, Alexandria, VA 22314 ”“NASA Research Park, Moffett Field, CA 94035”
TopQuadrant TopMIND Semantic Web Technology Trainings & Workshops
© Copyright 2001-2006, TopQuadrant Inc.
The information in this presentation is proprietary to TopQuadrant and should not be duplicated, used or disclosed without permission.
Questions & Answers
Holger Knublauch
E-mail: [email protected]
Irene Polikoff E-mail: [email protected]
www.topquadrant.com
(703) 960-1028
TopQuadrant TopMIND Semantic Web Technology Trainings & Workshops
© Copyright 2001-2006, TopQuadrant Inc.
The information in this presentation is proprietary to TopQuadrant and should not be duplicated, used or disclosed without permission.
TopMIND Semantic Technologies Briefings & Workshops
“Getting Ready for the Semantic Web”
TopMIND = TopQuadrant + Jim Hendler
Dean Allemang, Ph.D.
Professor Jim Hendler
Next Class Oct. 30 - Nov. 2, 2006, Washington, DC area
Brochures: at TQ Exhibit
Register: www.topquadrant.com
4-day ‘hands-on’ training in semantic web technology standards, languages, best practices … featuring
Thanks!
See you there.
© Copyright 2001-2006 TopQuadrant Inc., “Building Ontologies using TopBraid Composer”, slide 40
TopQuadrant
Announcing the first in a new Webinar Series
An Introduction to Ontology Development with TopBraid Composer™
When: Friday, November 17, 2006, 2:30pm ETRegister at: www.topbraidcomposer.com
Additional sessions will cover topics such as: Using DL-based reasoning Using rule-based reasoning Creating mash-ups and applications
© Copyright 2001-2006 TopQuadrant Inc., “Building Ontologies using TopBraid Composer”, slide 41
TopQuadrant
Where to Find Out More
Polikoff et al, “Capability Cases”, Addison-Wesley, 2005
WEB Resources CapabilityCases.org http://www.capabilitycases.org http://del.icio.us/CapabilityCases TopQuadrant Capability Cases Galleries:
http://www.topquadrant.com/topGallery/tq_topgallery.htm
TopQuadrant Reports:http://www.topquadrant.com/tq_white_papers.htm
TopQuadrant Services http://www.topquadrant.com/FPweb/
tq_service_offerings.htm