Notes in their entirety - Faculty of Computer Science

advertisement
Semantic Web Techniques
- Lecture Notes Harold Boley
Bruce Spencer
NRC-IIT Fredericton
University of New Brunswick
CS 6905 SWT
17 September 2003
Introduction to the Semantic Web
1
CS6905 Semantic Web Techniques
17-Sep-03
National Research Council
Research Institutes and Facilities across Canada
17 research institutes
4 innovation centres
3,500 employees; 1,000 guest workers
National science facilities
S&T information for industry and scientific community
CISTI: Canadian Inst. for Science and Tech
Information
Network of technology advisors supporting SME
IRAP: Industrial Research Assistance Program
2
CS6905 Semantic Web Techniques
17-Sep-03
Institute for Information Technology

There are two aspects to IIT
–
–

3
A mature research organization of ~80 people in Ottawa
New labs being developed in four cities in New
Brunswick and Nova Scotia involving ~60 new people
The whole organization is evolving to
accommodate our new distributed nature
CS6905 Semantic Web Techniques
17-Sep-03
NRC’s plans for New Brunswick

What?
–
–
NRC is building an e-business research team in New Brunswick
E-business includes e-learning, e-government, e-health.
Using information and communication technology to help us to
educate, govern and take care of ourselves, to create wealth.
–
–
–
4
New Brunswick and Canadian companies already have strengths
in all three areas
NB’s communications infrastructure and interested telco
Bilingual workforce
CS6905 Semantic Web Techniques
17-Sep-03
Bruce


MMath 83, BNR 83-86, Waterloo PhD 86-90, UNB
prof 90-01, NRC 01-now
Automated reasoning
–
–
–
–

5
data structures in theorem proving
eliminate redundant searching
smallest proofs
deductive databases
Java in curriculum since 1997
CS6905 Semantic Web Techniques
17-Sep-03
Harold
Harold joined NRC-IIT Fredericton as a research officer in Sept. 2002.
Before that, he was a senior researcher at the German Research Center
for Artificial Intelligence (DFKI), where he acted as the W3C Advisory
Committee Representative and led the EU project Clockwork on Webbased knowledge management for collaborative engineering. He also
was a senior lecturer of computer science and mathematics at the
University of Kaiserslautern, where he conceived AI-oriented XML and
RDF courses. His focus has been XML-based knowledge markup and
RDF-based Semantic Web techniques. He was a visiting researcher in
the Knowledge Modeling Group at Stanford University in 1999. Before
that, he led several government and industrial projects in knowledge
representation, compilation, and evolution. He received his PhD and
Habilitation degrees in computer science from the Universities of
Hamburg and Kaiserslautern, respectively. He developed the RelationalFunctional Markup Language (RFML) and, together with Said Tabet,
launched the Rule Markup Initiative (RuleML).
6
CS6905 Semantic Web Techniques
17-Sep-03
Overview and Course Mindmap



8
Increasing demand for
formalized knowledge
on the Web: AI’s
chance!
XML- & RDF-based
markup languages
provide a 'universal'
storage/interchange
format for such Webdistributed knowledge
representation
Course introduces
knowledge markup &
resource semantics:
we show how to marry
AI representations (e.g.,
logics and frames) with
XML & RDF [incl. RDF
Schema]
Namespaces
CSS
DTDs
XSLT
DAML
Stylesheets
Agents
RACSA
HornML
RuleML
Rules
Transformations
XML
XQL
Queries
XQuery
XML-QL
SHOE
Frames
RDF[S]
Acquisition
TopicMaps
CS6905 Semantic Web Techniques
Protégé
17-Sep-03
The Semantic Web Activity
of the W3C
“The Semantic Web is a vision: the idea of having
data on the Web defined and linked in a way that
it can be used by machines not just for display purposes,
but for
• automation,
• integration and
• reuse of data across various applications.”
(http://www.w3.org/2001/sw/Activity)
9
CS6905 Semantic Web Techniques
17-Sep-03
What your computer sees in HTML
<b>Joe’s Computer Store
</b>
<br>
365 Yearly Drive
Presentation
information
What your computer sees in XML
<location>
<name>Joe’s Computer Store
</name>
<address> 365 Yearly Drive
</address>
</location>
10
CS6905 Semantic Web Techniques
Content
description
(less ambiguous)
17-Sep-03
What a computer could understand
<mail:address xmlns:mail=“http://www.canadapost.ca”>
<mail:name>Joe’s Computer Store </mail:name>
<mail:street> 365 Yearly Drive </mail:street>
</mail:address>
www.canadapost.ca could define address, name, street, …
 Search engines could then identify mail addresses
 Consider shopbots being able to find

–

11
price, quantity, feature, model number, supplier, serial number,
acquisition date
Assumes that namespaces will be used consistently
CS6905 Semantic Web Techniques
17-Sep-03
Semantic Web
 Semantics
= meaning
 Good Idea: Dictionary
–
–
–
–
Create a dictionary of terms
Put it on the web
Mark up web pages so that terms are linked to these
dictionary-entries
This allow more precise matching
 Better
–
–
has hierarchies of terms
shades of meaning
 Best
–
12
idea: Thesaurus
idea: Ontology
hierarchy of terms and logic conditions
CS6905 Semantic Web Techniques
17-Sep-03
Semantic Web
An agent-enabled resource
 “information in machine-readable form, creating a
revolution in new applications, environments and B2B
commerce”
 W3C Activity launched Feb 9, 2001
 DAML: DARPA Agent Markup Language

–
–

OIL is Ontology Inference Layer
–

13
US Gov funding to define languages, tools
16 project teams
DAML+OIL is joint DARPA-EU
Knowledge Representation is a natural choice
CS6905 Semantic Web Techniques
17-Sep-03
14
CS6905 Semantic Web Techniques
17-Sep-03
•SmokedSalmon is the intersection
of Smoked and Salmon
Smoked Salmon
15
CS6905 Semantic Web Techniques
17-Sep-03
•SmokedSalmon is the intersection
of Smoked and Salmon
Smoked Salmon
•Gravalax is the intersection of
Cured and Salmon, but not
Smoked
Gravalax
16
CS6905 Semantic Web Techniques
17-Sep-03
•SmokedSalmon is the intersection
of Smoked and Salmon
Smoked Salmon
•Gravalax is the intersection of
Cured and Salmon, but not
Smoked
Lox
•Lox is Smoked, Cured Salmon
17
Gravalax
CS6905 Semantic Web Techniques
17-Sep-03
The Semantic Web is about having the Internet use
common sense.
18

A search for keywords
Salmon and Cured
should return pages that
mention Gravalax, even if
they don’t mention
Salmon and Cured

A search for Salmon and
Smoked will return
smoked salmon, should
also return Lox, but not
Gravalax
Smoked Salmon
Gravalax
CS6905 Semantic Web Techniques
Lox
17-Sep-03
OWL
Smoked Salmon
Lox
Gravalax
19
CS6905 Semantic Web Techniques
17-Sep-03
Tim Berners- Lee’s Semantic Web
20
CS6905 Semantic Web Techniques
17-Sep-03
RDF Resource Description Framework


21
Beginning of Knowledge Representation influence
on Web
Akin to Frames, Entity/Relationship diagrams, or
Object/Attribute/Value triples
CS6905 Semantic Web Techniques
17-Sep-03
RDF Example
<rdf:ProductSpecs about=
“http://www.lemoncomputers.ca/model_2300”>
<specs:colour>yellow</specs:colour>
<specs:size>medium</specs:size>
</rdf:ProductSpecs>
model_2300
size
medium
22
CS6905 Semantic Web Techniques
colour
yellow
17-Sep-03
RDF Class Hierarchy


All lemon laptops get
packed in cardboard
boxes
Allows one to
customize existing
taxonomies
–
Example: palmtop
computers still get
packed in boxes
is_a
lemon_palmtop_
20000
model_2300
size
medium
23
CS6905 Semantic Web Techniques
colour
yellow
17-Sep-03
Tim Berners- Lee’s Semantic Web
24
CS6905 Semantic Web Techniques
17-Sep-03
Ontology Web Language: W3C

Previously known as DAML+OIL
–
–

Composed of a hierarchy with additional conditions

Based on Description logic, limited expressivenss
–
–
25
US: DARPA Agent Markup Language
EU: Ontology Interchange Layer (Language)
Reasoning procedures are well-behaved
Just enough power
CS6905 Semantic Web Techniques
17-Sep-03
Identifying Resources

URL/URI
–
–
–
Uniform resource locator / identifier
Information sources, goods and services
financial instruments


“Where do you want to go today?”
–
26
money, options, investments, stocks, etc.
becomes “What do you want to find?”
CS6905 Semantic Web Techniques
17-Sep-03
Ontology


Branch of philosophy dealing with the theory of being
Tarski’s assumption:
–

“A common vocabulary and agreed-upon meanings to
describe a subject domain”
–
–

What real-world objects do my tags refer to?
How are these objects related?
Communication requires shared terms
–
27
individuals, relationships and functions
others can join in
CS6905 Semantic Web Techniques
17-Sep-03
Ontology Layer

Widens interoperability and interconversion
–

More meta-information
–
–

Which attributes are transitive, symmetric
Which relations between individuals are 1-1,
1-many, many-many
Communities exist
–
–
28
knowledge representation
DL, OIL, SHOE (Hendler)
New W3C working group
CS6905 Semantic Web Techniques
17-Sep-03
Transitive, Subrole example






29
One wants to ask about modes of transportation
from Sydney to Fredericton
“connected by Acadian Lines bus” is a role in a
Nova Scotia taxonomy
“connected by SMT bus” from New Brunswick
Both are subroles of “connected”
“connected” is transitive
Note that ontologies can be combined at runtime
CS6905 Semantic Web Techniques
17-Sep-03
Combining Rich Ontologies

Only these facts are
explicit
–

–

Connected by Acadian Lines
in separate ontologies
“Connected by bus”
–
Amherst
is superset
is symmetric and
transitive
Amherst
Truro
Connected by Acadian Lines
Sydney
Route from Sydney to
Fredericton is inferred
Connected by SMT Lines
Sussex
Connected by SMT Lines
Fredericton
30
CS6905 Semantic Web Techniques
17-Sep-03
Tim Berners- Lee’s Semantic Web
31
CS6905 Semantic Web Techniques
17-Sep-03
Logic Layer

Clausal logic encoded in XML
–

Special cases of first-order logic
–

–
Various implementations: SQL, KIF, SLD (Prolog), XSB
J-DREW reasoning tools in Java.
Modus operandi: build tractable reasoning systems
–
32
Horn Clauses for if-then type reasoning and integrity
constraints
Standard inference rules based on Resolution
–

RuleML, IBM CommonRules
trade away expressiveness, gain efficiency
CS6905 Semantic Web Techniques
17-Sep-03
Logic Architecture Example

Contracting parties integrate e-businesses via rules
Seller E-Storefront
Business
Rules
Buyer’s ShopBot
Contract Rules
Interchange
OPS5
33
Business
Rules
Prolog
CS6905 Semantic Web Techniques
17-Sep-03
Negotiation via rules
usualPrice:
price(per-unit, ?PO, $60) 
purchaseOrder(?PO, supplierCo, ?AnyBuyer) 
shippingDate(?PO, ?D) (?D  24April2001).
volumeDiscountPrice:
price(per-unit, ?PO, $55) 
purchaseOrder(?PO, supplierCo, ?AnyBuyer) 
quantityOrdered(?PO, ?Q) (?Q  1000) 
shippingDate(?PO, ?D) (?D  24April2001).
overrides(volumeDiscount, usualPrice).
34
CS6905 Semantic Web Techniques
17-Sep-03
Hot Research Topics:

Tools to create ontologies
–
–
–
–

Tools to learn ontologies from a large corpus such
as corporate data
–

Merging / aligning two different ontologies from different
sources on the same topic
Searching cum reasoning tools
–
35
Ontolingua
Protégé-2000 (Stanford)
OILED
…
SHOE
CS6905 Semantic Web Techniques
17-Sep-03
Eventual Goal of these Efforts

Agents locate goods, services
–
–
–
–
–

Gives rise to need of trust, privacy and security
–
36
use ontologies
unambiguous
business rules
expressive language but reasoning tractable
combine from various sources
e.g. semantic web project to determine eligibility of
patients for a clinical trial
CS6905 Semantic Web Techniques
17-Sep-03
Extensible Markup Language
37
CS6905 Semantic Web Techniques
17-Sep-03
General Advantages of XML for KR
XML offers new general possibilities, from which
AI knowledge representation (KR) can profit:
(1) Definition of self-describing data in worldwide
standardized, non-proprietary format
(2) Structured data and knowledge exchange for
enterprises in various industries
(3) Integration of information from different sources
(into uniform documents)
38
CS6905 Semantic Web Techniques
17-Sep-03
Specific Advantages of XML for KR
XML provides the most suitable infrastructure for
knowledge bases on the Web (incl. for W3C languages
such as RDF)
Additional special KR uses of XML are:
• Uniform storage of knowledge bases
• Interchange of knowledge bases between
different AI languages
• Exchange between knowledge bases and
databases, application systems, etc.
39
Even transformation/compilation of AI source programs
using XML markup and annotations is possible
CS6905 Semantic Web Techniques
17-Sep-03
Address Example: External to HTML
External Presentation:
Xaver M. Linde
Wikingerufer 7
10555 Berlin
HTML tags are still
presentation-oriented
HTML Markup:
<em>Xaver M. Linde</em>
<br>
Wikingerufer 7
<br>
<strong>10555 Berlin</strong>
40
CS6905 Semantic Web Techniques
17-Sep-03
Address Example: HTML to XML
41
HTML Markup:
While not conveying
any formal semantics:
<em>Xaver M. Linde</em>
<br>
XML tags are chosen for
Wikingerufer 7
content-structuring needs
<br>
<strong>10555 Berlin</strong>
XML Markup:
<address>
<name>Xaver M. Linde</name>
<street>Wikingerufer 7</street>
<town>10555 Berlin</town>
</address>
CS6905 Semantic Web Techniques
17-Sep-03
Address Example: XML to External
XML Markup:
<address>
<name>Xaver M. Linde</name>
<street>Wikingerufer 7</street>
<town>10555 Berlin</town>
</address>
XML stylesheets are,
e.g., usable to generate
External Presentations: different presentations
Xaver M. Linde
Xaver M. Linde
Wikingerufer 7
Wikingerufer 7
...
10555 Berlin
10555 Berlin
42
CS6905 Semantic Web Techniques
17-Sep-03
Address Example: XML to XML
XML Markup 1:
<address>
<name>Xaver M. Linde</name>
<street>Wikingerufer 7</street>
<town>10555 Berlin</town>
</address>
XML Markup 2:
43
<address>
<name>Xaver M. Linde</name>
<place>
<street>Wikingerufer 7</street>
<town>10555 Berlin</town>
</place>
</address>
CS6905 Semantic Web Techniques
XML stylesheets are
also usable to transform
XML representations
17-Sep-03
Address Example: Some Stylesheets Will
Contain Term-(Tree-)Rewriting Rules
address
name
street
town
N
S
T
address
name
N
44
place
street
town
S
T
CS6905 Semantic Web Techniques
17-Sep-03
Address Example: XML Queries
XML Markup:
e
l
e
m
e
n
t
subelements
s
<address>
<name>Xaver M. Linde</name>
<street>Wikingerufer 7</street>
<town>10555 Berlin</town>
</address>
XML Query (XML-QL):
45
WHERE
<address>
<name>Xaver M. Linde</name>
<street>$s</street>
<town>$t</town> XML queries can
</address>
select subelements
CONSTRUCT
<binding>
of XML elements
<s>$s</s>
<t>$t</t>
</binding>
CS6905 Semantic Web Techniques
<binding>
<s>Wikingerufer 7</s>
<t>10555 Berlin</t>
</binding>
17-Sep-03
Address Example: Prolog Queries
Prolog Term:
s
t
r
u
c
t
u
r
e
address( substructuress
name("Xaver M. Linde"),
street("Wikingerufer 7"),
town("10555 Berlin")
)
Prolog Query:
address(
name("Xaver M. Linde"),
street(S),
town(T)
)
46
Prolog queries can
select substructures
of Prolog structures
CS6905 Semantic Web Techniques
S = "Wikingerufer 7"
T = "10555 Berlin"
17-Sep-03
Address Example: The Element Tree
XML Markup:
e
l
e
m
e
n
t
Prolog Term:
s
<address> subelements
<name>Xaver M. Linde</name>
<street>Wikingerufer 7</street>
<town>10555 Berlin</town>
</address>
s
t
r
u
c
t
u
r
e
address( substructuress
name("Xaver M. Linde"),
street("Wikingerufer 7"),
town("10555 Berlin")
)
Node-Labeled, (Left-to-Right-)Ordered Element Tree:
tree
address
s
u
b
t
r
e
e
s
47
name
street
Xaver M. Linde
Wikingerufer 7
CS6905 Semantic Web Techniques
town
10555 Berlin
17-Sep-03
Address Example:
Document Type Definition and Tree (1)
Document Type Definition (DTD):
<!ELEMENT address
<!ELEMENT name
<!ELEMENT street
<!ELEMENT town
Extended Backus-Naur Form (EBNF):
(name, street, town) >
(#PCDATA) >
(#PCDATA) >
(#PCDATA) >
address ::= name street town
name ::= PCDATA
street ::= PCDATA
town ::= PCDATA
Document Type Tree:
address
name
PCDATA
48
street
town
PCDATA
PCDATA
CS6905 Semantic Web Techniques
17-Sep-03
Address Example:
Document Type Definition and Tree (2)
Document Type Definition (DTD):
<!ELEMENT address
<!ELEMENT place
<!ELEMENT name
<!ELEMENT street
<!ELEMENT town
(name, place) >
(street, town) >
(#PCDATA) >
(#PCDATA) >
(#PCDATA) >
Document Type Tree:
address
name
PCDATA
49
place
street
town
PCDATA
PCDATA
CS6905 Semantic Web Techniques
17-Sep-03
Well-Formedness and Validity
XML principles for a
document being wellformed:







50
Open and close all tags
Empty tags end with />
There is a unique root
element
Elements may not overlap
Attribute values are quoted
< and & are only used to
start tags and entities
Only the five predefined
entity references are used
XML principle for
a document being valid
with respect to (w.r.t.) a DTD :

Match the constraints listed
in the DTD (or, generate
from DTD as linearized
derivation tree, as shown
later)
Checked by
validators such as
http://www.stg.brown.edu/s
ervice/xmlvalid/
CS6905 Semantic Web Techniques
17-Sep-03
Mail-Box Example: Address Variant
XML Markup:
Prolog Term:
<address>
<name>Xaver M. Linde</name>
<box>2001</box>
<town>10555 Berlin</town>
</address>
address(
name("Xaver M. Linde"),
box("2001"),
town("10555 Berlin")
)
Node-Labeled, (Left-to-Right-)Ordered Element Tree:
address
51
name
box
town
Xaver M. Linde
2001
10555 Berlin
CS6905 Semantic Web Techniques
17-Sep-03
"|"-Disjoined Street/Mail-Box Example:
Document Type Definition and Tree
Document Type Definition (DTD):
<!ELEMENT address
<!ELEMENT name
<!ELEMENT street
<!ELEMENT box
<!ELEMENT town
(name, (street | box), town) >
(#PCDATA) >
(#PCDATA) >
"|": Choice
(#PCDATA) >
The above box address
(#PCDATA) >
and the original street
address are valid w.r.t.
this "|"-DTD
Document Type Tree:
address
name
PCDATA
52
street
PCDATA
box
PCDATA
CS6905 Semantic Web Techniques
town
PCDATA
17-Sep-03
Phone & Fax Example: Address Variant
XML Markup:
Prolog Term:
<address>
<name>Xaver M. Linde</name>
<street>Wikingerufer 7</street>
<town>10555 Berlin</town>
<phone>030/1234567</phone>
<phone>030/1234568</phone>
<fax>030/1234569</fax>
</address>
address(
name("Xaver M. Linde"),
street("Wikingerufer 7"),
town("10555 Berlin"),
phone("030/1234567"),
phone("030/1234568"),
fax("030/1234569")
)
Node-Labeled, (Left-to-Right-)Ordered Element Tree:
address
name
street
town
phone
phone
fax
Xaver M. Linde Wikingerufer 7 10555 Berlin 030/1234567 030/1234568 030/1234569
53
CS6905 Semantic Web Techniques
17-Sep-03
"+"/"*"-Repetitive-Phone & -Fax Example:
Document Type Definition and Tree
Document Type Definition (DTD):
<!ELEMENT address
<!ELEMENT name
<!ELEMENT street
<!ELEMENT town
<!ELEMENT phone
<!ELEMENT fax
(name, street, town, phone+, fax*) >
(#PCDATA) >
(#PCDATA) > "+"/"*": One/Zero or More
(#PCDATA) > The above two-phone/one-fax
(#PCDATA) > address is valid w.r.t. this
(#PCDATA) >
"+"/"*"-DTD but the
original no-phone/no-fax
address is not (1 phone!)
Document Type Tree:
address
name
PCDATA
54
street
town
phone
PCDATA
PCDATA
PCDATA
CS6905 Semantic Web Techniques
fax
PCDATA
17-Sep-03
Country Example: Address Variant
Prolog Term:
XML Markup:
<address>
<name>Xaver M. Linde</name>
<street>Wikingerufer 7</street>
<town>10555 Berlin</town>
<country>Germany</country>
</address>
address(
name("Xaver M. Linde"),
street("Wikingerufer 7"),
town("10555 Berlin"),
country("Germany")
)
Node-Labeled, (Left-to-Right-)Ordered Element Tree:
address
name
street
Xaver M. Linde
55
Wikingerufer 7
town
country
10555 Berlin
Germany
CS6905 Semantic Web Techniques
17-Sep-03
"?"-Optional-Country Example:
Document Type Definition and Tree
Document Type Definition (DTD):
<!ELEMENT address
<!ELEMENT name
<!ELEMENT street
<!ELEMENT town
<!ELEMENT country
(name, street, town, country?) >
(#PCDATA) >
"?": One or Zero
(#PCDATA) >
The above country
(#PCDATA) >
(#PCDATA) >
address and the
original countriless
address are valid w.r.t.
this "?"-DTD
Document Type Tree:
address
name
PCDATA
56
street
town
country
PCDATA
PCDATA
PCDATA
CS6905 Semantic Web Techniques
17-Sep-03
Country Address: A Complete XML
Document Referring to an External DTD
XML Document (just ASCII, e.g. stored in a file):
<?xml version="1.0" standalone="no"?>
<!DOCTYPE address SYSTEM "country-address.dtd">
<address>
<name>Xaver M. Linde</name>
<street>Wikingerufer 7</street>
<town>10555 Berlin</town>
<country>Germany</country>
</address>
The XML declaration uses standalone attribute with "no" value: DTD import
57
The DOCument TYPE declaration names the root element address and, after
the SYSTEM keyword, refers to an external DTD "country-address.dtd"
(or, at some absolute URL, to an "http://www.test.org/country-address.dtd")
CS6905 Semantic Web Techniques
17-Sep-03
Horn Logic Markup Languages
58
CS6905 Semantic Web Techniques
17-Sep-03
Herbrand Terms: Individual Constants,
Variables, Flat Ground Structures, ...
Representation of Herbrand terms in XML as <ind> and
<struc> elements (<var> similar):

Individual constant for channel-tunnel between Britain and
France: element <ind>channel-tunnel</ind>

Ground structure
undersea-connection(britain,france)
is <struc> element with embedded element for constructor,
followed by elements for argument terms:
59
<struc>
<constructor>undersea-connection</constructor>
<ind>britain</ind>
<ind>france</ind>
</struc>
CS6905 Semantic Web Techniques
17-Sep-03
Herbrand Terms: ...,
Nested Ground Structures
60
<struc>
Embedded <struc> <constructor>service-tunnel</constructor>
<struc>
elements:
<constructor>undersea-connection</constructor>
<ind>britain</ind>
service-tunnel(
undersea-connection( <struc>
<constructor>surrounded-country</constructor>
britain,
<ind>belgium</ind>
surrounded-country( <ind>luxembourg</ind>
belgium,
<ind>germany</ind>
<ind>switzerland</ind>
luxembourg,
<ind>italy</ind>
germany,
<ind>spain</ind>
switzerland,
</struc>
italy,
</struc>
spain)))
</struc>
CS6905 Semantic Web Techniques
17-Sep-03
Interim Discussion: Tag and Type
61

In Prolog not clear, in isolation, that channel-tunnel is
individual constant, whereas service-tunnel is constructor

In XML, as in strongly typed LP languages, made explicit however at every occurrence of a symbol

Example gives impression of self-description advantage - but
also ‘space requirement’ - of this generous application of
“syntactic sugar”
CS6905 Semantic Web Techniques
17-Sep-03
Horn Clauses: Relation Symbol
Applications
Predicate or relation symbol in XML is <relator> element.
For example, relation symbol travel is
<relator>travel</relator>
Relation symbol application to terms is labeled with
<relationship> element.
Application travel(john,channel-tunnel)
on two individual constants thus is
62
<relationship>
<relator>travel</relator>
<ind>john</ind>
<ind>channel-tunnel</ind>
</relationship>
CS6905 Semantic Web Techniques
17-Sep-03
Horn Clauses: Facts
Hence, Horn fact can be asserted as <hn> element that
possesses <relationship> elements as subelements
In the example, the Prolog fact
travel(john,channel-tunnel).
becomes
63
<hn>
<relationship>
<relator>travel</relator>
<ind>john</ind>
<ind>channel-tunnel</ind>
</relationship>
</hn>
CS6905 Semantic Web Techniques
17-Sep-03
Horn Clauses: Rules
Then, Horn rule is asserted as <hn> Element that has a
head <relationship> element followed by at least one
body <relationship> element
So, above example generalized to Prolog rule
64
travel(Someone,channel-tunnel) :- carry(eurostar,Someone).
and rewritten as
<hn>
<relationship>
<relator>travel</relator>
<var>someone</var>
<ind>channel-tunnel</ind>
</relationship>
<relationship>
<relator>carry</relator>
<ind>eurostar</ind>
<var>someone</var>
</relationship>
</hn>
CS6905 Semantic Web Techniques
17-Sep-03
Attributes for Extended Logics
Nested elements - trees - allow representation of
arbitrary information, but in some situations lead
to unnecessarily deeply/widely nested representations
Therefore XML attributes:
Start-Tag is ‘attributed’ with n attribute-value pairs ai=vi
Element: <tag a1=v1 ... an=vn> . . . </tag>
Helpful Prolog uses of XML attributes are arity labelings of
relation symbols such as our binary relation symbol travel:
Prolog’s travel/2 in XML with an arity attribute becomes
<relator arity="2">travel</relator>
65
Analogously, annotations become possible on arbitrary
element levels: mode declarations for logic variables,
determinism specifications for clauses or procedures,
and context conditions for entire knowledge bases
CS6905 Semantic Web Techniques
17-Sep-03
ID and IDREF
Attribute types ID and IDREF for naming and
referencing of elements
ID-typed value must uniquely identify an element
and IDREF-typed value must occur as ID value of
an element
E.g., clause can be named (in a hypothesis knowledge base):
66
<hn id="john-channel">
<relationship>
<relator>travel</relator>
<ind>john</ind>
<ind>channel-tunnel</ind>
</relationship>
</hn>
CS6905 Semantic Web Techniques
17-Sep-03
ID and IDREF
67
Now a “modal Prolog fact”
belief(mary,travel(john,channel-tunnel)).
can access the "john-channel" assertion:
<hn>
<relationship>
<relator>belief</relator>
<ind>mary</ind>
<prop idref="john-channel"/>
</relationship>
</hn>
Propositional argument of the belief operator written as
<prop idref="john-channel"/> (XML abbreviation of
empty elements <tag ...> </tag> to <tag .../>)
Also disbelief fact has "john-channel" access with
idref: ID/IDREF “break out of the tree” and enable
‘sharing’
CS6905 Semantic Web Techniques
17-Sep-03
DTDs: Elements as Derivation Trees
Up to now:
Now:
Examples for Horn Logic in XML etc.
General language definition
XML's Document type definitions (DTDs) initially only as
ELEMENT declarations for non-attributed elements
For nonterminals: DTD  ordinary context-free grammar
in modified (EBNF) notation
For terminals: Usually arbitrary permutations of the base
alphabet ("PCDATA'') instead of fixed terminal sequences
DTD grammar derives context-free word patterns:
derivation trees themselves - linearized through brackets as generated result
XML element is valid with respect to DTD:
can be generated from DTD as linearized derivation tree
68
CS6905 Semantic Web Techniques
17-Sep-03
DTDs: Defining Horn Logic in XML
Syntactic ELEMENT declaration of Horn logic as a
knowledge base (kb) of zero or more Horn clauses (hn*):
<!ELEMENT kb
(hn*) >
<!ELEMENT hn
(relationship, relationship*) >
<!ELEMENT relationship (relator, (ind | var | struc)*) >
<!ELEMENT struc
(constructor, (ind | var | struc)*) >
<!ELEMENT relator
(#PCDATA) >
<!ELEMENT constructor (#PCDATA) >
69
<!ELEMENT ind
(#PCDATA) >
<!ELEMENT var
(#PCDATA) >
CS6905 Semantic Web Techniques
Note
struc recursion!
17-Sep-03
DTDs:
Generation of the Example Rule (1)
(Start-)symbol kb brackets derived clause(s) as linearized
start-tag/end-tag-tree representation <kb> . . . </kb>:
kb
70
<kb> hn* </kb>
. . .
<kb> <hn> relationship relationship </hn> </kb>
. . .
<kb>
<hn>
<relationship>
<relator>#PCDATA</relator> <var>#PCDATA</var> <ind>#PCDATA</ind>
</relationship>
<relationship>
<relator>#PCDATA</relator> <ind>#PCDATA</ind> <var>#PCDATA</var>
</relationship>
</hn>
</kb>
CS6905 Semantic Web Techniques
17-Sep-03
DTDs:
Generation of the Example Rule (2)
71
<kb>
<hn>
<relationship>
<relator>travel</relator>
<var>someone</var>
<ind>channel-tunnel</ind>
</relationship>
<relationship>
<relator>carry</relator>
<ind>eurostar</ind>
<var>someone</var>
</relationship>
</hn>
</kb>
CS6905 Semantic Web Techniques
17-Sep-03
Attribute DTDs (1)
DTDs for attributed elements: ATTLIST declarations, which
associate element name with an attribute name plus attribute type
and possible occurrence indication
1st Example: declare the relator attribute arity as CDATA-typed
(cf. #PCDATA) and occurring optionally (#IMPLIED):
<!ATTLIST relator arity CDATA #IMPLIED >
2nd Example (Preparation): define the extended Horn logic
with (named hn clauses and) embedded propositions:
<!ELEMENT relationship (relator, (ind|var|struc|prop)*) >
72
<!ELEMENT prop EMPTY >
CS6905 Semantic Web Techniques
17-Sep-03
Attribute DTDs (2)
2nd Example (Execution): Append an ATTLIST declaration that
specifies, for the hn respectively prop elements, the attributes
id - as optional ID type - respectively
idref - as mandatory IDREF type:
<!ATTLIST hn
id
ID
#IMPLIED >
<!ATTLIST prop
idref IDREF #REQUIRED >
With entire DTD now, e.g., earlier "john-channel"-named fact and
its accessing facts can be generated
73
CS6905 Semantic Web Techniques
17-Sep-03
Horn Queries in XML Notation
74
Assume fact:
<hn>
<relationship>
<relator>carry</relator>
<ind>eurostar</ind>
carry(eurostar,fred).
<ind>fred</ind>
</relationship>
</hn>
A Horn-logic interpreter can use it to answer this query:
<relationship>
<relator>carry</relator>
<ind>eurostar</ind>
carry(eurostar,Someone)
<var>someone</var>
</relationship>
by binding
<var>someone</var>
Someone
to
<ind>fred</ind>
fred
CS6905 Semantic Web Techniques
17-Sep-03
Horn Inferences in XML Notation (1)
With carry basis fact
carry(eurostar,fred).
a rule is usable to dynamically derive travel assertions as
needed, without having to store them all-inclusively and
statically:
travel(Someone,channel-tunnel) :- carry(eurostar,Someone).
That is, its earlier XML version is useable by a Horn-logic
interpreter for inferential queries like
Someone=fred
travel(fred,Where)  carry(eurostar,Someone)  true
Where=channel-tunnel
75
CS6905 Semantic Web Techniques
Where=channel-tunnel
17-Sep-03
Horn Inferences in XML Notation (2)
Rule:
<hn>
<relationship>
<relator>travel</relator>
<var>someone</var>
<ind>channel-tunnel</ind>
</relationship>
<relationship>
<relator>carry</relator>
<ind>eurostar</ind>
<var>someone</var>
</relationship>
</hn>
Fact:
<hn>
<relationship>
<relator>carry</relator>
<ind>eurostar</ind>
<ind>fred</ind>
</relationship>
</hn>
3-Step Animation:
<relationship>
<relationship someone="fred" where="channel-tunnel">
<ind
where="channel-tunnel">
<relator>travel</relator>
<relator>carry</relator>
true
<ind>fred</ind>
<ind>eurostar</ind>
</ind>
<var>where</var>
<var>someone</var>
</relationship>
76
CS6905 Semantic Web Techniques
17-Sep-03
Horn Inferences in XML Notation (2)
Rule:
<hn>
<relationship>
<relator>travel</relator>
<var>someone</var>
<ind>channel-tunnel</ind>
</relationship>
<relationship>
<relator>carry</relator>
<ind>eurostar</ind>
<var>someone</var>
</relationship>
</hn>
Fact:
<hn>
<relationship>
<relator>carry</relator>
<ind>eurostar</ind>
<ind>fred</ind>
</relationship>
</hn>
3-Step Animation:
<relationship>
<relator>travel</relator>
<ind>fred</ind>
<var>where</var>
</relationship>
77
CS6905 Semantic Web Techniques
17-Sep-03
Horn Inferences in XML Notation (2)
Rule:
<hn>
<relationship>
<relator>travel</relator>
<var>someone</var>
<ind>channel-tunnel</ind>
</relationship>
<relationship>
<relator>carry</relator>
<ind>eurostar</ind>
<var>someone</var>
</relationship>
</hn>
Fact:
<hn>
<relationship>
<relator>carry</relator>
<ind>eurostar</ind>
<ind>fred</ind>
</relationship>
</hn>
3-Step Animation:
<relationship someone="fred" where="channel-tunnel">
<relator>carry</relator>
<ind>eurostar</ind>
<var>someone</var>
</relationship>
78
CS6905 Semantic Web Techniques
17-Sep-03
Horn Inferences in XML Notation (2)
Rule:
<hn>
<relationship>
<relator>travel</relator>
<var>someone</var>
<ind>channel-tunnel</ind>
</relationship>
<relationship>
<relator>carry</relator>
<ind>eurostar</ind>
<var>someone</var>
</relationship>
</hn>
Fact:
<hn>
<relationship>
<relator>carry</relator>
<ind>eurostar</ind>
<ind>fred</ind>
</relationship>
</hn>
3-Step Animation:
<ind where="channel-tunnel">
true
</ind>
79
CS6905 Semantic Web Techniques
17-Sep-03
Horn Inferences: SLD-Resolution,
XML-QL Implementation, Open World
• This inference is carried out as an SLD-resolution step
• The procedural semantics of SLD-resolution can be used
• An XML-QL implementation seems possible as for queries
• A functional-logic generalization of HornML is RFML
If distribution of the clauses over different documents in the
Web is assumed, in this “open world” logical completeness,
in particular, can hardly still be asked for
80
CS6905 Semantic Web Techniques
17-Sep-03
The Java Deductive Reasoning Engine
for the Web
81
CS6905 Semantic Web Techniques
17-Sep-03
Train people to build the Rule-based
web services

Courses on systems employing rule engines
and Internet applications
–
–
–
–

Meier and Warren’s book: Programming in
Logic, 1988
–
–
82
Writing deduction engines in Java/C/C++
Interfacing with Internet API
Old techniques (Prolog 30 years ago)
New techniques from CADE System Competition
Updated in Java?
Specific to Prolog at low level
CS6905 Semantic Web Techniques
17-Sep-03
Will such a course work?
 No
–
–
Guts of Prolog, Internet API’s, how to program in logic
At least three courses here
 Yes
–
–
Students understand recursion
How to build a tree
how to search a space

–
83
Propositional theorem prover
how to interface to Internet
CS6905 Semantic Web Techniques
17-Sep-03
This talk
 Architecture
–
–
first order
easily configured

–
–
–
–
–
–
84
forward or backward
embedded
supports calls to and from rest of system
 Tour
–
for building deduction systems
of internals
backward & forward engines
tree/proof
terms
bindings
discrimination tree
 Prototypes
CS6905 Semantic Web Techniques
17-Sep-03
Choose the right abstractions


Goal, Unifier, ProofTree
use Java iterators: pay as you go
–

Make every Goal responsible for its list of
matching clauses
–
–

hasNextMatchingClause()
attachNextMatchingClause()
Place Goals in stack of backtrack points
–
85
for finding the next proof
popped in reverse chronological order
CS6905 Semantic Web Techniques
17-Sep-03
Propositional Prover
initially proofTree has an open Goal
loop
if(proofTree.hasNoOpenGoal())
halt('success');
else
Goal g = proofTree.selectOpenGoal();
g.createMatchingClauseList();
if(g.hasMoreMatchingClauses())
DefiniteClause c = g.nextClause();
g.attachClause(c);
choicePoints.push(g);
else
chronologicalBacktrack();
chronologicalBacktrack
while(choicePoints.nonEmpty())
Goal g = choicePoints.pop();
g.removeAttachedClause();
if(g.hasMoreClauses())
return;
halt('failure')
Remove bindings
Create
bindings
Java Iterator
88
CS6905 Semantic Web Techniques
17-Sep-03
Tree with initial goal p(Z)
p(X) :- q(X), r(X).
q(g(X)).
q(k).
r(g(h))
a
?:-p(Z)
p(Y1) :- q(Y1), r(Y1)
c
b
b’
q(g(Y2))
r(g(h))
q(k)
ChoicePoints
c
b
b’ Y1/k
Y1/g(Y2)
a
89
CS6905 Semantic Web Techniques
Y2/h
Z/Y1
17-Sep-03
Moving to First Order Logic

Students struggle with variables
–
–
–

Can we hide the hard stuff?
–
90
Unification
Composition of substitutions
Unbinding on backtracking
Powerful abstraction
CS6905 Semantic Web Techniques
17-Sep-03
Shallow or deep variables?
 Deep
–
–
–
variable binding is a list of replacements
traverse list for each lookup
undoing: remove most recent replacements
{X  f(Y)}  {Y  a}
 Shallow
–
–
92
an array of (all) variables and their current values
[X  f(a)
Ya
…]
undoing: pop stack of previous values (trail)
CS6905 Semantic Web Techniques
17-Sep-03
Goal Tree and flatterms
N
p


Each node has head and
body atoms
Body atoms form goals
–


94
attach children
resolved p1 from
d  p1, …, pm
against q from
q  q1, …, qn
resolved pm against r .
C
p1
pm
D
q
q1
CS6905 Semantic Web Techniques
r
qn
17-Sep-03
Flatterms to represent atoms

j-DREW uses flatterms
–
Array of pairs:


–


95
symbol table ref
length of subterm
Not structure sharing
Flatterms save theorem
provers time and space
(de Nivelle, 1999)
Data transfer between
deduction engine and
rest of application
CS6905 Semantic Web Techniques
17-Sep-03
Variables are clause-specific
Variables use
negative
indexes
 Bindings are
references to
flatterm &
position


96
Unifier
X  g2
Y  f(g2)
W  h(g2)
Z  f(g2)
CS6905 Semantic Web Techniques
17-Sep-03
Composing and undoing Bindings

Local shallow bindings currently do not allow
composition
–
–

Backtracking is integrated with unbinding
–
97
bindings must be done to a flatterm
new binding on a new flatterm
for quick unbinding, we use a stack of flatterms for
each goal.
CS6905 Semantic Web Techniques
17-Sep-03
Discrimination trees


Given a goal we want to access matching clauses
quickly
Every-argument addressing
–

Useful for RDF triples
–
–
99
unlike Prolog’s first argument addressing
a pattern may have variable in first argument
rdf(X, ownedby, ‘Ora Lassila’)
CS6905 Semantic Web Techniques
17-Sep-03
Discrimination trees



Given a goal, want to access
input clauses with matching
heads quickly
Index into clauses via a
structure built from heads
Replace vars by *
–

merge prefixes as much as
possible
• We added
–
100
imperfect discrimination
a tree arises
p
r
f
g1
h
h
*
g2
h
g1
*
p(f(g1 ),h(g2 ),g1 )
p(f(h( X)),h(Y),f(Z, Z))
CS6905 Semantic Web Techniques
q
f
*
*
17-Sep-03
Finding heads for goal p(X,h(g2),Y)

replace vars in goal by *
–

p
* in goal, skip subtree
• Find generalizations of goal
–* in tree, skip term in goal
g1
h
h
*
g2
h
g1
*
f
•Find unifiable
–combination of both
101
r
f
p(*,h(g2),*)
Find instances of goal
–
q
*
p(f(g1 ),h(g2 ),g1 )
p(f(h( X)),h(Y),f(Z, Z))
CS6905 Semantic Web Techniques
17-Sep-03
Iterator for matching clauses


We use Java idioms where possible
Java’s iterators give access to sequence
–
–

Used for access to sequence of matching clauses
–
102
next()
hasNext()
used in discrimination tree for access to roots leaves of
skipped tree
(McCune’s term: jump-list)
CS6905 Semantic Web Techniques
17-Sep-03
103
CS6905 Semantic Web Techniques
17-Sep-03
•SmokedSalmon is the intersection
of Smoked and Salmon
Smoked Salmon
104
CS6905 Semantic Web Techniques
17-Sep-03
•SmokedSalmon is the intersection
of Smoked and Salmon
Smoked Salmon
•Gravalax is the intersection of
Cured and Salmon, but not
Smoked
Gravalax
105
CS6905 Semantic Web Techniques
17-Sep-03
•SmokedSalmon is the intersection
of Smoked and Salmon
Smoked Salmon
•Gravalax is the intersection of
Cured and Salmon, but not
Smoked
Lox
•Lox is Smoked, Cured Salmon
106
Gravalax
CS6905 Semantic Web Techniques
17-Sep-03

A search for keywords
Salmon and Cured should
return pages that mention
Gravalax, even if they don’t
mention Salmon and Cured

A search for Salmon and
Smoked will return pages
with smoked salmon, should
also return pages with Lox,
but not Gravalax
Smoked Salmon
Lox
Gravalax
The Semantic Web vision is to make information on
the web “understood” by computers, for searching,
categorizing, …
107
CS6905 Semantic Web Techniques
17-Sep-03
Smoked Salmon
Lox
Gravalax
108
CS6905 Semantic Web Techniques
17-Sep-03
One possible encoding
Search criteria:
retrieve(P) :about(P, cured),
about(P, salmon).
Ontology:
about(P, cured) :about(P, gravalax).
about(P, salmon) :about(P, gravalax).
109
A search for keywords
Salmon and Cured
should return pages
that mention Gravalax,
even if they don’t
mention Salmon and
Cured.
about(p1, gravalax).
retrieve(p1) succeeds
CS6905 Semantic Web Techniques
17-Sep-03
retrieve(P) :about(P, smoked),
about(P, salmon).
110
about(P, cured) :about(P, lox).
about(P, salmon) :about(P, lox).
about(P, smoked) :about(P, lox).
about(P, cured) :about(P, gravalax).
about(P, salmon) :about(P, gravalax).
A search for Salmon
and Smoked will
return pages with
smoked salmon,
should also return
pages with Lox, but
not Gravalax.
about(p1, gravalax).
about(p2, lox).
retrieve(p1) fails
retrieve(p2) succeeds
CS6905 Semantic Web Techniques
17-Sep-03
Working Prototypes:

Basic Prolog Engine
–
–
–
–
Accepts RuleML, or Prolog, or mixture
Iterator for instances of the top goal
Main loop is same code as propositional theorem prover
(shown earlier)
Builds, displays deduction tree

–
111
available to rest of system
Negation as failure
CS6905 Semantic Web Techniques
17-Sep-03
More working prototypes:
Variants of Top-Down Engine

User directed
–
–
User selects goals
User chooses clauses

–

–
–
iteratively increase bound
every resolution in search space will eventually be tried
a fair selection strategy
Original variable names supplied
–
112
Good teaching tool
Bounded search
–

keeps track of clauses still left to try
particularly important for RuleML
CS6905 Semantic Web Techniques
17-Sep-03
Bottom-Up / Forward Chaining



Set of support prover for definite clauses
Facts are supports
Theorem: Completeness preserved when
definite clause resolutions are only between
first negative literal and fact.
–


116
Proof: completeness of lock resolution (Boyer’s PhD)
Use standard search procedure to reduce
redundant checking (next)
Unlike OPS/Rete, returns proofs and uses first
order syntax for atoms
CS6905 Semantic Web Techniques
17-Sep-03
Theorem Prover’s Search Procedure
 Priority
–
queue
new facts
 Discrimination
trees:
–
–
117
used facts
rules, indexed on
first goal
main loop
select new fact
for each matching rule
resolve
process new result
add to old facts
process new result(C)
if C is rule
for each old fact matching first goal
resolve
process new result
add C to rules
else
add C to new facts
CS6905 Semantic Web Techniques
17-Sep-03
Event – Condition - Action

Suppose theorem prover saturates
–
–
may need datalog, subsumption
Then a new fact is added from


–
adding a fact restarts saturation


118
push process
Java event listener
could generate new Java events
ECA interaction with Java 1.1 events
CS6905 Semantic Web Techniques
17-Sep-03
j-DREW sound and complete


Sound unification
Search complete variant
–
–

Sound negation
–
–
119
fair search procedure rather than depth-first
uses increasing bounds
delay negation-as-failure subgoals
until ground or until only NAF goals remain
CS6905 Semantic Web Techniques
17-Sep-03
Related Work

j-DREW compared to Prolog
–
–
j-DREW not compiled
More flexible



–
Performance requirements different

120
Dynamic additions
Web-ized
Programmer’s API
j-DREW unlikely to yield megalips
CS6905 Semantic Web Techniques
17-Sep-03
Summary
 Architecture
–
forward & backward
 Backward:
–
–
for Java-based reasoning engines
variable binding/unbinding automatic
tied with choicepoints
configurable
 Integrated
with other Java APIs
 Small footprint
–
Depolyed as thread, on server, on client, mobile
 Dynamic
–
Integration of RuleML and Prolog rules in same proofs
 Proofs
122
additions to rules
available
CS6905 Semantic Web Techniques
17-Sep-03
The Rule Markup Language
123
CS6905 Semantic Web Techniques
17-Sep-03
Motivation (I)

Rules in (and for) the Web have become a
mainstream topic since
–
inference rules were


–
marked up for E-Business
identified as a Design Issue of the Semantic Web
transformation rules were used for document
generation from central XML repository
• Rule interchange is becoming more important in
Knowledge Representation (KR), especially in
– Intelligent Agents
– Web Services
124
CS6905 Semantic Web Techniques
17-Sep-03
Motivation (II)

The Rule Markup Initiative has taken initial steps towards
defining a shared Rule Markup Language (RuleML) for
interoperation between the currently 34 Participant Groups
around the world

125
RuleML permits rules in XML & RDF/DAML+OIL for
–
derivation, query, transformation (stable DTDs/Schemas)
–
integrity checking (still regarded as special queries)
–
reactive behavior (currently as translators to, e.g., Jess)
CS6905 Semantic Web Techniques
17-Sep-03
Semantic Web and Web Services
Use Databases and Rule Systems
126
Semantic Web: DAML+OIL
Web Services : WSDL
Category-Based Search Engines
& Document Retrieval
Mediator Agents
& Information Integration
Formal Ontologies
& Metadata Repositories
Interface Descriptions
& CGI Scripts
First-Order Logic
& Knowledge Representation
Communication Protocols
& Remote Procedure Calls
Databases: SQL
Rule Systems: RuleML
(Integration of) Schemas & Dictionaries
Derivation Rules
(Distributed) Transaction Processing
Transformation Rules
Triggers & Events
Reaction Rules
CS6905 Semantic Web Techniques
17-Sep-03
Rule Systems for
Web-Based B2C or B2B Rule Exchange
Merchant1
Merchantm
...
publish
rulebase1
translate to
standard format
(e.g., RuleML)
publish
rulebasem
compare, instantiate,
and run rulebases
Customer or Company
127
CS6905 Semantic Web Techniques
17-Sep-03
From Natural Language to Horn Logic
English Business Rules:
''The discount for a customer buying a product is 5.0
percent
if''The
the discount
customer is
andbuying
the product
is regular.''
forpremium
a customer
a product
is 7.5
percent
.if .the
. customer is premium and the product is luxury.''
Prolog-like formalization (syntax generated from XML):
128
CS6905 Semantic Web Techniques
17-Sep-03
RuleML: Markup and Tree
''The discount for a customer buying a product is 5.0
percent
<imp>if the customer is premium and
impthe product is regular.''
129
<_head>
head
<atom>
<_opr><rel>discount</rel></_opr>
<var>customer</var>
<var>product</var>
<ind>5.0 percent</ind>
</atom>
</_head>
<_body>
body
<and>
<atom>
<_opr><rel>premium</rel></_opr>
<var>customer</var>
</atom>
<atom>
<_opr><rel>regular</rel></_opr>
<var>product</var>
</atom>
</and>
</_body>
</imp>
CS6905 Semantic Web Techniques
atom
opr
rel
var
var
ind
and
atom
opr
atom
opr
discount
customer
product
5.0 percent
rel
var
premium
customer
rel
var
regular
product
17-Sep-03
Intertranslating RuleML and RFML
''The discount for a customer buying a product is 5.0
percent
<imp>
<hn>
if the customer is premium and the product
is regular.''
130
<_head>
<atom>
<pattop>
<_opr><rel>discount</rel></_opr>
<con>discount</con>
<var>customer</var>
<var>customer</var>
<var>product</var>
<var>product</var>
<ind>5.0 percent</ind>
<con>5.0 percent</con>
</atom>
</pattop>
ruleml2rfml.xsl
</_head>
<_body>
<and>
rfml2ruleml.xsl
<atom>
<callop>
<_opr><rel>premium</rel></_opr>
<con>premium</con>
<var>customer</var>
<var>customer</var>
</atom>
</callop>
<atom>
<callop>
<_opr><rel>regular</rel></_opr>
<con>regular</con>
<var>product</var>
<var>product</var>
</atom>
</callop>
</and>
</_body>
CS6905 Semantic Web Techniques </hn>
</imp>
17-Sep-03
Structure of the RuleML DTD Hierarchy



Our system of DTDs (current version: 0.8) uses a
modularization approach similar to XHTML in order
to accomodate the various rule subcommunities
The evolving hierarchy of RuleML DTDs forms
a partial order with ruleml as the greatest element
(a ruleml-rooted DAG) -- many ‘smallest’ elements
Each DTD node in the hierarchy (conformance
“lattice”) corresponds to a specific RuleML
sublanguage:
–
–
131
‘Union’ (join) of sublanguages reached via outgoing links:
to smaller or equal nodes below
‘Intersection’ (meet) of sublanguages via incoming links:
from greater or equal nodes above
CS6905 Semantic Web Techniques
17-Sep-03
The Module Hierarchy of RuleML DTDs
ruleml
ur-equalog
ur-hornlog
equalog
ur-datalog
hornlog
Rooted DAG will be extended with
branches for further sublanguages
ur-datalog =
join(ur,datalog)
datalog
ur
URL/URI-like
‘ur’-objects
132
urc-datalog
bin-datalog
urc-bin-datalog
urc-bin-data-ground-log
urc-bin-data-ground-fact
CS6905 Semantic Web Techniques
RDF-like triples
17-Sep-03
Planned RuleML Extensions





133
Reaction Rules: Encompass Situated, ECA, ...
Rule Modules: ‘Send’ queries to agents
Negations: Strong negation & negation as failure
Rule Prioritizing: Labels and/or salience factors
Integrity Constraints: Directly (not as queries)
CS6905 Semantic Web Techniques
17-Sep-03
RuleML Conclusions




134
RuleML DTD 0.8, a system of DTDs, is available at
http://www.dfki.de/ruleml/indtd0.8.html; sample rulebases
at http://www.dfki.de/ruleml/0.8/exa, use cases at
http://www.dfki.de/ruleml/library
RuleML DTD 0.81 also has transformation rules with callby-value function nestings
Further rule categories (e.g. integrity constraints and
reaction rules) will be available via main RuleML page
at http://www.dfki.de/ruleml
Distributed KR can already be based on current DTDs -using (XSLT) transformations to reach follow-up and
Participants’ DTDs
CS6905 Semantic Web Techniques
17-Sep-03
Simple HTML/XML Ontology Extensions
135
CS6905 Semantic Web Techniques
17-Sep-03
SHOE Basics
SHOE (Simple HTML Ontology Extensions)
(http://www.cs.umd.edu/projects/plus/SHOE/)
provides distributed ontologies consisting of
Categories: Organized hierarchically, with multiple
inheritance, for classifying instances
Relationship rules: Horn clauses (the first well-known
Horn language publishing KBs in the Web)
SHOE originally specified in HTML (before the definition
of XML); meanwhile also specified as an XML DTD
136
CS6905 Semantic Web Techniques
17-Sep-03
Instances (Individuals) as URLs/URIs
Individual constants in SHOE are represented through
an (official) URL/URI
In the earlier Horn-rule example there appear two individuals,
which could be represented in SHOE, e.g., as
137
eurostar
=
http://www.eurostar.com/
channel-tunnel
=
http://www.eurotunnel.com/
CS6905 Semantic Web Techniques
17-Sep-03
A SHOE Rule
With these URLs/URIs, the rule in SHOE becomes
138
<DEF-INFERENCE
DESCRIPTION="travel(?someone,http://www.eurotunnel.com/) if
carry(http://www.eurostar.com/,?someone)">
<INF-IF>
<RELATION NAME="carry">
<ARG POS="1" VALUE="http://www.eurostar.com/">
<ARG POS="2" VALUE="someone" USAGE="VAR">
</RELATION>
</INF-IF>
<INF-THEN>
<RELATION NAME="travel">
<ARG POS="1" VALUE="someone" USAGE="VAR">
<ARG POS="2" VALUE="http://www.eurotunnel.com/">
</RELATION>
</INF-THEN>
</DEF-INFERENCE>
CS6905 Semantic Web Techniques
17-Sep-03
XML Namespaces
139
CS6905 Semantic Web Techniques
17-Sep-03
XML Namespaces and
Programming-Language Modules




140
XML namespaces are akin to namespaces,
packages, and modules in programming languages
Disambiguation of tag–and attribute–names from
different XML applications (“spaces”) through
different prefixes
A prefix is separated from the local name by a “:”,
obtaining prefix:name tags
Namespaces constitute a layer on top of XML 1.0,
since prefix:name is again a valid tag name and
namespace bindings are ignored by some tools
CS6905 Semantic Web Techniques
17-Sep-03
Namespace Bindings
141

Prefixes are bound to namespace URIs by attaching
an xmlns:prefix attribute to the prefixed element or
one of its ancestors, prefix:name1 ,..., prefix:namen

The value of the xmlns:prefix attribute is a URI,
which may or (unlike for DTDs!) may not point to a
description of the namespace’s syntax

An element can use bindings for multiple namespaces via attributes xmlns:prefix1 ,..., xmlns:prefixm
CS6905 Semantic Web Techniques
17-Sep-03
Namespaceless Example:
Address Variant
Namespaceless XML Markup:
<address>
<name>Xaver M. Linde</name>
<street>Wikingerufer 7</street>
<town>10555 Berlin</town>
<bill>12.50</bill>
<phone>030/1234567</phone>
<phone>030/1234568</phone>
<fax>030/1234569</fax>
<bill>76.20</bill>
</ address>
142
CS6905 Semantic Web Techniques
bill is ambiguous
tag (name clash
from two XML
applications)
17-Sep-03
Two-Namespace Example:
Snail-Mail and Telecoms Address Parts
Namespace XML Markup:
<mail:address xmlns:mail="http://www.deutschepost.de/"
xmlns:tele="http://www.telekom.de/">
<mail:name>Xaver M. Linde</mail:name>
<mail:street>Wikingerufer 7</mail:street>
<mail:town>10555 Berlin</mail:town>
<mail:bill>12.50</mail:bill>
bill disambiguation
<tele:phone>030/1234567</tele:phone>
through mail and
<tele:phone>030/1234568</tele:phone>
tele prefixes
<tele:fax>030/1234569</tele:fax>
<tele:bill>76.20</tele:bill>
</ mail:address>
• The root element, mail:address, as well as the children mail:name, mail:street,
mail:town, and mail:bill, use the mail prefix, bound to a deutschepost URI
• The tele:phone, tele:fax, and tele:bill children use the tele prefix, bound to a telekom
URI
143
CS6905 Semantic Web Techniques
17-Sep-03
Acquiring and Processing
Knowledge Markups
144
CS6905 Semantic Web Techniques
17-Sep-03
Acquiring and Processing
Knowledge Markups



145
acquisition
–
Protégé with XML Plugin
–
Web Onto
transformation techniques and stylesheet languages
–
CSS
–
XSLT
query languages
–
XQL and XPath
–
XML-QL
–
XQuery
CS6905 Semantic Web Techniques
17-Sep-03
Acquiring XML Knowledge Bases
146
CS6905 Semantic Web Techniques
17-Sep-03
Protégé-2000 as an XML Editor

Represents the latest in a series of interactive tools for
knowledge-system development

Facilitates construction of knowledge bases in a principled
fashion from reusable components

Allows a variety of “plug-ins” to facilitate customization in
various dimensions

One plug-in used for XML import/export, i.e.
Protégé proposed as an XML editor (also as an RDF[S]
and OIL editor)
147
CS6905 Semantic Web Techniques
17-Sep-03
Knowledge-Base Development with
Protégé-2000
1.
2.
3.
4.
5.
148
Build or import a domain ontology (a conceptual
model of the application area)
Custom-tailor GUI for acquisition of content
knowledge
Elicit content knowledge from application
specialists
Map domain ontology to appropriate problem
solvers for automation of particular tasks
Export ontology and content knowledge to target
format (OKBC, XML, RDF[S], OIL, DAML+OIL ...)
CS6905 Semantic Web Techniques
17-Sep-03
Protégé as an OKBC-Compliant System
(Open Knowledge Base Connectivity)
OKBC:
149

Standard mechanism for knowledge bases stored
as “frames” of classes, slots, facets, instances, ...

Adopted by several well-known knowledgerepresentation systems (Ontolingua, LOOM,
Protégé-2000, XOL)

Allows Protégé-2000 to be used as an ontologyand knowledge-editing system for any OKBCcompliant server
CS6905 Semantic Web Techniques
17-Sep-03
XML Import Strategy


tag/element names become class names, except
“leaves” which become slots
example:
<Customer>
<Name>
<FirstName>Bill</FirstName>
<LastName>Buckram</LastName>
</Name>
<Cardnum>234 ...</Cardnum>
</Customer>
150
CS6905 Semantic Web Techniques
17-Sep-03
Example (Import):
Book Order
151
CS6905 Semantic Web Techniques
17-Sep-03
XML Export Strategy

instances:
–
–
–

ontology:
–
152
unreferenced instances become top level elements (cyclic
references are handled)
classes and slots become tag names
objects that are referenced more than
once are shared/reused with id/idref
as simple XML tree or RDF Schema
CS6905 Semantic Web Techniques
17-Sep-03
Example (Export):
Newspaper Instances
153
CS6905 Semantic Web Techniques
17-Sep-03
Example: Newspaper Ontology As XML
Tree
154
CS6905 Semantic Web Techniques
17-Sep-03
Processing XML
155
CS6905 Semantic Web Techniques
17-Sep-03
Cascading Style Sheets

CSS is a language for applying styles such as bold and
Arial to XML elements

also works with HTML (supported in most modern
browsers)

example (style sheet for poems):
poem
title
poet
stanza
verse

156
{ display:
{ display:
{ display:
{ display:
{ display:
block }
block; font-size: 16pt; font-weight: bold}
block; margin-bottom: 10px }
block; margin-bottom: 10px }
block }
attached to XML documents with processing instruction:
<?xml-stylesheet type="text/css" href="poem.css"?>
CS6905 Semantic Web Techniques
17-Sep-03
XSLT (XSL Transformations)




XSL (Extensible Stylesheet Language) =
XSLT + Formatting Objects
XSLT is a rule-based transformation language for
XML documents/trees
result of a transformation usually is again an XML
document, but may also be HTML or plain text
transformation takes place
–
–
–
157
offline (useful for XML-to-HTML transformation)
on server (e.g., with Apache´s Cocoon or Xalan)
in client (browser, preliminary support in Netscape 6 and
IE 5.x)
CS6905 Semantic Web Techniques
17-Sep-03
XML to HTML: XSLT Example – Input
<addresses>
<address>
<name>Xaver M. Linde</name>
<street>Wikingerufer 7</street>
<town>10555 Berlin</town>
</address>
<address>
<name>John Doe</name>
<street>42 Gary Cooper Street</street>
<town>Stanwyck City</town>
</address>
</addresses>
158
CS6905 Semantic Web Techniques
17-Sep-03
XML to HTML: XSLT Example – Stylesheet
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head><title>Addresses</title></head>
<body bgcolor="white">
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="address">
<p>
<i><xsl:value-of select="name"/></i><br/>
<xsl:value-of select="street"/><br/>
<b><xsl:value-of select="town"/></b>
</p>
</xsl:template>
template for
document root
template for
address
elements
</xsl:stylesheet>
159
CS6905 Semantic Web Techniques
17-Sep-03
XML to HTML: XSLT Example – Output
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
"http://www.w3.org/TR/REC-html40/strict.dtd">
<html>
<head><title>Addresses</title></head>
<body bgcolor="white">
<p><i>Xaver M. Linde</i><br>
Wikingerufer 7<br>
<b>10555 Berlin</b>
</p>
<p><i>John Doe</i><br>
42 Gary Cooper Street<br>
<b>Stanwyck City</b>
</p>
</body>
</html>
(The HTML code was produced with
Apache´s Cocoon in HTML mode, hence
<br/> became <br>)
160
CS6905 Semantic Web Techniques
17-Sep-03
XML to XML: Transformational
Semantics via an XSLT Stylesheet
<addresses>
% start fact base for addresses
<addresses>
<address>
address(
<address>
<name>Me2XML</name>
name("Me2XML"),
<name>Me2XML</name>
<place>
place(
<street>96 Hyper Road</street>
<street>96 Hyper Road</street>
street("96 Hyper Road"),
<town>Boston</town>
<town>Boston</town>
town("Boston")
</address>
</place>
)
<address>
</address>
).
<name>RDF4All</name>
address(
<street>2001 Broadway</street> <address>
<name>RDF4All</name>
name("RDF4All"),
<town>New York</town>
<place>
place(
</address>
<street>2001 Broadway</street>
street("2001 Broadway"),
<address>
<town>New York</town>
town("New York")
<name>XML4You</name>
</place>
)
<street>96 Hyper Road</street>
</address>
).
<town>Boston</town>
<address>
address(
</address>
<name>XML4You</name>
name("XML4You"),
</addresses>
<place>
place(
<street>96 Hyper Road</street>
street("96 Hyper Road"),
<town>Boston</town>
town("Boston")
</place>
)
</address>
).
</addresses>
% end fact base for addresses
XSLT templates
161
CS6905 Semantic Web Techniques
17-Sep-03
XML to XML: XSLT Stylesheet with a
Tree-Transforming Template 1
addresses
. . .
Subtree
Subtree
<!-- process addresses and position address nester -->
<xsl:template match="/addresses">
<addresses>
<xsl:apply-templates/>
</addresses>
</xsl:template>
addresses
. . .
Subtree
162
CS6905 Semantic Web Techniques
Subtree
17-Sep-03
XML to XML: XSLT Stylesheet with a
Tree-Transforming Template 2
address
name
PCDATA
<!-- apply address nester to each flat address -->
<xsl:template match="address">
<address>
<name><xsl:value-of select="name"/></name>
<place>
<street><xsl:value-of select="street"/></street>
<town><xsl:value-of select="town"/></town>
</place>
</address>
name
</xsl:template>
street
town
PCDATA
PCDATA
address
PCDATA
163
CS6905 Semantic Web Techniques
place
street
town
PCDATA
PCDATA
17-Sep-03
XQL and XPath

XSLT uses XPath to select parts of the input XML
documents, e.g.:
–
–



164
<xsl:template match="/">
document root
<xsl:value-of select="name"/> element „name“
syntax is not XML-based, but intended to be used
in URLs (XPointer) and XSLT as above
XQL is a variant of XPath especially designed for
querying XML documents
XPath/XQL expressions select parts of XML
documents (no transformations!)
CS6905 Semantic Web Techniques
17-Sep-03
XQL Expressions 1

XQL expressions (relative to a context node):
–
–
–
–
165
address
select element nodes with tag name „address“
address/name
select „name“ element nodes directly below „address“
element nodes
address/name=´John Doe´
as before, plus the content of the name element must be
´John Doe´
book//name
select „name“ element nodes anywhere below „book“
element nodes
CS6905 Semantic Web Techniques
17-Sep-03
XQL Expressions 2

absolute XQL expressions:
–
–
–

expressions with attributes (prefixed with @):
–
–
166
/
document root (the node that contains the document
element)
/addresses/address/name
//name
„name“ element nodes anywhere in the document
address/@type
attribute nodes with name „type“ below „address“ element
nodes
address/@type=´email´
as above, plus the value of the „type“ attribute is ´email´
CS6905 Semantic Web Techniques
17-Sep-03
XQL Expressions 3

filter expressions:
–
–
–
167
address[name]
select „address“ element nodes with a direct „name“ subelement node
address[name=´John Doe´]
as above, plus the content of the „name“ element is
´John Doe´
address[@type=´email´]
select „address“ element nodes that have a „type“
attribute whose value is ´email´
CS6905 Semantic Web Techniques
17-Sep-03
XML-QL




168
borrows features of query languages developed by
the database research community for
semistructured data
similar to SQL
(simplified) base construct is
WHERE pattern1 IN URI1, ...
CONSTRUCT patternn
where the patterns are XML fragments with
variables (prefixed with $)
XML-QL introduces an abbreviated XML syntax for
simplicity: <tag>...</> instead of <tag>...</tag>
CS6905 Semantic Web Techniques
17-Sep-03
XML-QL Example 1

return short addresses (town-city renaming,
without street):
<street> elements
are also matched
<address>
<name>Xaver M. Linde</name>
<street>Wikingerufer 7</street>
<town>10555 Berlin</town>
</address>
WHERE
<address>
<name>$n</>
<town>$t</>
</> IN "www.test.org/addresses.xml"
CONSTRUCT
<shortaddress>
<shortaddress>
<name>Xaver M. Linde</name>
<name>$n</>
<city>10555 Berlin</city>
</shortaddress>
<city>$t</>
</>
169
CS6905 Semantic Web Techniques
17-Sep-03
XML-QL Example 2

XML-QL allows joining by value:
WHERE
<address>
<name>$n</>
</> ELEMENT_AS $a IN "www.test.org/addresses.xml",
<book>
<author>$n</>
<title>$t</>
</> IN "www.test.org/books.xml"
CONSTRUCT
<book>
<title>$t</>
$a
</>
170
CS6905 Semantic Web Techniques
17-Sep-03
XQuery
171

derived from Quilt

borrows features from several languages:
–
XPath and XQL: path expression syntax
–
XML-QL: notion of binding variables and then using the bound
variables to create new structures
–
SQL: series of clauses based on keywords that provide a
pattern for restructuring data (the SELECT-FROM-WHERE
pattern in SQL)
–
OQL: functional language composed of several different kinds
of expressions that can be nested with full generality
CS6905 Semantic Web Techniques
17-Sep-03
XQuery: Examples 1

Path expressions:
–
In the second chapter of the document named "zoo.xml", find
the figure(s) with caption "Tree Frogs":
document("zoo.xml")/chapter[2]//figure[caption = "Tree Frogs"]
–
Ranges: Find all the figures in chapters 2 through 5 of the
document named "zoo.xml":
document("zoo.xml")/chapter[RANGE 2 TO 5]//figure
–
Dereferencing: Find captions of figures that are referenced by
<figref> elements in the chapter of "zoo.xml" with title "Frogs":
document("zoo.xml")/chapter[title = "Frogs"]
//figref/@refid->fig/caption
172
CS6905 Semantic Web Techniques
17-Sep-03
XQuery: Examples 2

FLWR (FOR-LET-WHERE-RETURN) Expressions and Element Constructors:
–
List the titles of books published by Morgan Kaufmann in 1998:
FOR $b IN document("bib.xml")//book
WHERE $b/publisher = "Morgan Kaufmann"
AND $b/year = "1998"
RETURN $b/title[xyz:*]
–
List each publisher and the average price of its books:
FOR $p IN distinct(document("bib.xml")//publisher)
LET $a := avg(document("bib.xml")/book[publisher = $p]/price)
RETURN
<publisher>
<name> $p/text() </name> ,
element
constructor
<avgprice> $a </avgprice>
</publisher>
173
CS6905 Semantic Web Techniques
17-Sep-03
XQuery: Examples 3

Functions (& Namespaces, XML Schema Data Types):
–
Find the maximum depth of the document named "partlist.xml" :
NAMESPACE xsd = http://www.w3.org/2000/10/XMLSchema-datatypes
FUNCTION depth(ELEMENT $e) RETURNS xsd:integer
{
-- An empty element has depth 1
-- Otherwise, add 1 to max depth of children
IF empty($e/*) THEN 1
ELSE max(depth($e/*)) + 1
}
depth(document("partlist.xml"))
174
CS6905 Semantic Web Techniques
17-Sep-03
175
CS6905 Semantic Web Techniques
17-Sep-03
Todays Topics

Resolution
–


j-DREW BU procedure
Subsumption
–


change to procedure
Infinite Loops
RuleML input
–
176
top down and bottom up
Prolog output
CS6905 Semantic Web Techniques
17-Sep-03
Resolution

Clausal Logic: Syntax
–
–
an atom in logic is (syntactically) a relation symbol
followed by its arguments, each of which is a term
a term is either a variable, a constant or a function
symbol followed by its arguments (which are also terms)


–
each clause is a disjunction of positive or negative atoms


–

attends(Student, Course) \/ ~passes(Student, Course)
Rule Notation: a \/ b \/ ~c \/ ~d becomes a \/ b  c /\ d
a literal is a positive or negative atom
Definite clauses have
–
177
brother(‘Harry’, future_king(‘England’))
passes(‘Fang’, cs6999)
one positive literal and any number of negative literals
CS6905 Semantic Web Techniques
17-Sep-03
Resolution

Given two clauses, to form the resolvent:
–
find two literals, one from each clause, that


–
–

–
b(X) \/ ~c(X, 3) against c(2, Y) \/ ~d(Y, Z)
gives b(2) \/ ~d(3, Z)
In rule notation
–
–
178
construct the disjunction of all literals except these two
apply the substitution
Resolve
–

can be made to match (with assignments to the variables)
differ in sign
b(X)  c(X, 3) against c(2, Y)  d(Y, Z)
gives b(2)  d(3, Z)
CS6905 Semantic Web Techniques
17-Sep-03
Bottom Up Reasoning

Single literal definite clauses are called facts
–

Resolving a fact against a condition in a rule is
called forward reasoning
–
–

so forward reasoning also called bottom up reasoning
Prolog does top-down, backward reasoning
–
179
attends(Student, Course)  passes(Student, Course)
Resolvent: attends(‘Fang’, cs6999)
Usually a derivation tree is viewed with given facts
at the bottom and derived facts at the top
–

passes(‘Fang’, cs6999)
starting from a negative clause, called a query
CS6905 Semantic Web Techniques
17-Sep-03
j-DREW Bottom Up

More or less efficient than top down?
–

More
–
–

–
180
can reuse subderivations
saves space and time
Less
–

depends on details of each search method
Less goal directed
Much unfocused search
Infinite loops possible with both
CS6905 Semantic Web Techniques
17-Sep-03
Theorem Prover’s Search Procedure
 Priority
–
queue
new facts
 Discrimination
trees:
–
–
181
used facts
rules, indexed on
first goal
main loop
select new fact
for each matching rule
resolve
process new result
add to old facts
process new result(C)
if C is rule
for each old fact matching first goal
resolve
process new result
add C to rules
else
add C to new facts
CS6905 Semantic Web Techniques
17-Sep-03
Preventing Infinite Loops




To prevent infinite loops in the search procedure,
use subsumption (next slides) and either
1a) use ground facts and rules only, or
1b) use no function symbols
Sometimes it helps if the positive literal has no
new variables (that do not already occur in the
body)
182
CS6905 Semantic Web Techniques
17-Sep-03
Subsumption

A clause C subsumes a clause D if there is a
substitution  such that C  D
–
–

We use subsumption between facts (atoms)
–

Atoms C subsumes atom D if
there exists  such that C = D
Subsumption is checked by
–
–
183
C is more general than D
Given C you do not need D
first grounding all variables in D to new constants
then trying to unify C with grounded D
CS6905 Semantic Web Techniques
17-Sep-03
Forward subsumption



New result is checked against old results to see if
it is more general
We can prevent some infinte loops by checking
subsumption of new fact against old facts
Should this be done when the new fact is derived
or when it is selected?
–

184
experience shows that subsumption on selection is
better
What about subsumption of rules?
CS6905 Semantic Web Techniques
17-Sep-03
Theorem Prover’s Search Procedure
 Priority
–
queue
new facts
 Discrimination
trees:
–
–
185
used facts
rules, indexed on
first goal
main loop
select new fact
if it is not forward subsumed
for each matching rule
resolve
process new result
add to old facts
process new result(C)
if C is rule
for each old fact matching first goal
resolve
process new result
add C to rules
else
add C to new facts
CS6905 Semantic Web Techniques
17-Sep-03
Event – Condition - Action

Suppose theorem prover saturates
–
Then a new fact is added from


–
adding a fact restarts saturation


186
push process
Java event listener
could generate new Java events
ECA interaction with Java 1.1 events
CS6905 Semantic Web Techniques
17-Sep-03
System Architecture





187
j-DREW
runs
Listeners
register with
Broadcaster
New fact
added
New
conclusions
drawn
Events sent
to Listeners
j-DREW BU
Rules
New Fact
Listener
Listener
Listener
Listener
Old Facts
Event Broadcaster
New Facts
New Facts
CS6905 Semantic Web Techniques
17-Sep-03
RuleML


Input to j-DREW BU may also
be RuleML
RuleML queries are ignored
currently
discount(customer,product1,'5.0 percent')
:premium(customer),regular(product).
188
<imp>
<_head>
<atom>
<_opr><rel>discount</rel></_opr>
<var>customer</var>
<var>product</var>
<ind>5.0 percent</ind>
</atom>
</_head>
<_body>
<and>
<atom>
<_opr><rel>premium</rel></_opr>
<var>customer</var>
</atom>
<atom>
<_opr><rel>regular</rel></_opr>
<var>product</var>
</atom>
</and>
</_body>
</imp>
CS6905 Semantic Web Techniques
17-Sep-03
Related Literature



Set of support prover for definite clauses
Facts are supports
Theorem: Completeness preserved when
definite clause resolutions are only between
first negative literal and fact.
–


189
Proof: completeness of lock resolution (Boyer’s PhD)
Use standard search procedure to reduce
redundant checking
Unlike OPS/Rete, returns proofs and uses first
order syntax for atoms
CS6905 Semantic Web Techniques
17-Sep-03
XML-Based Agent Techniques
190
CS6905 Semantic Web Techniques
17-Sep-03
XML-Based Agent Techniques

XML-Protocol, SOAP, XML-RPC, WSDL
–
remote procedure calls starting with HTTP for the transport
and XML for the encoding

FIPA (Foundation of Intelligent Physical Agents)
–

DAML
–

XML (and RDF) as language for message contents
DARPA Agent Markup Language
ACORN
–
Keyphrase-Based Information Sharing Multi-Agent Architecture: Virendra C.
Bhavsar and Ali A. Ghorbani

RACSA
–
191
Rule Applying Comparison Shopping Agent
CS6905 Semantic Web Techniques
17-Sep-03
RACSA (1)
The RACSA project contributes to the Semantic Web,
especially to e-commerce in the Semantic Web
Unlike in standard comparison shopping,
the main idea of RACSA is
• marking up shopping web pages with
Semantic Web languages
• based on their list prices,
computing the real end prices
by applying various business rules
192
CS6905 Semantic Web Techniques
17-Sep-03
RACSA (2)
From a more technical point of view,
RACSA is a rule-empowered shopping agent, using
RuleML as the XML-based rule language and
Mandarax (a Java-based Prolog engine) as the
inference component for processing knowledge and
data bases (i.e. facts and rules)
The goal of RACSA is to demonstrate an e-commerce
application enabled by the Semantic Web techniques:
Supporting purchase-decisions by simplifying price
comparisons
193
CS6905 Semantic Web Techniques
17-Sep-03
RACSA (3)
The project is restricted to an exemplary domain:
Refrigerators/freezers offered by 3 small fictitious shops
Rule application takes place in a wide variety of areas:
• gross/net prices
• calculation of warranty time
• additional insurance and transport costs
• payment and customer discounts
Online Demo: http://www.dfki.de/racsa/
194
CS6905 Semantic Web Techniques
17-Sep-03
Resource Description Framework
195
CS6905 Semantic Web Techniques
17-Sep-03
Disclaimer and Footnote
“There is nothing
interesting in what we are
doing. The only interesting
thing is the scale upon
which we are attempting to
do it.”
R.V. Guha, Epinions
196
Adobe’s eXtensible Metadata Platform (XMP) now uses RDF
for Photoshop® 7.0, Acrobat® 5.0, and FrameMaker®:
http://www.adobe.com/products/xmp/main.html
CS6905 Semantic Web Techniques
17-Sep-03
Outline

Motivation: Why XML is not enough

Introduction to RDF
–
Requirements for KR on the Web
–
The RDF Data Model
–
RDF Schema

Extensions of RDF(S)

Tools for RDF and RDF Schema
–
197
Parser, Query, and Inference Engines
CS6905 Semantic Web Techniques
17-Sep-03
Why The Shift Towards More
Semantics?

Information Overload
–
Information on the Web currently aiming at Human
Consumption
–

Search Engines fail more and more
–

Information Consumption is too time consuming
combined coverage is less than 42% of the HTML-Web
Data Interchange growing (e.g. B2B)
–
needs a common semantics
XML?
198
CS6905 Semantic Web Techniques
17-Sep-03
Extensible Markup Language (XML)
Revisited

Key idea: separate structure from presentation

XML DTDs or Schemas define document structure

Replace HTML with two things

A domain specific markup language (defined in XML)

A map from that markup language to HTML (defined using
XSLT)
DTD enables document recipients to tell whether
they’ve received a grammar-conforming document
–
199

Gives a minimal level of validation
CS6905 Semantic Web Techniques
17-Sep-03
Why XML is Not Enough

Main advantage of using XML is reusing the parser
and document validation

Many different possibilities to encode a domain of
discourse

Leads to difficulties when understanding of foreign
documents is required
==> Next step: separate content from structure!
200
CS6905 Semantic Web Techniques
17-Sep-03
Encoding of Knowledge: Example
“The Creator of the Resource “http://www.w3.org/Home/Lassila” is Ora Lassila
http://www.w3.org/Home/Lassila
Creator
Ora Lassila
Endless encoding possibilities in XML:
<Creator>
<uri>http://www.w3.org/Home/Lassila</uri>
<name>Ora Lassila</name>
</Creator>
<Document uri=“http://www.w3.org/Home/Lassila”
<Creator>Ora Lassila</Creator>
</Document>
<Document uri=“http://www.w3.org/Home/Lassila” Creator=“Ora Lassila”/>
201
CS6905 Semantic Web Techniques
17-Sep-03
Point to Point Communication
for Machine-Understandable Data
Conceptual Domain Model
(Objects and Relations)
Person is_a Mammal
Student is_a Person
----
Translation Step
<xsd:schema xmlns:xsd="http://...">
<xsd:annotation> A-Schema
DTD or XML Schema
</xsd:...
</xsd:schema>
Deployment
XML-based Communication
using DTD A
XMLParser
Sender using DTD A
Parse Tree
Recipient using DTD A
Common Semantics
202
CS6905 Semantic Web Techniques
17-Sep-03
Many Previously Unknown
Communication Partners
203
CS6905 Semantic Web Techniques
17-Sep-03
New Partners Don’t Understand
Each Other
?
Communication Partner
using DTD B
Communication Partner
using DTD C
?
?
XML-based Communication
using DTD A
XMLParser
Sender using DTD A
204
Parse Tree
Recipient using DTD A
CS6905 Semantic Web Techniques
17-Sep-03
Merging Steps Between Models
Steps
Reengineering
of the conceptual
model
DTD A
DTD B
<xsd:schema
xmlns:xsd="http://...">
<xsd:annotation>A-Schema
<xsd:schema
xmlns:xsd="http://...">
<xsd:annotation>B-Schema
</xsd:...
</xsd:schema>
</xsd:...
</xsd:schema>
Matching
Matching
XML Document
Translation
Generation
(e.g. in XSLT)
XML Document
Translation from
DTD A to DTD B
(and B to A)
205
<xsl:stylesheet version="1.0”
xmlns:xsl="http://....Transform"
<xsl:template match="/">
....
</xsl:template>
</xsl:stylesheet>
CS6905 Semantic Web Techniques
<xsl:stylesheet version="1.0”
xmlns:xsl="http://....Transform"
<xsl:template match="/">
....
</xsl:template>
</xsl:stylesheet>
17-Sep-03
Merging/Aligning Models

Reengineering step is costly and unnecessary,
when a conceptual language is in use

Generation document translation procedures is
again complicated and unnecessary
==> use a level on top of XML

206
What are requirements for such a level?
CS6905 Semantic Web Techniques
17-Sep-03
Postulates: Fundamental Requirements
for KR on the Web
1. Knowledge on the Web is distributed
(link Knowledge on the Web)
2. Knowledge on the Web is biased - there is no
universal truth
it must be possible to dispute statements
3. Many different user communities:
Extensibility and Simplicity
==> Resource Description Framework (RDF)
207
CS6905 Semantic Web Techniques
17-Sep-03
Introduction to RDF

RDF (Resource Description Framework)
–

RDF unites a wide variety of stakeholders:
–
–

–
208
Digital librarians, content-raters, privacy advocates, B2B
industries, AI...
Significant (but less than XML) industrial momentum,
lead by W3C
RDF consists of two parts
–

Beyond Machine readable to Machine understandable
RDF Model (a set of triples)
RDF Syntax (different XML serialization syntaxes)
RDF Schema for definition of Vocabularies (simple
Ontologies) for RDF (and in RDF)
CS6905 Semantic Web Techniques
17-Sep-03
RDF Data Model

Resources
–
–
–

Properties
–

–
209
slots, define relationships to other resources or atomic
values
Statements
–

A resource is a thing you talk about (can reference)
Resources have URI’s
RDF definitions are themselves Resources (linkage, see
requirement 1)
“Resource has Property with Value”
(Values can be resources or atomic XML data)
Similar to Frame Systems
CS6905 Semantic Web Techniques
17-Sep-03
A Simple Example

Statement
–

Structure
–
–
–

“Ora Lassila is the creator of the resource
http://www.w3.org/Home/Lassila”
Resource (subject)
http://www.w3.org/Home/Lassila
Property (predicate) http://www.schema.org/#Creator
Value
(object)
"Ora Lassila”
Directed graph
http://www.w3.org/Home/Lassila
210
s:Creator
CS6905 Semantic Web Techniques
Ora Lassila
17-Sep-03
Another Example

To add properties to Creator, point through an
intermediate Resource.
http://www.w3.org/Home/Lassila
s:Creator
Person://fi/654645635
Name
Ora Lassila
211
CS6905 Semantic Web Techniques
Email
lassila@w3.org
17-Sep-03
Collection Containers

Multiple occurrences of the same PropertyType don’t
establish a relation between the values
–
–
–

The Millers own a boat, a bike, and a TV set
The Millers need (a car or a truck)
(Sarah and Bob) bought a new car
RDF defines three special Resources:
–
–
–
Bag
unordered values
rdf:Bag
Sequence
ordered values rdf:Seq
Alternative
single value
rdf:Alt

212
Core RDF does not enforce ‘set’ semantics amongst
values
CS6905 Semantic Web Techniques
17-Sep-03
Example: Bag

The students in
course 6.001
are Amy, Tim,
John, Mary,
and Sue
/courses/6.001
Rdf:Bag
rdf:type
/Students/Amy
students
rdf:_1
rdf:_2
bagid1
/Students/Tim
rdf:_3
/Students/John
rdf:_4
rdf:_5
/Students/Mary
/Students/Sue
213
CS6905 Semantic Web Techniques
17-Sep-03
Example: Alternative

The source code for X11 may be found at ftp.x.org,
ftp.cs.purdue.edu, or ftp.eu.net
http://x.org/package/X11
rdf:type
rdf:Alt
source
rdf:_1
altid
ftp.x.org
rdf:_2
ftp.cs.purdue.edu
rdf:_3
ftp.eu.net
214
CS6905 Semantic Web Techniques
17-Sep-03
Statements About Statements
(Requirement 2: Dispute Statements)

Making statements about statements requires a
process for transforming them into Resources
215
–
subject
the original resource
–
predicate
the original property
–
object
the original value
–
type
rdf:Statement
CS6905 Semantic Web Techniques
17-Sep-03
Example: Reification

Ralph Swick believes that
–
the creator of the resource
http://www.w3.org/Home/Lassila is Ora Lassila
http://www.w3.org/Home/Lassila
rdf:predicate
s:Creator
s:Creator
rdf:subject
genid1
rdf:object
rdf:type
b:believedBy
rdf:Statement
Ora Lassila
Ralph Swick
216
CS6905 Semantic Web Techniques
17-Sep-03
A Formal Model of RDF

RDF itself is mathematically straightforward:
–
–
Basic Definitions

Resources

Properties Resources

Literals

Statements  Properties  Resources
Typing

rdf:type Properties

{RDF:type, sub, obj} Statements obj Resources
–
217
 {Resources Literals}
for triples like {p,r1,r2} the RDF spec should use some different bracketing, like (p,r1,r2)
CS6905 Semantic Web Techniques
17-Sep-03
Formal Model of RDF II
–
Reification



rdf:Statement  Resources \ Properties
{rdf:predicate, rdf:subject, rdf:object } Properties
Reification of a triple {pred, sub, obj} of Statements is an element r of Resources
representing the reified triple and the elements s1, s2, s3, and s4 of Statements such
that
– s1: {RDF:predicate, r, pred}
– s2: {RDF:subject, r, sub}
– s3: {RDF:object, r, obj}
– s4: {RDF:type, r, [RDF:Statement]}
–
Collections



218
{ RDF:Seq, RDF:Bag, and RDF:Alt } Resources \ Properties
There is a subset of Properties corresponding to the ordinals (1, 2, 3, ...) called Ord.
We refer to
elements of Ord as RDF:_1, RDF:_2, RDF:_3, ...
CS6905 Semantic Web Techniques
17-Sep-03
RDF Syntax I



Data model does not enforce particular syntax
Specification suggests many different syntaxes
based on XML
General form:
Subject (OID)
Starts an RDF-Description
<rdf:RDF>
<rdf:Description about="http://www.w3.org/Home/Lassila">
<s:Creator>Ora Lassila</s:Creator>
<s:createdWith rdf:resource=“http://www.w3c.org/amaya”/>
</rdf:Description>
</rdf:RDF>
Literal
Properties
219
Resource (possibly another RDF-description)
CS6905 Semantic Web Techniques
17-Sep-03
Resulting Graph
http://www.w3.org/Home/Lassila
s:createdWith
s:Creator
Ora Lassila
http://www.w3c.org/amaya
<rdf:RDF>
<rdf:Description about="http://www.w3.org/Home/Lassila">
<s:Creator>Ora Lassila</s:Creator>
<s:createdWith rdf:resource=“http://www.w3c.org/amaya”/>
</rdf:Description>
</rdf:RDF>
220
CS6905 Semantic Web Techniques
17-Sep-03
RDF Syntax II: Syntactic Varieties
Typing Information
Subject (OID)
In-Element Property
<s:Homepage rdf:about="http://www.w3.org/Home/Lassila”
s:Creator=“Ora Lassila”/>
<s:createdWith>
<s:HTMLEditor rdf:about=“http://www.w3c.org/amaya”/>
</s:createdWith>
</s:Homepage>
Property
http://www.w3.org/Home/Lassila
s:Creator
rdf:type
s:Homepage
s:createdWith
rdf:type
Ora Lassila
221
http://www.w3c.org/amaya
CS6905 Semantic Web Techniques
HTMLEditor
17-Sep-03
RDF Schema (RDFS)

RDF just defines the data model

Need for definition of vocabularies for the data
model - an Ontology Language!

RDF schemas are Web resources (and have URIs)
and can be described using RDF
222
CS6905 Semantic Web Techniques
17-Sep-03
Most Important Modeling Primitives

223
Core Classes
–
Root Class rdfs:Resource
–
MetaClass rdfs:Class
–
Literals rdfs:Literal

rdfs:subclassOf property

Inherited from RDF: properties (slots)

rdfs:domain & rdfs:range

rdfs:subPropertyOf property

rdfs:label, rdfs:comment, etc.

Inherited from RDF: InstanceOf (rdf:type)
CS6905 Semantic Web Techniques
17-Sep-03
RDF-Schema: Example (incomplete)
s = rdfs:subClassOf
rdfs:Resource
s
xyz:MotorVehicle
s
s
s
xyz:Van
s
xyz:Truck
xyz:PassengerVehicle
xyz:MiniVan
224
s
CS6905 Semantic Web Techniques
17-Sep-03
RDF-Schema: Example
s = rdfs:subClassOf
t = rdf:type
rdfs:Resource
s
t
t
rdfs:Class
t
xyz:MotorVehicle
t
t
s
t
s
s
s
xyz:Van
xyz:Truck
t
s
xyz:PassengerVehicle
xyz:MiniVan
225
s
CS6905 Semantic Web Techniques
17-Sep-03
Example: RDF-Schema in RDF-Schema

Namespace-URL:
http://www.w3.org/2000/01/rdf-schema#
<rdfs:Class rdf:ID="Resource">
<rdfs:label xml:lang="en">Resource</rdfs:label>
<rdfs:label xml:lang="fr">Ressource</rdfs:label>
<rdfs:comment>The most general class</rdfs:comment>
</rdfs:Class>
<rdfs:Class rdf:ID="Class">
<rdfs:label xml:lang="en">Class</rdfs:label>
<rdfs:label xml:lang="fr">Classe</rdfs:label>
<rdfs:comment>The concept of Class</rdfs:comment>
<rdfs:subClassOf rdf:resource="#Resource"/>
</rdfs:Class>
<rdf:Property ID="subClassOf">
<rdfs:label xml:lang="en">subClassOf</rdfs:label>
<rdfs:label xml:lang="fr">sousClasseDe</rdfs:label>
<rdfs:comment>Indicates a subclass of a class</rdfs:comment>
<rdfs:range rdf:resource="#Class"/>
<rdfs:domain rdf:resource="#Class"/>
</rdf:Property>
226
CS6905 Semantic Web Techniques
17-Sep-03
Extensibility of RDF

Define an Ontology of your Language with RDF
Schema (like RDF-Schema itself)

Describe Instance Data using your new
Vocabulary

Advantage: all Languages use the same Data
Model (simplifies Interoperability)
227
CS6905 Semantic Web Techniques
17-Sep-03
Photo Archive Using RDF: Introduction

W3C project for describing & retrieving (digitized)
photos with (RDF) metadata
–

228
Explained in a W3C Note by Yves Lafon and Bert Bos
Metadata separated into three different schemas:
1.
Dublin Core schema: Title, date, subject, etc.
2.
Technical schema: Photo and camera details
3.
Content schema: Vocabulary for DC "subject" property
CS6905 Semantic Web Techniques
17-Sep-03
Photo Archive Using RDF: Sample Photo
229
CS6905 Semantic Web Techniques
17-Sep-03
Photo Archive Using RDF: Photo Metadata
230
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.w3.org/1999/09/28-Photo-ns#"
xmlns:DC="http://purl.oclc.org/dc/documents/rec-dces-199809.htm#"
xmlns:Technical="http://www.w3.org/2000/PhotoRDF/technical-1-0#">
<rdf:Description about="">
<DC:Description>Waves breaking in a small gulf on an island near Brisbane</DC:Description>
<DC:Type>image/jpeg</DC:Type>
<DC:Subject>Landscape</DC:Subject>
<DC:Source>35mm slide</DC:Source>
<DC:Rights>http://www.w3.org/People/Lafon/Copyright?1998</DC:Rights>
<DC:Title>Sea near Brisbane</DC:Title>
<DC:Date>1998-04-20</DC:Date>
<DC:Coverage>Brisbane - Australia</DC:Coverage>
<DC:Creator>http://www.w3.org/People/Lafon/</DC:Creator>
<Technical:devel-date>2000-05-01</Technical:devel-date>
<Technical:lens>Minolta AF70-210</Technical:lens>
<Technical:camera>http://www.w3.org/People/Lafon/Minolta800i</Technical:camera>
<Technical:film>Fuji</Technical:film>
</rdf:Description>
</rdf:RDF>
CS6905 Semantic Web Techniques
17-Sep-03
Photo Archive Using RDF: RDFS Excerpt
This is an excerpt of a minimal RDF Schema for the Dublin Core:
Each property is a restriction of the DC property of the same name,
as found in http://purl.org/dc/elements/1.1/ :
<rdf:RDF xmlns:rdfs="http://www.w3.org/TR/1999/PR-rdf-schema-19990303#“
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Property rdf:ID="title">
<rdfs:label xml:lang="en">Title</label>
<rdfs:subPropertyOf rdf:resource="http://purl.org/dc/elements/1.1/title"/>
</rdf:Property>
<rdf:Property rdf:ID="creator">
<rdfs:label xml:lang="en">Author/creator</label>
<rdfs:subPropertyOf rdf:resource="http://purl.org/dc/elements/1.1/creator"/>
</rdf:Property>
<rdf:Property rdf:ID="subject">
<rdfs:label xml:lang="en">Subject</label>
<rdfs:subPropertyOf rdf:resource="http://purl.org/dc/elements/1.1/subject" />
<rdfs:range rdf:resource="http://www.w3.org/2000/PhotoRDF/content-1-0#Keywords"/>
</rdf:Property>
. . .
231
</rdf:RDF>
CS6905 Semantic Web Techniques
17-Sep-03
Protégé-2000 as RDF[S]-Editor
<rdfs:Class rdf:about="&mv;MotorVehicle">
<rdfs:subClassOf rdf:resource="&rdfs;Resource"/>
</rdfs:Class>
<rdfs:Class rdf:about="&mv;PassengerVehicle">
<rdfs:subClassOf rdf:resource="&mv;MotorVehicle"/>
</rdfs:Class>
<rdf:Property rdf:about="&mv;rearSeatLegRoom"
a:maxCardinality="1" a:range="integer">
<rdfs:domain rdf:resource="&mv;MotorVehicle"/>
<rdfs:range rdf:resource="&rdfs;Literal"/>
</rdf:Property>
232
CS6905 Semantic Web Techniques
17-Sep-03
Ontology Languages on Top of RDF:
The Principle
Legend:
Instance
Data
Definition uses the
data model of
Defined in terms of
Is extension of
Ontology
Language
RDF Schema
RDF
233
CS6905 Semantic Web Techniques
17-Sep-03
The Semantic Web



234
A Web of machine understandable Data, based on declarative
languages on top of RDF (all use the same data model!)
Intelligent Agent enabling architecture
W3C’s vision for the Semantic Web Architecture:
CS6905 Semantic Web Techniques
17-Sep-03
Tools

Tools for RDF and RDF Schema
–
–
Editors

Protégé-2000 (SMI)

HTML Annotation Tool (Siegfied Handschuh)
Parsers and Generators

–
235
RDF-API (Sergey Melnik, Stanford)
Query and Inference Engines

N3 (Tim Berners-Lee)

Squish (Libby Miller)

SiLRI (Stefan Decker & Juergen Angele)

TRIPLE (Stefan Decker and Michael Sintek)
CS6905 Semantic Web Techniques
17-Sep-03
RDF Resources


RDF-Editor: Protégé
www-smi.stanford.edu/projects/protege
RDF-Parser and APIs/Query Engines
–
–

RDF Knowledge Sources
–

DMOZ - Open Directory (largest human created Webdirectory) http://www.dmoz.org
General Information:
–
–
236
http://www-db.stanford.edu/~melnik/rdf
http://www.aifb.uni-karlsruhe.de/~sde/rdf
RDF Interest Mailing list: www-rdf-interest@w3.org
Archive: http//lists.w3.org/Archives/Public/www-rdf-interest/
SemanticWeb.org
CS6905 Semantic Web Techniques
17-Sep-03
Open Issues of RDF

RDF-Schema is still evolving

URIs: What is the URI of a person?
Other real world entity?

“Killer Applications”: Search Engines? B2BCommunication (e.g. ebXML.org ?)

237
Interoperability between RDF-Schemas
CS6905 Semantic Web Techniques
17-Sep-03
Description Logic:
Class-Forming Operations
238
CS6905 Semantic Web Techniques
17-Sep-03
Class Intersection:
Example
s = rdfs:subClassOf
TallThing
s
Man
s
TallMan := TallThing Π Man
Intensional conjunction of classes: TallThingΠMan(x)  TallThing(x)  Man(x)
Intensional disjunction of classes similar but computationally more complex
239
CS6905 Semantic Web Techniques
17-Sep-03
Class Intersection and Definition:
Example
s = rdfs:subClassOf
:= = daml:Class
TallThing
s
TallMan
:=
Man
s
TallMan := TallThing Π Man
240
CS6905 Semantic Web Techniques
17-Sep-03
Class Complement:
Example
c = daml:complementOf
Person
c
Car
241
¬Person
CS6905 Semantic Web Techniques
17-Sep-03
Class Complement and Subsetting:
Example
s = rdfs:subClassOf
c = daml:complementOf
Person
s
c
Car
Car
242
¬Person
CS6905 Semantic Web Techniques
17-Sep-03
Qualified Role:
Example
t = rdf:type
Over17
age
t
RipeThing := age.Over17
Existential role: age.Over17(x)  y age(x,y)  Over17(y)
Universal role similar
243
CS6905 Semantic Web Techniques
17-Sep-03
Qualified Role and Definition :
Example
t = rdf:type
:= = daml:Class
Over17
:=
age
RipeThing
t
RipeThing := age.Over17
244
CS6905 Semantic Web Techniques
17-Sep-03
DAML+OIL
245
CS6905 Semantic Web Techniques
17-Sep-03
DARPA Agent Markup Language, OIL,
and OWL


OIL: European Ontology Interchange Language
DARPA funded Research Program (also funded
the Development of the ARPANNET -> Internet):
–



Ontology Language DAML+OIL: Result of a Joint
(European + American) Committee
Rule Language in preparation, jointly with RuleML
W3C’s new OWL (Ontology Web Language)
mainly divides DAML+OIL into two sublanguages:
–
–
246
Foundation for the Semantic Web: http://www.daml.org
OWL Light: Frames
http://www.w3.org/2001/sw/WebOnt/
Full OWL: Description logic
CS6905 Semantic Web Techniques
17-Sep-03
DAML+OIL



Extension of RDF Schema
Ontology Language DAML+OIL: Result of a Joint
(European + US-American) Committee
Extension of RDF Schema
–
–
–
–
Class Expressions (Intersection, Union, Complement)
XML Schema Datatypes
Enumerations
Property Restrictions


247
Cardinality Constraints
Value Restrictions
CS6905 Semantic Web Techniques
17-Sep-03
Example: Intersection & Synonyms
<daml:Class rdf:ID="TallMan">
<daml:intersectionOf rdf:parseType="daml:collection">
<daml:Class rdf:about="#TallThing"/>
<daml:Class rdf:about="#Man"/>
</daml:intersectionOf>
</daml:Class>
<daml:Class rdf:ID="HumanBeing">
<daml:sameClassAs rdf:resource="#Person"/>
</daml:Class>
248
CS6905 Semantic Web Techniques
17-Sep-03
Example: Disjoint & Complement
<daml:Disjoint rdf:parseType="daml:collection">
<daml:Class rdf:about="#Car"/>
<daml:Class rdf:about="#Person"/>
<daml:Class rdf:about="#Plant"/>
</daml:Disjoint>
Disjoint not strictly necessary, since expressible via pairwise subClassOf
of complementOf, as for Car and Person:
249
<daml:Class rdf:ID="Car">
<rdfs:comment>no car is a person</rdfs:comment>
<rdfs:subClassOf>
<daml:Class>
<daml:complementOf rdf:resource="#Person"/>
</daml:Class>
</rdfs:subClassOf>
</daml:Class>
CS6905 Semantic Web Techniques
17-Sep-03
Example: Properties
(Transitive, Inverse, subProperty, UniqueProperty, range, Datatypes)
<daml:TransitiveProperty rdf:ID="hasAncestor"/>
<daml:ObjectProperty rdf:ID="hasChild">
<daml:inverseOf rdf:resource="#hasParent"/>
</daml:ObjectProperty>
<daml:UniqueProperty rdf:ID="hasMother">
<rdfs:subPropertyOf rdf:resource="#hasParent"/>
<rdfs:range rdf:resource="#Female"/>
</daml:UniqueProperty>
<daml:DatatypeProperty rdf:ID="age">
<rdf:type rdf:resource="http://www.daml.org/2001/03/daml+oil#UniqueProperty"/>
<rdfs:range rdf:resource="http://www.w3.org/.../XMLSchema#nonNegativeInteger"/>
</daml:DatatypeProperty>
250
CS6905 Semantic Web Techniques
17-Sep-03
Using User-defined Datatypes
(based on XML Schema)
<xsd:simpleType name="over17">
<!--over17 is an XMLS datatype based on decimal-->
<!--with the added restriction that values must be >=18-->
<xsd:restriction base="xsd:decimal">
<xsd:minInclusive value="18"/>
</xsd:restriction>
</xsd:simpleType>
<daml:Class rdf:ID="Adult">
<daml:intersectionOf rdf:parseType="daml:collection">
<daml:Class rdf:about="#Person"/>
<daml:Restriction>
<daml:onProperty rdf:resource="#age"/>
<daml:hasClass rdf:resource="somefile#over17"/>
</daml:Restriction>
</daml:intersectionOf>
</daml:Class>
251
CS6905 Semantic Web Techniques
17-Sep-03
Instances (Individuals)
<Person rdf:ID="Adam">
<rdfs:label>Adam</rdfs:label>
<rdfs:comment>Adam is a person.</rdfs:comment>
<age><xsd:integer rdf:value="13"/></age>
<shoesize>
<xsd:decimal rdf:value="9.5"/>
</shoesize>
</Person>
<daml:Class rdf:ID="Person">
. . .
</daml:Class>
252
CS6905 Semantic Web Techniques
17-Sep-03
Protégé as OIL Editor

supports following subset of OIL:
–
–
253
class definitions with subclass and slot constraints (property restrictions) with

class expressions: and, or, not, class[names], slot constraints, top, and bottom

slot constraints: has-value, value-type, max-cardinality, min-cardinality, cardinality

missing: concrete-type-exp, filler-exp
slot definitions:

subslot-of, inverse (using Protégé's inverse slot mechanism), domain, range

properties (transitive, symmetric, functional)
–
global axioms (disjoint, covered, disjoint-covered, equivalent)
–
missing: instance-of, related

special widgets for displaying OIL expressions

connects to FaCT description logic classifier for classification and
satisfiability checking

generates SHIQ LaTeX output
CS6905 Semantic Web Techniques
17-Sep-03
Protégé as OIL Editor: Screenshot
254
CS6905 Semantic Web Techniques
17-Sep-03
TRIPLE
255
CS6905 Semantic Web Techniques
17-Sep-03
TRIPLE: Motivation



RDF data available
Needed: Query and Inference Language for/in
RDF
Existing Approaches:
–
–
–
–
256
SiLRI
Metalog
RQL
…
CS6905 Semantic Web Techniques
17-Sep-03
What’s wrong with existing
approaches?

Built in Semantics (e.g. SiLRI, RQL)
–
Many RDF based languages with different Semantics
(DAML+OIL, RDF-Schema, UML/RDF,…)

No support for RDF-Models
–
257
One large heap of RDF-Data
CS6905 Semantic Web Techniques
17-Sep-03
Graph Separated in Models
source1
source2
source3
258
CS6905 Semantic Web Techniques
17-Sep-03
New System: Triple

259
Native support for
– Resources + Namespaces
– Models (sets of RDF statements)
– Reification
– Data Integration/Translation
– Rules with Expressive Bodies (Full FOL Syntax)
CS6905 Semantic Web Techniques
17-Sep-03
Object Expressions + Models







260
http://..123[age->”32”;spouse->http//..256].
http://..123[age->”32”;spouse->http//..256[age->”31”]].
http://..123[age->”32”]@mod1
http://..123[age->”32”]@(mod1 intersect mod2)
http://..123[age->”32”]@(mod1 union mod2)
http://..123[age->”32”]@(mod1 \ mod2)
http://..123[age->”32”]@test(X)
CS6905 Semantic Web Techniques
17-Sep-03
Reification
http://…1234
hasAuthor
“Ora Lassila”
believedBy
“Ralph Swick”
<http://…1234[hasAuthor->”OraLassila”]>[believedBy->”Ralph Swick”].
261
CS6905 Semantic Web Techniques
17-Sep-03
Example: RDF-Schema
Namespace
Declarations
rdf := 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'.
rdfs := 'http://www.w3.org/TR/1999/PR-rdf-schema-19990303#'.
type := rdf:type.
Abbreviations
subPropertyOf := rdfs:subPropertyOf.
subClassOf := rdfs:subClassOf.
Model Block
FORALL Mdl @rdfschema(Mdl) {
FORALL O,P,V O[P->V] <- O[P->V]@Mdl.
FORALL O,P,V O[P->V] <- EXIST S S[subPropertyOf->P] AND O[S->V].
FORALL O,V O[subClassOf->V] <-
Transitivity
Rule
EXISTS W (O[subClassOf->W] AND W[subClassOf->V]).
FORALL O,V O[subPropertyOf->V] <EXISTS W (O[subPropertyOf->W] AND W[subPropertyOf->V]).
FORALL O,T O[type->T] <EXISTS S (S[subClassOf->T] AND O[type->S]).}
262
CS6905 Semantic Web Techniques
17-Sep-03
Mapping to Horn Logic
 first implementation (and informal semantics) by mapping
to Horn Logic / XSB system (Prolog with tabled resolution)
 Lloyd-Topor transformation for quantifiers etc.
 RDF-specific transformations given as rewrite rules:
263
CS6905 Semantic Web Techniques
17-Sep-03
Summary

New RDF specific Query and Inference Language

Allows specification of multiple semantics

Integration/Translation of heterogeneous data
(InterDataWorking.com)
264

Every Horn Logic Inference Engine can be used

Provides a formal foundation for N3

Part of RuleML ( http://www.dfki.de/ruleml )
CS6905 Semantic Web Techniques
17-Sep-03
Topic Maps
265
CS6905 Semantic Web Techniques
17-Sep-03
Topic Maps
• Aiming at User Support for classifying and navigating large corpora
of resources
• Topic Navigation Maps generalize:
– indexes
– glossaries
– thesauri
– catalogs
– cross-references
• Allow browsing as well as querying of Information
• ISO Standard (ISO13250) (defined by the SGML/XML Community)
266
CS6905 Semantic Web Techniques
17-Sep-03
Topic Navigation Maps in a Nutshell I
• Topics (e.g. Germany)
– have a topic-type (e.g. Country)
– at least one base-name (Germany)
– multiple display names (e.g. Federal Republic of Germany)
– have occurrences (in external resources)
(eg. In CIA-World Fact Book:
http://www.odci.gov/cia/publications/factbook/gm.html)
• occurrences have a role: eg. “MENTION” (again a
Topic)
267
CS6905 Semantic Web Techniques
17-Sep-03
Topic Navigation Maps in a Nutshell II





268
Topics can be related to each other via associations
(eg. “Rau is_head_of Germany”)
Association-Types (eg. “is_head_of”) are again a topics.
Association-Roles define the role of a topic in a
association
(“President” for “Rau”, and “Country” for “Germany”).
Association-Roles are again topics.
An association may have a scope
(eg. “Rau is_head_of Germany” has scope “1999-now”)
Axioms (eg. Transitivity or Symmetry) are considered
useful, but not part of the ISO-Standard
CS6905 Semantic Web Techniques
17-Sep-03
Example of a Browsing Interface
269
CS6905 Semantic Web Techniques
17-Sep-03
XML Topic Maps (XTM): Design Goals
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
270
XTM shall be straightforwardly usable over the Internet
XTM shall support a wide variety of applications
XTM shall be compatible with XML, XLink, and ISO 13250
It shall be easy to write programs that process XTM
documents
The number of optional features in XTM is to be kept to the
absolute minimum, ideally zero
XTM documents should be human-legible and reasonably
clear
The XTM design should be prepared quickly
The design of XTM shall be formal and concise
XTM documents shall be easy to create
Terseness in XTM markup is of minimal importance
CS6905 Semantic Web Techniques
17-Sep-03
XML Topic Maps (XTM): Purpose of a
Topic Map
The purpose of a topic map is to
convey knowledge about resources
through a superimposed layer, or map,
of the resources
271
A topic map captures
the subjects of which resources speak,
and the relationships between
subjects, in a way that is implementationindependent
CS6905 Semantic Web Techniques
17-Sep-03
XML Topic Maps (XTM): Topics,
Associations, and Occurrences
•
•
•
•
272
•
A topic is a resource within the computer that stands in for
(or “reifies”) some real-world subject. Examples of subjects:
the play Hamlet, the playwright William Shakespeare, or
the “authorship” relationship
Topics can have names. They can also have occurrences:
information resources considered relevant to their subject.
Finally, topics can participate in relationships, called
associations, in which they play roles as members
Thus, topics have three kinds of characteristics: names,
occurrences, and roles played as members of associations.
Characteristics considered valid within scope or context
Topic maps can be merged: at the discretion of the user or
application (at runtime), or indicated by the topic map's
author at the time of its creation
Terseness in XTM markup is of minimal importance
CS6905 Semantic Web Techniques
17-Sep-03
XML Topic Maps (XTM):
Sample Topic
A topic representing one of William Shakespeare's plays
in XTM might look like this:
<topic id="hamlet">
<instanceOf><topicRef xlink:href="#play"/></instanceOf>
<baseName>
<baseNameString>Hamlet, Prince of Denmark</baseNameString>
</baseName>
<occurrence>
<instanceOf>
<topicRef xlink:href="#plain-text-format"/>
</instanceOf>
<resourceRef
xlink:href="ftp://www.gutenberg.org/pub/gutenberg/etext97/1ws2610.txt"/>
</occurrence>
</topic>
273
CS6905 Semantic Web Techniques
17-Sep-03
XML Topic Maps (XTM):
Sample Association
An association representing the relationship
between Shakespeare and the play Hamlet
might look like this:
<association>
<instanceOf><topicRef xlink:href="#written-by"/></instanceOf>
<member>
<roleSpec><topicRef xlink:href="#author"/></roleSpec>
<topicRef xlink:href="#shakespeare"/>
</member>
<member>
<roleSpec><topicRef xlink:href="#work"/></roleSpec>
<topicRef xlink:href="#hamlet"/>
</member>
</association>
274
CS6905 Semantic Web Techniques
17-Sep-03
Acknowledgements

Stefan Decker and Michael Sintek for their key contributions to starting it all:
http://www.dfki.uni-kl.de/km/knowmark/, http://www.dfki.uni-kl.de/km/kmrs/

William Grosso, Rohit Khare, Peter Karp, Dan Brickley for their kind permission
to use material

Andreas Abecker, Heiko Maus, Andreas Lauer, Hansi Hein, Stefan Klink, Bertin
Klein, and other colleagues at DFKI for fruitful discussions

All colleagues at Karlsruhe, Stanford, ISI, NRC, and UNB for related interactions

Peter Fankhauser for valuable input on query languages

Elliotte Rusty Harold for his XML Bible: http://www.ibiblio.org/xml/books/bible2/

The Joint (Agent Markup Language) Committee and the Rule Markup Initiative
for discussions: http://www.daml.org/committee/, http://www.ruleml.org
275
CS6905 Semantic Web Techniques
17-Sep-03
References
276
CS6905 Semantic Web Techniques
17-Sep-03
References
Cocoon
The Cocoon Publishing Framework. Available at http://xml.apache.org/cocoon/index.html
CSS2
Cascading Style Sheets, level 2. Available at http://www.w3.org/TR/REC-CSS2/
DAML
DARPA Agent Markup Language. Availabe at http://www.oasis-open.org/cover/daml.html ,
http://dtsn.darpa.mil/iso/programtemp.asp?mode=347 , and http://www.daml.org/
Dublin Core
Available at http://purl.oclc.org/dc/
Fernandez99
XML Query Languages: Experiences and Exemplars, Mary Fernandez, Jérôme Siméon, Philip Wadler,
1999. Available at http://www.w3.org/1999/09/ql/docs/xquery.html
FRODO
The FRODO Project. Homepage available at http://www.dfki.uni-kl.de/frodo/
OIL
Ontology Interchange Language. Availabe at http://www.ontoknowledge.org/oil/
Protégé-XML
The Protégé XML-Tab. Available at http://smi-web.stanford.edu/people/sintek/
277
CS6905 Semantic Web Techniques
17-Sep-03
References
Q&T
Querying and Transforming XML. Available at http://www.w3.org/TandS/QL/QL98/pp/query-transform.html
RACSA
Online Demo at http://www.dfki.de/racsa/
RDF
Homepage: http://www.w3.org/RDF/
Specification: http://www.w3.org/TR/REC-rdf-syntax
FAQ: http://www.w3.org/RDF/FAQ
Tutorial: Carl Lagoze et al: WWW7 Tutorial. Available at http://purl.oclc.org/~emiller/talks/www7/tutorial
RDF-Schema
Specification at http://www.w3.org/TR/rdf-schema
RuleML
The Rule Markup Language. Homepage at http://www.ruleml.org or http://www.dfki.de/ruleml
Semantic Web
Portal at http://www.SemanticWeb.org
SHOE
Simple HTML Ontology Extensions. Available at http://www.cs.umd.edu/projects/plus/SHOE/
XML
278
Extensible Markup Language (XML), Version 1.0. W3C Recommendation. Available at
http://www.w3.org/TR/1998/REC-xml-19980210
CS6905 Semantic Web Techniques
17-Sep-03
References
XML Namespaces
Namespaces in XML. W3C Recommendation at http://www.w3.org/TR/REC-xml-names/
XML-QL
XML-QL: A Query Language for XML. Available at http://www.w3.org/TR/NOTE-xml-ql/
XML-RPC
XML Remote Procedure Calls. Available at http://www.xmlrpc.com/
XPath
World Wide Web Consortium. XML Path Language. W3C Recommendation. Available at
http://www.w3.org/TR/xpath
XPointer
World Wide Web Consortium. XML Pointer Language (XPointer). W3C Working Draft. Available at
http://www.w3.org/TR/xptr
XQuery
XQL
XSL
XSLT
279
A Query Language for XML. Available at http://www.w3.org/TR/xquery/
XML Query Language (XQL). Available at http://www.w3.org/TandS/QL/QL98/pp/xql.html
World Wide Web Consortium. Extensible Stylesheet Language (XSL). W3C Working Draft. Available at
http://www.w3.org/TR/WD-xsl
World Wide Web Consortium. XSL Transformations (XSLT). W3C Recommendation. Available at
http://www.w3.org/TR/xslt
CS6905 Semantic Web Techniques
17-Sep-03
Download