Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to the Semantic Web

Similar presentations


Presentation on theme: "Introduction to the Semantic Web"— Presentation transcript:

0 Semantic Web Techniques - Lecture Notes -
Harold Boley Bruce Spencer NRC-IIT Fredericton University of New Brunswick CS 6795 SWT 22 September 2006

1 Introduction to the Semantic Web
CS6795 Semantic Web Techniques 22-Sep-06

2 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 Intro Federal government’s leading R&D agency. National organization - 9 institutes here in Ottawa, 2 in Montreal; other institutes in Victoria, Vancouver, Saskatoon, Winnipeg, London, Halifax, and St. John’s. #000 employees, and an additional 1,000 guest workers at any one time throughout the year. In addition to doing research, one of NRC’s traditional roles has been to provide national facilities - the wind tunnel at Uplands is familiar to anyone who flys into Ottawa. Others are dotted across the country, from the observatories in BC to the wave tank in St. John’s. Our newest facility is the Virtual Environment Technologies Centre in London, Ontario (which will have strong links to institutes in Ottawa, including IIT) NRC also operates a national science library, CISTI, and a network of IRAP Industrial Technology Advisors. CS6795 Semantic Web Techniques 22-Sep-06

3 Institute for Information Technology
There are two aspects to IIT 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 Intro CS6795 Semantic Web Techniques 22-Sep-06

4 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. New Brunswick and Canadian companies already have strengths in all three areas NB’s communications infrastructure and interested telco Bilingual workforce Intro CS6795 Semantic Web Techniques 22-Sep-06

5 CS6795 Semantic Web Techniques
Bruce MMath 83, BNR 83-86, Waterloo PhD 86-90, UNB prof 90-01, NRC 01-now Automated reasoning data structures in theorem proving eliminate redundant searching smallest proofs deductive databases Java in curriculum since 1997 Intro CS6795 Semantic Web Techniques 22-Sep-06

6 CS6795 Semantic Web Techniques
Harold Harold joined NRC-IIT Fredericton as a research officer in Sept 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 Web-based 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 Relational-Functional Markup Language (RFML) and, together with Said Tabet, launched the Rule Markup Initiative (RuleML). Intro CS6795 Semantic Web Techniques 22-Sep-06

7 CS6795 Semantic Web Techniques
Five main points Tim Berners-Lee’s vision web information should be machine understandable Taxonomies of words shared within web communities no single ontology RDF: meta-tags link XML tags to their roles US and European buy-in Where’s Canada Aligns with IIT Fredericton’s thrusts multi-agent, security, OneWeb, voice Intro CS6795 Semantic Web Techniques 22-Sep-06

8 Overview and Course Mindmap
Increasing demand for formalized knowledge on the Web: AI’s chance! XML- & RDF-based markup languages provide a 'universal' storage/interchange format for such Web-distributed 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/ XSDs XSLT OWL DL Stylesheets Semantic Matchers Services/ Agents Transformations RuleML XML XPath Rules Intro RIF Queries XQuery SHOE Frames RDF[S] Acquisition TopicMaps Information Extraction Protégé CS6795 Semantic Web Techniques 22-Sep-06

9 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) Intro CS6795 Semantic Web Techniques 22-Sep-06

10 What your computer sees in HTML
<b>Joe’s Computer Store </b> <br> 365 Yearly Drive Presentation information What your computer sees in XML Intro <location> <name>Joe’s Computer Store </name> <address> 365 Yearly Drive </address> </location> Content description (less ambiguous) CS6795 Semantic Web Techniques 22-Sep-06

11 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> could define address, name, street, … Search engines could then identify mail addresses Consider shopbots being able to find price, quantity, feature, model number, supplier, serial number, acquisition date Assumes that namespaces will be used consistently Intro CS6795 Semantic Web Techniques 22-Sep-06

12 CS6795 Semantic Web Techniques
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 idea: Thesaurus has hierarchies of terms shades of meaning Best idea: Ontology hierarchy of terms and logic conditions Intro CS6795 Semantic Web Techniques 22-Sep-06

13 CS6795 Semantic Web Techniques
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 US Gov funding to define languages, tools 16 project teams OIL is Ontology Inference Layer DAML+OIL is joint DARPA-EU Knowledge Representation is a natural choice Intro CS6795 Semantic Web Techniques 22-Sep-06

14 CS6795 Semantic Web Techniques
Intro CS6795 Semantic Web Techniques 22-Sep-06

15 CS6795 Semantic Web Techniques
SmokedSalmon is the intersection of Smoked and Salmon Smoked Salmon Intro CS6795 Semantic Web Techniques 22-Sep-06

16 CS6795 Semantic Web Techniques
SmokedSalmon is the intersection of Smoked and Salmon Smoked Salmon Gravalax is the intersection of Cured and Salmon, but not Smoked Intro Gravalax CS6795 Semantic Web Techniques 22-Sep-06

17 CS6795 Semantic Web Techniques
SmokedSalmon is the intersection of Smoked and Salmon Smoked Salmon Lox is Smoked, Cured Salmon Gravalax is the intersection of Cured and Salmon, but not Smoked Intro Lox Gravalax CS6795 Semantic Web Techniques 22-Sep-06

18 CS6795 Semantic Web Techniques
The Semantic Web is about having the Internet use common sense. 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 Intro Gravalax Lox CS6795 Semantic Web Techniques 22-Sep-06

19 CS6795 Semantic Web Techniques
OWL Smoked Salmon Gravalax Lox CS6795 Semantic Web Techniques 22-Sep-06

20 Tim Berners- Lee’s Semantic Web
Intro CS6795 Semantic Web Techniques 22-Sep-06

21 RDF Resource Description Framework
Beginning of Knowledge Representation influence on Web Akin to Frames, Entity/Relationship diagrams, or Object/Attribute/Value triples Intro CS6795 Semantic Web Techniques 22-Sep-06

22 CS6795 Semantic Web Techniques
RDF Example <rdf:ProductSpecs about= “http://www.lemoncomputers.ca/model_2300”> <specs:colour>yellow</specs:colour> <specs:size>medium</specs:size> </rdf:ProductSpecs> Intro model_2300 size colour medium yellow CS6795 Semantic Web Techniques 22-Sep-06

23 CS6795 Semantic Web Techniques
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 lemon_palmtop_20000 is_a Intro model_2300 size colour medium yellow CS6795 Semantic Web Techniques 22-Sep-06

24 Tim Berners- Lee’s Semantic Web
Intro CS6795 Semantic Web Techniques 22-Sep-06

25 Ontology Web Language: W3C
Previously known as DAML+OIL US: DARPA Agent Markup Language EU: Ontology Interchange Layer (Language) Composed of a hierarchy with additional conditions Based on Description logic, limited expressivenss Reasoning procedures are well-behaved Just enough power Intro CS6795 Semantic Web Techniques 22-Sep-06

26 Identifying Resources
URL/URI Uniform resource locator / identifier Information sources, goods and services financial instruments money, options, investments, stocks, etc. “Where do you want to go today?” becomes “What do you want to find?” Intro CS6795 Semantic Web Techniques 22-Sep-06

27 CS6795 Semantic Web Techniques
Ontology Branch of philosophy dealing with the theory of being Tarski’s assumption: individuals, relationships and functions “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 others can join in Intro CS6795 Semantic Web Techniques 22-Sep-06

28 CS6795 Semantic Web Techniques
Ontology Layer Widens interoperability and interconversion knowledge representation More meta-information Which attributes are transitive, symmetric Which relations between individuals are 1-1, 1-many, many-many Communities exist DL, OIL, SHOE (Hendler) New W3C working group Intro CS6795 Semantic Web Techniques 22-Sep-06

29 Transitive, Subrole example
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 Intro CS6795 Semantic Web Techniques 22-Sep-06

30 Combining Rich Ontologies
Connected by Acadian Lines Sydney Truro Amherst Only these facts are explicit in separate ontologies “Connected by bus” is superset is symmetric and transitive Route from Sydney to Fredericton is inferred Fredericton Connected by SMT Lines Sussex Amherst Intro CS6795 Semantic Web Techniques 22-Sep-06

31 Tim Berners- Lee’s Semantic Web
Intro CS6795 Semantic Web Techniques 22-Sep-06

32 CS6795 Semantic Web Techniques
Logic Layer Clausal logic encoded in XML RuleML, IBM CommonRules Special cases of first-order logic Horn Clauses for if-then type reasoning and integrity constraints Standard inference rules based on Resolution Various implementations: SQL, KIF, SLD (Prolog), XSB J-DREW reasoning tools in Java. Modus operandi: build tractable reasoning systems trade away expressiveness, gain efficiency Intro CS6795 Semantic Web Techniques 22-Sep-06

33 Logic Architecture Example
Contracting parties integrate e-businesses via rules Seller E-Storefront Buyer’s ShopBot Business Rules Business Rules Intro Contract Rules Interchange OPS5 Prolog CS6795 Semantic Web Techniques 22-Sep-06

34 CS6795 Semantic Web Techniques
Negotiation via rules usualPrice: price(per-unit, ?PO, $60)  purchaseOrder(?PO, supplierCo, ?AnyBuyer)  shippingDate(?PO, ?D) (?D  24April2001). volumeDiscountPrice: price(per-unit, ?PO, $55)  quantityOrdered(?PO, ?Q) (?Q  1000)  overrides(volumeDiscount, usualPrice). Intro CS6795 Semantic Web Techniques 22-Sep-06

35 CS6795 Semantic Web Techniques
Hot Research Topics: Tools to create ontologies Ontolingua Protégé-2000 (Stanford) OILED 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 SHOE Intro CS6795 Semantic Web Techniques 22-Sep-06

36 Eventual Goal of these Efforts
Agents locate goods, services use ontologies unambiguous business rules expressive language but reasoning tractable combine from various sources Gives rise to need of trust, privacy and security e.g. semantic web project to determine eligibility of patients for a clinical trial Intro CS6795 Semantic Web Techniques 22-Sep-06

37 Extensible Markup Language
XML XML CS6795 Semantic Web Techniques 22-Sep-06

38 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) XML CS6795 Semantic Web Techniques 22-Sep-06

39 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. XML Even transformation/compilation of AI source programs using XML markup and annotations is possible CS6795 Semantic Web Techniques 22-Sep-06

40 Address Example: External to HTML
External Presentation: Xaver M. Linde Wikingerufer 7 10555 Berlin HTML tags are still presentation-oriented XML HTML Markup: <em>Xaver M. Linde</em> <br> Wikingerufer 7 <strong>10555 Berlin</strong> CS6795 Semantic Web Techniques 22-Sep-06

41 Address Example: HTML to XML
HTML Markup: While not conveying any formal semantics: <em>Xaver M. Linde</em> <br> Wikingerufer 7 <strong>10555 Berlin</strong> XML tags are chosen for content-structuring needs XML XML Markup: <address> <name>Xaver M. Linde</name> <street>Wikingerufer 7</street> <town>10555 Berlin</town> </address> CS6795 Semantic Web Techniques 22-Sep-06

42 Address Example: XML to External
XML Markup: <address> <name>Xaver M. Linde</name> <street>Wikingerufer 7</street> <town>10555 Berlin</town> </address> XML XML stylesheets are, e.g., usable to generate different presentations External Presentations: Xaver M. Linde Wikingerufer 7 10555 Berlin Xaver M. Linde Wikingerufer 7 10555 Berlin . . . CS6795 Semantic Web Techniques 22-Sep-06

43 Address Example: XML to XML
XML Markup 1: <address> <name>Xaver M. Linde</name> <street>Wikingerufer 7</street> <town>10555 Berlin</town> </address> XML stylesheets are also usable to transform XML representations XML XML Markup 2: <address> <name>Xaver M. Linde</name> <place> <street>Wikingerufer 7</street> <town>10555 Berlin</town> </place> </address> CS6795 Semantic Web Techniques 22-Sep-06

44 CS6795 Semantic Web Techniques
Address Example: Some Stylesheets Will Contain Term-(Tree-)Rewriting Rules address name street town N S T XML address name place street town N S T CS6795 Semantic Web Techniques 22-Sep-06

45 Address Example: XML Queries
XML Markup: subelements element <address> <name>Xaver M. Linde</name> <street>Wikingerufer 7</street> <town>10555 Berlin</town> </address> s XML Query (XML-QL): XML WHERE <address> <name>Xaver M. Linde</name> <street>$s</street> <town>$t</town> </address> CONSTRUCT <binding> <s>$s</s> <t>$t</t> </binding> XML queries can select subelements of XML elements <binding> <s>Wikingerufer 7</s> <t>10555 Berlin</t> </binding> CS6795 Semantic Web Techniques 22-Sep-06

46 Address Example: Prolog Queries
Prolog Term: address( name("Xaver M. Linde"), street("Wikingerufer 7"), town("10555 Berlin") ) substructures s structure XML Prolog Query: address( name("Xaver M. Linde"), street(S), town(T) ) Prolog queries can select substructures of Prolog structures S = "Wikingerufer 7" T = "10555 Berlin" CS6795 Semantic Web Techniques 22-Sep-06

47 Address Example: The Element Tree
<name>Xaver M. Linde</name> <street>Wikingerufer 7</street> <town>10555 Berlin</town> </address> XML Markup: element s subelements address( name("Xaver M. Linde"), street("Wikingerufer 7"), town("10555 Berlin") ) Prolog Term: structure s substructures XML Node-Labeled, (Left-to-Right-)Ordered Element Tree: address Xaver M. Linde Wikingerufer 7 10555 Berlin name street town subtrees tree CS6795 Semantic Web Techniques 22-Sep-06

48 Address Example: Document Type Definition and Tree (1)
Document Type Definition (DTD): Extended Backus-Naur Form (EBNF): <!ELEMENT address (name, street, town) > <!ELEMENT name (#PCDATA) > <!ELEMENT street (#PCDATA) > <!ELEMENT town (#PCDATA) > address ::= name street town name ::= PCDATA street ::= PCDATA town ::= PCDATA XML Document Type Tree: address PCDATA name street town CS6795 Semantic Web Techniques 22-Sep-06

49 Address Example: Document Type Definition and Tree (2)
Document Type Definition (DTD): <!ELEMENT address (name, place) > <!ELEMENT place (street, town) > <!ELEMENT name (#PCDATA) > <!ELEMENT street (#PCDATA) > <!ELEMENT town (#PCDATA) > Document Type Tree: XML address name place PCDATA street town PCDATA PCDATA CS6795 Semantic Web Techniques 22-Sep-06

50 Well-Formedness and Validity
XML principles for a document being well-formed: XML principle for a document being valid with respect to (w.r.t.) a DTD : 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 Match the constraints listed in the DTD (or, generate from DTD as linearized derivation tree, as shown later) XML Checked by validators such as CS6795 Semantic Web Techniques 22-Sep-06

51 Mail-Box Example: Address Variant
<name>Xaver M. Linde</name> <box>2001</box> <town>10555 Berlin</town> </address> XML Markup: address( name("Xaver M. Linde"), box("2001"), town("10555 Berlin") ) Prolog Term: XML Node-Labeled, (Left-to-Right-)Ordered Element Tree: address Xaver M. Linde 2001 10555 Berlin name box town CS6795 Semantic Web Techniques 22-Sep-06

52 CS6795 Semantic Web Techniques
"|"-Disjoined Street/Mail-Box Example: Document Type Definition and Tree Document Type Definition (DTD): <!ELEMENT address (name, (street | box), town) > <!ELEMENT name (#PCDATA) > <!ELEMENT street (#PCDATA) > <!ELEMENT box (#PCDATA) > <!ELEMENT town (#PCDATA) > "|": Choice The above box address and the original street address are valid w.r.t. this "|"-DTD XML Document Type Tree: address name street box town PCDATA PCDATA PCDATA PCDATA CS6795 Semantic Web Techniques 22-Sep-06

53 Phone & Fax Example: Address Variant
<name>Xaver M. Linde</name> <street>Wikingerufer 7</street> <town>10555 Berlin</town> <phone>030/ </phone> <phone>030/ </phone> <fax>030/ </fax> </address> XML Markup: Prolog Term: address( name("Xaver M. Linde"), street("Wikingerufer 7"), town("10555 Berlin"), phone("030/ "), phone("030/ "), fax("030/ ") ) XML Node-Labeled, (Left-to-Right-)Ordered Element Tree: address name street town phone phone fax Xaver M. Linde Wikingerufer 7 10555 Berlin 030/ 030/ 030/ CS6795 Semantic Web Techniques 22-Sep-06

54 CS6795 Semantic Web Techniques
"+"/"*"-Repetitive-Phone & -Fax Example: Document Type Definition and Tree Document Type Definition (DTD): <!ELEMENT address (name, street, town, phone+, fax*) > <!ELEMENT name (#PCDATA) > <!ELEMENT street (#PCDATA) > <!ELEMENT town (#PCDATA) > <!ELEMENT phone (#PCDATA) > <!ELEMENT fax (#PCDATA) > "+"/"*": One/Zero or More The above two-phone/one-fax address is valid w.r.t. this "+"/"*"-DTD but the original no-phone/no-fax address is not (1 phone!) XML Document Type Tree: address name street town phone fax PCDATA PCDATA PCDATA PCDATA PCDATA CS6795 Semantic Web Techniques 22-Sep-06

55 Country Example: Address Variant
<name>Xaver M. Linde</name> <street>Wikingerufer 7</street> <town>10555 Berlin</town> <country>Germany</country> </address> XML Markup: Prolog Term: address( name("Xaver M. Linde"), street("Wikingerufer 7"), town("10555 Berlin"), country("Germany") ) XML Node-Labeled, (Left-to-Right-)Ordered Element Tree: address name street town country Xaver M. Linde Wikingerufer 7 10555 Berlin Germany CS6795 Semantic Web Techniques 22-Sep-06

56 "?"-Optional-Country Example: Document Type Definition and Tree
Document Type Definition (DTD): <!ELEMENT address (name, street, town, country?) > <!ELEMENT name (#PCDATA) > <!ELEMENT street (#PCDATA) > <!ELEMENT town (#PCDATA) > <!ELEMENT country (#PCDATA) > "?": One or Zero The above country address and the original countriless address are valid w.r.t. this "?"-DTD XML Document Type Tree: address name street town country PCDATA PCDATA PCDATA PCDATA CS6795 Semantic Web Techniques 22-Sep-06

57 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> XML The XML declaration uses standalone attribute with "no" value: DTD import 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") CS6795 Semantic Web Techniques 22-Sep-06

58 "minOccurs"-Optional-Country Example: XML Schema Definition
Equivalent XML Schema Definition (XSD): <?xml version="1.0"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="address"> <xsd:complexType> <xsd:sequence> <xsd:element name="name" type="xsd:string"/> <xsd:element name="street" type="xsd:string"/> <xsd:element name="town" type="xsd:string"/> <xsd:element name="country" type="xsd:string" minOccurs="0"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> XML CS6795 Semantic Web Techniques 22-Sep-06

59 "minOccurs"-Optional-Country Example: XML Schema Tree
Equivalent Document Schema Tree: address xsd:string name street town country XML CS6795 Semantic Web Techniques 22-Sep-06

60 Country Address: A Complete XML Document Referring to an External XSD
Equivalent XML Document (just ASCII, e.g. stored in a file): <?xml version="1.0"?> <address xsi:noNamespaceSchemaLocation="country-address.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > <name>Xaver M. Linde</name> <street>Wikingerufer 7</street> <town>10555 Berlin</town> <country>Germany</country> </address> XML The xsi:noNamespaceSchemaLocation attribute is embedded in the root element address and refers to an external XSD "country-address.xsd" (or, at some absolute URL, to an "http://www.test.org/country-address.xsd") CS6795 Semantic Web Techniques 22-Sep-06

61 Horn Logic Markup Languages
HornML HornML CS6795 Semantic Web Techniques 22-Sep-06

62 CS6795 Semantic Web Techniques
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: HornML <struc> <constructor>undersea-connection</constructor> <ind>britain</ind> <ind>france</ind> </struc> CS6795 Semantic Web Techniques 22-Sep-06

63 Herbrand Terms: ..., Nested Ground Structures
<constructor>service-tunnel</constructor> <constructor>undersea-connection</constructor> <ind>britain</ind> <constructor>surrounded-country</constructor> <ind>belgium</ind> <ind>luxembourg</ind> <ind>germany</ind> <ind>switzerland</ind> <ind>italy</ind> <ind>spain</ind> </struc> Embedded <struc> elements: service-tunnel( undersea-connection( britain, surrounded-country( belgium, luxembourg, germany, switzerland, italy, spain))) HornML CS6795 Semantic Web Techniques 22-Sep-06

64 Interim Discussion: Tag and Type
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” HornML CS6795 Semantic Web Techniques 22-Sep-06

65 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 <relationship> <ind>john</ind> <ind>channel-tunnel</ind> </relationship> HornML CS6795 Semantic Web Techniques 22-Sep-06

66 CS6795 Semantic Web Techniques
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 <hn> <relationship> <relator>travel</relator> <ind>john</ind> <ind>channel-tunnel</ind> </relationship> </hn> HornML CS6795 Semantic Web Techniques 22-Sep-06

67 CS6795 Semantic Web Techniques
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 travel(Someone,channel-tunnel) :- carry(eurostar,Someone). <hn> <relationship> <relator>travel</relator> <var>someone</var> <ind>channel-tunnel</ind> </relationship> <relator>carry</relator> <ind>eurostar</ind> </hn> and rewritten as HornML CS6795 Semantic Web Techniques 22-Sep-06

68 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> 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 HornML CS6795 Semantic Web Techniques 22-Sep-06

69 CS6795 Semantic Web Techniques
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): <hn id="john-channel"> <relationship> <relator>travel</relator> <ind>john</ind> <ind>channel-tunnel</ind> </relationship> </hn> HornML CS6795 Semantic Web Techniques 22-Sep-06

70 CS6795 Semantic Web Techniques
ID and IDREF 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’ HornML CS6795 Semantic Web Techniques 22-Sep-06

71 DTDs: Elements as Derivation Trees
Up to now: Examples for Horn Logic in XML etc. Now: 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 HornML CS6795 Semantic Web Techniques 22-Sep-06

72 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) > <!ELEMENT ind (#PCDATA) > <!ELEMENT var (#PCDATA) > HornML Note struc recursion! CS6795 Semantic Web Techniques 22-Sep-06

73 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 <kb> hn* </kb> <kb> <hn> relationship relationship </hn> </kb> <kb> <hn> <relationship> <relator>#PCDATA</relator> <var>#PCDATA</var> <ind>#PCDATA</ind> </relationship> <relator>#PCDATA</relator> <ind>#PCDATA</ind> <var>#PCDATA</var> </hn> </kb> HornML CS6795 Semantic Web Techniques 22-Sep-06

74 DTDs: Generation of the Example Rule (2)
<kb> <hn> <relationship> <relator>travel</relator> <var>someone</var> <ind>channel-tunnel</ind> </relationship> <relator>carry</relator> <ind>eurostar</ind> </hn> </kb> HornML CS6795 Semantic Web Techniques 22-Sep-06

75 CS6795 Semantic Web Techniques
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)*) > <!ELEMENT prop EMPTY > HornML CS6795 Semantic Web Techniques 22-Sep-06

76 CS6795 Semantic Web Techniques
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 HornML CS6795 Semantic Web Techniques 22-Sep-06

77 Horn Queries in XML Notation
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: <ind>eurostar</ind> carry(eurostar,Someone) <var>someone</var> by binding <var>someone</var> Someone to <ind>fred</ind> fred HornML CS6795 Semantic Web Techniques 22-Sep-06

78 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 travel(fred,Where)  carry(eurostar,Someone)  true HornML Someone=fred Where=channel-tunnel Where=channel-tunnel CS6795 Semantic Web Techniques 22-Sep-06

79 Horn Inferences in XML Notation (2)
Rule: <hn> <relationship> <relator>travel</relator> <var>someone</var> <ind>channel-tunnel</ind> </relationship> <relator>carry</relator> <ind>eurostar</ind> </hn> Fact: <hn> <relationship> <relator>carry</relator> <ind>eurostar</ind> <ind>fred</ind> </relationship> </hn> HornML 3-Step Animation: <ind where="channel-tunnel"> true </ind> <relationship> <relator>travel</relator> <ind>fred</ind> <var>where</var> </relationship> <relationship someone="fred" where="channel-tunnel"> <relator>carry</relator> <ind>eurostar</ind> <var>someone</var> </relationship> CS6795 Semantic Web Techniques 22-Sep-06

80 Horn Inferences in XML Notation (2)
Rule: <hn> <relationship> <relator>travel</relator> <var>someone</var> <ind>channel-tunnel</ind> </relationship> <relator>carry</relator> <ind>eurostar</ind> </hn> Fact: <hn> <relationship> <relator>carry</relator> <ind>eurostar</ind> <ind>fred</ind> </relationship> </hn> HornML 3-Step Animation: <relationship> <relator>travel</relator> <ind>fred</ind> <var>where</var> </relationship> CS6795 Semantic Web Techniques 22-Sep-06

81 Horn Inferences in XML Notation (2)
Rule: <hn> <relationship> <relator>travel</relator> <var>someone</var> <ind>channel-tunnel</ind> </relationship> <relator>carry</relator> <ind>eurostar</ind> </hn> Fact: <hn> <relationship> <relator>carry</relator> <ind>eurostar</ind> <ind>fred</ind> </relationship> </hn> HornML 3-Step Animation: <relationship someone="fred" where="channel-tunnel"> <relator>carry</relator> <ind>eurostar</ind> <var>someone</var> </relationship> CS6795 Semantic Web Techniques 22-Sep-06

82 Horn Inferences in XML Notation (2)
Rule: <hn> <relationship> <relator>travel</relator> <var>someone</var> <ind>channel-tunnel</ind> </relationship> <relator>carry</relator> <ind>eurostar</ind> </hn> Fact: <hn> <relationship> <relator>carry</relator> <ind>eurostar</ind> <ind>fred</ind> </relationship> </hn> HornML 3-Step Animation: <ind where="channel-tunnel"> true </ind> CS6795 Semantic Web Techniques 22-Sep-06

83 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 HornML CS6795 Semantic Web Techniques 22-Sep-06

84 The Java Deductive Reasoning Engine for the Web
j-DREW j-DREW CS6795 Semantic Web Techniques 22-Sep-06

85 Train people to build the Rule-based web services
Courses on systems employing rule engines and Internet applications Writing deduction engines in Java/C/C++ Interfacing with Internet API Old techniques (Prolog 30 years ago) New techniques from CADE System Competition Meier and Warren’s book: Programming in Logic, 1988 Updated in Java? Specific to Prolog at low level j-DREW CS6795 Semantic Web Techniques 22-Sep-06

86 CS6795 Semantic Web Techniques
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 Propositional theorem prover how to interface to Internet j-DREW CS6795 Semantic Web Techniques 22-Sep-06

87 CS6795 Semantic Web Techniques
This talk Architecture for building deduction systems first order easily configured forward or backward embedded supports calls to and from rest of system Tour of internals backward & forward engines tree/proof terms bindings discrimination tree Prototypes j-DREW CS6795 Semantic Web Techniques 22-Sep-06

88 Choose the right abstractions
Goal, Unifier, ProofTree use Java iterators: pay as you go for finding the next proof Make every Goal responsible for its list of matching clauses hasNextMatchingClause() attachNextMatchingClause() Place Goals in stack of backtrack points popped in reverse chronological order j-DREW CS6795 Semantic Web Techniques 22-Sep-06

89 Propositional Prover: 1
initially proofTree has an open Goal loop if(proofTree.hasNoOpenGoal()) halt('success'); else Goal g = proofTree.selectOpenGoal(); g.createMatchingClauseList(); if(g.hasMoreMatchingClauses()) g.attachNextMatchingClause(); choicePoints.push(g); chronologicalBacktrack(); j-DREW CS6795 Semantic Web Techniques 22-Sep-06

90 Propositional Prover: 2
chronologicalBacktrack while(not choicePoints.empty()) Goal g = choicePoints.pop(); g.removeAttachedClause(); if(g.hasMoreMatchingClauses()) return halt('failure'); j-DREW CS6795 Semantic Web Techniques 22-Sep-06

91 CS6795 Semantic Web Techniques
Propositional Prover chronologicalBacktrack while(choicePoints.nonEmpty()) Goal g = choicePoints.pop(); g.removeAttachedClause(); if(g.hasMoreClauses()) return; halt('failure') 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); chronologicalBacktrack(); Remove bindings NEW Java Iterator j-DREW Create bindings CS6795 Semantic Web Techniques 22-Sep-06

92 Tree with initial goal p(Z)
p(X) :- q(X), r(X). q(g(X)). q(k). r(g(h)) NEW ?:-p(Z) a ChoicePoints j-DREW p(Y1) :- q(Y1), r(Y1) q(g(Y2)) r(g(h)) b c Y1/g(Y2) Y2/h q(k) Y1/k b’ b a Z/Y1 CS6795 Semantic Web Techniques 22-Sep-06

93 Moving to First Order Logic
Students struggle with variables Unification Composition of substitutions Unbinding on backtracking Can we hide the hard stuff? Powerful abstraction j-DREW CS6795 Semantic Web Techniques 22-Sep-06

94 CS6795 Semantic Web Techniques
Hiding the hard stuff proof tree goal When attaching a clause to a Goal Matching clause must be an instance of input clause Semi-unification creates the instance Bindings to variables in goal may be propagated through tree now or later When removing the clause relax any propagated variable bindings p(a, Y) input clause p(X, b) :- … j-DREW clause instance p(a, b) :- … propagated binding Yb CS6795 Semantic Web Techniques 22-Sep-06

95 Shallow or deep variables?
variable binding is a list of replacements traverse list for each lookup undoing: remove most recent replacements {X  f(Y)}  {Y  a} Shallow an array of (all) variables and their current values [X  f(a) Y  a …] undoing: pop stack of previous values (trail) j-DREW CS6795 Semantic Web Techniques 22-Sep-06

96 Choosing between shallow and deep
pay for each lookup (deep search) unbinding is cheap Shallow lookup is cheap (shallow search) may need many large arrays of possible variables j-DREW uses local shallow each clause has own array of just local variables, named –1, -2, … scope is clause-wide so propagation necessary j-DREW CS6795 Semantic Web Techniques 22-Sep-06

97 Goal Tree and flatterms
p Each node has head and body atoms Body atoms form goals attach children resolved p1 from d  p1, …, pm against q from q  q1, …, qn resolved pm against r . p1 pm D C q r j-DREW q1 qn CS6795 Semantic Web Techniques 22-Sep-06

98 Flatterms to represent atoms
j-DREW uses flatterms Array of pairs: 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 j-DREW CS6795 Semantic Web Techniques 22-Sep-06

99 Variables are clause-specific
Variables use negative indexes Bindings are references to flatterm & position Unifier X  g2 Y  f(g2) W  h(g2) Z  f(g2) j-DREW CS6795 Semantic Web Techniques 22-Sep-06

100 Composing and undoing Bindings
Local shallow bindings currently do not allow composition bindings must be done to a flatterm new binding on a new flatterm Backtracking is integrated with unbinding for quick unbinding, we use a stack of flatterms for each goal. j-DREW CS6795 Semantic Web Techniques 22-Sep-06

101 Evaluation of local shallow bindings
Disadvantage for backtracking must propagate bindings to other nodes Advantage fast interaction with rest of system simple, no environments to pass around compact, no large arrays Appropriate for forward chaining no backtracking, no propagation Probably appropriate when backward chaining function-free logic Design decision to revisit j-DREW CS6795 Semantic Web Techniques 22-Sep-06

102 CS6795 Semantic Web Techniques
Discrimination trees Given a goal we want to access matching clauses quickly Every-argument addressing unlike Prolog’s first argument addressing Useful for RDF triples a pattern may have variable in first argument rdf(X, ownedby, ‘Ora Lassila’) j-DREW CS6795 Semantic Web Techniques 22-Sep-06

103 CS6795 Semantic Web Techniques
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 * imperfect discrimination merge prefixes as much as possible a tree arises * p q r f g1 h g2 j-DREW We added p(f(g1 ),h(g2 ),g1 ) p(f(h( X )),h(Y ),f(Z, Z)) CS6795 Semantic Web Techniques 22-Sep-06

104 Finding heads for goal p(X,h(g2),Y)
q r f g1 h * g2 replace vars in goal by * p(*,h(g2),*) Find instances of goal * in goal, skip subtree j-DREW Find generalizations of goal * in tree, skip term in goal Find unifiable combination of both p(f(g1 ),h(g2 ),g1 ) p(f(h( X )),h(Y ),f(Z, Z)) CS6795 Semantic Web Techniques 22-Sep-06

105 Iterator for matching clauses
We use Java idioms where possible Java’s iterators give access to sequence next() hasNext() Used for access to sequence of matching clauses used in discrimination tree for access to roots leaves of skipped tree (McCune’s term: jump-list) j-DREW CS6795 Semantic Web Techniques 22-Sep-06

106 CS6795 Semantic Web Techniques
NEW j-DREW CS6795 Semantic Web Techniques 22-Sep-06

107 CS6795 Semantic Web Techniques
SmokedSalmon is the intersection of Smoked and Salmon Smoked Salmon NEW j-DREW CS6795 Semantic Web Techniques 22-Sep-06

108 CS6795 Semantic Web Techniques
SmokedSalmon is the intersection of Smoked and Salmon Smoked Salmon NEW Gravalax is the intersection of Cured and Salmon, but not Smoked j-DREW Gravalax CS6795 Semantic Web Techniques 22-Sep-06

109 CS6795 Semantic Web Techniques
SmokedSalmon is the intersection of Smoked and Salmon Smoked Salmon NEW Lox is Smoked, Cured Salmon Gravalax is the intersection of Cured and Salmon, but not Smoked j-DREW Lox Gravalax CS6795 Semantic Web Techniques 22-Sep-06

110 CS6795 Semantic Web Techniques
NEW 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 j-DREW Gravalax Lox The Semantic Web vision is to make information on the web “understood” by computers, for searching, categorizing, … CS6795 Semantic Web Techniques 22-Sep-06

111 CS6795 Semantic Web Techniques
NEW Smoked Salmon j-DREW Gravalax Lox CS6795 Semantic Web Techniques 22-Sep-06

112 CS6795 Semantic Web Techniques
One possible encoding Search criteria: retrieve(P) :- about(P, cured), about(P, salmon). Ontology: about(P, cured) :- about(P, gravalax). about(P, salmon) :- A search for keywords Salmon and Cured should return pages that mention Gravalax, even if they don’t mention Salmon and Cured. NEW j-DREW about(p1, gravalax). retrieve(p1) succeeds CS6795 Semantic Web Techniques 22-Sep-06

113 CS6795 Semantic Web Techniques
A search for Salmon and Smoked will return pages with smoked salmon, should also return pages with Lox, but not Gravalax. retrieve(P) :- about(P, smoked), about(P, salmon). about(P, cured) :- about(P, lox). about(P, salmon) :- about(P, smoked) :- about(P, gravalax). NEW j-DREW about(p1, gravalax). about(p2, lox). retrieve(p1) fails retrieve(p2) succeeds CS6795 Semantic Web Techniques 22-Sep-06

114 CS6795 Semantic Web Techniques
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 available to rest of system Negation as failure j-DREW CS6795 Semantic Web Techniques 22-Sep-06

115 More working prototypes: Variants of Top-Down Engine
User directed User selects goals User chooses clauses keeps track of clauses still left to try Good teaching tool Bounded search iteratively increase bound every resolution in search space will eventually be tried a fair selection strategy Original variable names supplied particularly important for RuleML j-DREW CS6795 Semantic Web Techniques 22-Sep-06

116 When to propagate bindings?
When all subgoals closed (1) best option if selecting deepest goal When new clause is attached to all delayed goals (2) best option if sound negation or delaying goals to all open goals (3) best option if user selects Propagation on demand (4) lazy propagation Currently (1) and (3) working proof tree goal p(a, Y) input clause p(X, b) :- … j-DREW clause instance p(a, b) :- … propagated binding Yb CS6795 Semantic Web Techniques 22-Sep-06

117 Not-yet-working: Calls to user’s Java code
Want this to incur little overhead Java programmer uses flatterms Interface to symbol table symbol lookup add new symbols Argument list: an array of symbols Works with backtracking User’s Java procedure is an iterator Works with forward reasoning j-DREW CS6795 Semantic Web Techniques 22-Sep-06

118 CS6795 Semantic Web Techniques
Dynamic additions Some asynchronous process loads new rules push technology Backward chaining additions are unnatural Using iterative bounds look for additions between bounds Forward chaining (next) j-DREW CS6795 Semantic Web Techniques 22-Sep-06

119 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. 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 j-DREW CS6795 Semantic Web Techniques 22-Sep-06

120 Theorem Prover’s Search Procedure
main loop select new fact for each matching rule resolve process new result add to old facts Priority queue new facts Discrimination trees: used facts rules, indexed on first goal NEW 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 j-DREW CS6795 Semantic Web Techniques 22-Sep-06

121 Event – Condition - Action
Suppose theorem prover saturates may need datalog, subsumption Then a new fact is added from push process Java event listener adding a fact restarts saturation could generate new Java events ECA interaction with Java 1.1 events j-DREW CS6795 Semantic Web Techniques 22-Sep-06

122 j-DREW sound and complete
Sound unification Search complete variant fair search procedure rather than depth-first uses increasing bounds Sound negation delay negation-as-failure subgoals until ground or until only NAF goals remain j-DREW CS6795 Semantic Web Techniques 22-Sep-06

123 CS6795 Semantic Web Techniques
Related Work j-DREW compared to Prolog j-DREW not compiled More flexible Dynamic additions Web-ized Programmer’s API Performance requirements different j-DREW unlikely to yield megalips j-DREW CS6795 Semantic Web Techniques 22-Sep-06

124 CS6795 Semantic Web Techniques
Related Work Mandarax easy to use RuleML editor and engine CommonRules compiles priorities Datalog also top-down, bottom up shares view of single semantics for both j-DREW CS6795 Semantic Web Techniques 22-Sep-06

125 CS6795 Semantic Web Techniques
Summary Architecture for Java-based reasoning engines forward & backward Backward: variable binding/unbinding automatic tied with choicepoints configurable Integrated with other Java APIs Small footprint Depolyed as thread, on server, on client, mobile Dynamic additions to rules Integration of RuleML and Prolog rules in same proofs Proofs available j-DREW CS6795 Semantic Web Techniques 22-Sep-06

126 CS6795 Semantic Web Techniques
j-DREW BU CS6795 Semantic Web Techniques 22-Sep-06

127 CS6795 Semantic Web Techniques
Todays Topics Resolution top down and bottom up j-DREW BU procedure Subsumption change to procedure Infinite Loops RuleML input Prolog output CS6795 Semantic Web Techniques 22-Sep-06

128 CS6795 Semantic Web Techniques
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) brother(‘Harry’, future_king(‘England’)) passes(‘Fang’, cs6999) 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 one positive literal and any number of negative literals CS6795 Semantic Web Techniques 22-Sep-06

129 CS6795 Semantic Web Techniques
Resolution Given two clauses, to form the resolvent: find two literals, one from each clause, that can be made to match (with assignments to the variables) differ in sign construct the disjunction of all literals except these two apply the substitution Resolve b(X) \/ ~c(X, 3) against c(2, Y) \/ ~d(Y, Z) gives b(2) \/ ~d(3, Z) In rule notation b(X)  c(X, 3) against c(2, Y)  d(Y, Z) gives b(2)  d(3, Z) CS6795 Semantic Web Techniques 22-Sep-06

130 CS6795 Semantic Web Techniques
Bottom Up Reasoning Single literal definite clauses are called facts passes(‘Fang’, cs6999) Resolving a fact against a condition in a rule is called forward reasoning 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 so forward reasoning also called bottom up reasoning Prolog does top-down, backward reasoning starting from a negative clause, called a query CS6795 Semantic Web Techniques 22-Sep-06

131 CS6795 Semantic Web Techniques
j-DREW Bottom Up More or less efficient than top down? depends on details of each search method More can reuse subderivations saves space and time Less Less goal directed Much unfocused search Infinite loops possible with both j-DREW BU CS6795 Semantic Web Techniques 22-Sep-06

132 Theorem Prover’s Search Procedure
main loop select new fact for each matching rule resolve process new result add to old facts Priority queue new facts Discrimination trees: used facts rules, indexed on first goal 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 CS6795 Semantic Web Techniques 22-Sep-06

133 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) CS6795 Semantic Web Techniques 22-Sep-06

134 CS6795 Semantic Web Techniques
Subsumption A clause C subsumes a clause D if there is a substitution  such that C  D C is more general than D Given C you do not need D We use subsumption between facts (atoms) Atoms C subsumes atom D if there exists  such that C = D Subsumption is checked by first grounding all variables in D to new constants then trying to unify C with grounded D CS6795 Semantic Web Techniques 22-Sep-06

135 CS6795 Semantic Web Techniques
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? experience shows that subsumption on selection is better What about subsumption of rules? CS6795 Semantic Web Techniques 22-Sep-06

136 Theorem Prover’s Search Procedure
main loop select new fact if it is not forward subsumed for each matching rule resolve process new result add to old facts Priority queue new facts Discrimination trees: used facts rules, indexed on first goal 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 CS6795 Semantic Web Techniques 22-Sep-06

137 Event – Condition - Action
Suppose theorem prover saturates Then a new fact is added from push process Java event listener adding a fact restarts saturation could generate new Java events ECA interaction with Java 1.1 events CS6795 Semantic Web Techniques 22-Sep-06

138 CS6795 Semantic Web Techniques
System Architecture j-DREW runs Listeners register with Broadcaster New fact added New conclusions drawn Events sent to Listeners Listener Listener j-DREW BU Listener New Fact Listener Rules Old Facts Event Broadcaster New Facts New Facts CS6795 Semantic Web Techniques 22-Sep-06

139 CS6795 Semantic Web Techniques
<imp> <_head> <atom> <_opr><rel>discount</rel></_opr> <var>customer</var> <var>product</var> <ind>5.0 percent</ind> </atom> </_head> <_body> <and> <_opr><rel>premium</rel></_opr> <_opr><rel>regular</rel></_opr> </and> </_body> </imp> 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). CS6795 Semantic Web Techniques 22-Sep-06

140 CS6795 Semantic Web Techniques
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. 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 CS6795 Semantic Web Techniques 22-Sep-06

141 The Rule Markup Language
RuleML RuleML CS6795 Semantic Web Techniques 22-Sep-06

142 CS6795 Semantic Web Techniques
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 RuleML Rule interchange is becoming more important in Knowledge Representation (KR), especially in Intelligent Agents Web Services CS6795 Semantic Web Techniques 22-Sep-06

143 CS6795 Semantic Web Techniques
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 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) RuleML CS6795 Semantic Web Techniques 22-Sep-06

144 Semantic Web and Web Services Use Databases and Rule Systems
Category-Based Search Engines & Document Retrieval Formal Ontologies & Metadata Repositories First-Order Logic & Knowledge Representation Semantic Web: DAML+OIL Mediator Agents & Information Integration Interface Descriptions & CGI Scripts Communication Protocols & Remote Procedure Calls Web Services : WSDL RuleML Rule Systems: RuleML Derivation Rules Transformation Rules Reaction Rules Databases: SQL (Integration of) Schemas & Dictionaries (Distributed) Transaction Processing Triggers & Events CS6795 Semantic Web Techniques 22-Sep-06

145 Rule Systems for Web-Based B2C or B2B Rule Exchange
Merchant1 Merchantm . . . translate to standard format (e.g., RuleML) publish rulebase1 publish rulebasem RuleML Customer or Company compare, instantiate, and run rulebases CS6795 Semantic Web Techniques 22-Sep-06

146 From Natural Language to Horn Logic
''The discount for a customer buying a product is 5.0 percent if the customer is premium and the product is regular.'' ''The discount for a customer buying a product is 7.5 percent if the customer is premium and the product is luxury.'' . . . English Business Rules: Prolog-like formalization (syntax generated from XML): RuleML CS6795 Semantic Web Techniques 22-Sep-06

147 RuleML: Markup and Tree
''The discount for a customer buying a product is 5.0 percent if the customer is premium and the product is regular.'' <imp> <_head> <atom> <_opr><rel>discount</rel></_opr> <var>customer</var> <var>product</var> <ind>5.0 percent</ind> </atom> </_head> <_body> <and> <_opr><rel>premium</rel></_opr> <_opr><rel>regular</rel></_opr> </and> </_body> </imp> imp head atom opr rel discount var customer var product ind percent body and opr rel premium opr rel regular RuleML CS6795 Semantic Web Techniques 22-Sep-06

148 Intertranslating RuleML and RFML
''The discount for a customer buying a product is 5.0 percent if the customer is premium and the product is regular.'' <imp> <_head> <atom> <_opr><rel>discount</rel></_opr> <var>customer</var> <var>product</var> <ind>5.0 percent</ind> </atom> </_head> <_body> <and> <_opr><rel>premium</rel></_opr> <_opr><rel>regular</rel></_opr> </and> </_body> </imp> <hn> <pattop> <con>discount</con> <var>customer</var> <var>product</var> <con>5.0 percent</con> </pattop> <callop> <con>premium</con> </callop> <con>regular</con> </hn> ruleml2rfml.xsl RuleML rfml2ruleml.xsl CS6795 Semantic Web Techniques 22-Sep-06

149 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: ‘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 RuleML CS6795 Semantic Web Techniques 22-Sep-06

150 The Module Hierarchy of RuleML DTDs
ur-equalog Rooted DAG will be extended with branches for further sublanguages equalog ur-hornlog hornlog ur-datalog ur-datalog = join(ur,datalog) RuleML datalog ur urc-datalog bin-datalog URL/URI-like ‘ur’-objects urc-bin-datalog urc-bin-data-ground-log urc-bin-data-ground-fact RDF-like triples CS6795 Semantic Web Techniques 22-Sep-06

151 Planned RuleML Extensions
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) RuleML CS6795 Semantic Web Techniques 22-Sep-06

152 CS6795 Semantic Web Techniques
RuleML Conclusions RuleML DTD 0.8, a system of DTDs, is available at sample rulebases at use cases at RuleML DTD 0.81 also has transformation rules with call-by-value function nestings Further rule categories (e.g. integrity constraints and reaction rules) will be available via main RuleML page at Distributed KR can already be based on current DTDs -- using (XSLT) transformations to reach follow-up and Participants’ DTDs RuleML CS6795 Semantic Web Techniques 22-Sep-06

153 Simple HTML/XML Ontology Extensions
SHOE SHOE CS6795 Semantic Web Techniques 22-Sep-06

154 CS6795 Semantic Web Techniques
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 SHOE CS6795 Semantic Web Techniques 22-Sep-06

155 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 eurostar = channel-tunnel = SHOE CS6795 Semantic Web Techniques 22-Sep-06

156 CS6795 Semantic Web Techniques
A SHOE Rule With these URLs/URIs, the rule in SHOE becomes <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/"> </INF-THEN> </DEF-INFERENCE> SHOE CS6795 Semantic Web Techniques 22-Sep-06

157 CS6795 Semantic Web Techniques
XML Namespaces Namespaces N'spaces CS6795 Semantic Web Techniques 22-Sep-06

158 XML Namespaces and Programming-Language Modules
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 N'spaces CS6795 Semantic Web Techniques 22-Sep-06

159 CS6795 Semantic Web Techniques
Namespace Bindings 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 name-spaces via attributes xmlns:prefix1 ,..., xmlns:prefixm N'spaces CS6795 Semantic Web Techniques 22-Sep-06

160 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/ </phone> <phone>030/ </phone> <fax>030/ </fax> <bill>76.20</bill> </ address> bill is ambiguous tag (name clash from two XML applications) N'spaces CS6795 Semantic Web Techniques 22-Sep-06

161 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> <tele:phone>030/ </tele:phone> <tele:phone>030/ </tele:phone> <tele:fax>030/ </tele:fax> <tele:bill>76.20</tele:bill> </ mail:address> bill disambiguation through mail and tele prefixes N'spaces 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 CS6795 Semantic Web Techniques 22-Sep-06

162 Acquiring and Processing Knowledge Markups
Acquire and Process A&P CS6795 Semantic Web Techniques 22-Sep-06

163 Acquiring and Processing Knowledge Markups
acquisition Protégé with XML Plugin Web Onto transformation techniques and stylesheet languages CSS XSLT query languages XQL and XPath XML-QL XQuery A&P CS6795 Semantic Web Techniques 22-Sep-06

164 Acquiring XML Knowledge Bases
Acquisition Acquisition CS6795 Semantic Web Techniques 22-Sep-06

165 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) Protégé CS6795 Semantic Web Techniques 22-Sep-06

166 Knowledge-Base Development with Protégé-2000
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 ...) Protégé CS6795 Semantic Web Techniques 22-Sep-06

167 Protégé as an OKBC-Compliant System (Open Knowledge Base Connectivity)
Standard mechanism for knowledge bases stored as “frames” of classes, slots, facets, instances, ... Adopted by several well-known knowledge-representation systems (Ontolingua, LOOM, Protégé-2000, XOL) Allows Protégé-2000 to be used as an ontology- and knowledge-editing system for any OKBC-compliant server Protégé CS6795 Semantic Web Techniques 22-Sep-06

168 CS6795 Semantic Web Techniques
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> </Cardnum> </Customer> Protégé CS6795 Semantic Web Techniques 22-Sep-06

169 Example (Import): Book Order
Protégé CS6795 Semantic Web Techniques 22-Sep-06

170 CS6795 Semantic Web Techniques
XML Export Strategy instances: 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 ontology: as simple XML tree or RDF Schema Protégé CS6795 Semantic Web Techniques 22-Sep-06

171 Example (Export): Newspaper Instances
Protégé CS6795 Semantic Web Techniques 22-Sep-06

172 Example: Newspaper Ontology As XML Tree
Protégé CS6795 Semantic Web Techniques 22-Sep-06

173 CS6795 Semantic Web Techniques
Processing XML Processing Processing CS6795 Semantic Web Techniques 22-Sep-06

174 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 { display: block } title { display: block; font-size: 16pt; font-weight: bold} poet { display: block; margin-bottom: 10px } stanza { display: block; margin-bottom: 10px } verse { display: block } attached to XML documents with processing instruction: <?xml-stylesheet type="text/css" href="poem.css"?> CSS CS6795 Semantic Web Techniques 22-Sep-06

175 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 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) XSLT CS6795 Semantic Web Techniques 22-Sep-06

176 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> XSLT CS6795 Semantic Web Techniques 22-Sep-06

177 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> </xsl:stylesheet> template for document root XSLT template for address elements CS6795 Semantic Web Techniques 22-Sep-06

178 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> 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>) XSLT CS6795 Semantic Web Techniques 22-Sep-06

179 XML to XML: Transformational Semantics via an XSLT Stylesheet
<addresses> <address> <name>Me2XML</name> <street>96 Hyper Road</street> <town>Boston</town> </address> <address> <name>RDF4All</name> <street>2001 Broadway</street> <town>New York</town> </address> <address> <name>XML4You</name> </address> </addresses> % start fact base for addresses address( name("Me2XML"), place( street("96 Hyper Road"), town("Boston") ) ). address( name("RDF4All"), street("2001 Broadway"), town("New York") name("XML4You"), ). % end fact base for addresses <addresses> <address> <name>Me2XML</name> <place> <street>96 Hyper Road</street> <town>Boston</town> </place> </address> <address> <name>RDF4All</name> <place> <street>2001 Broadway</street> <town>New York</town> </address> <address> <name>XML4You</name> </address> </addresses> XSLT templates XSLT CS6795 Semantic Web Techniques 22-Sep-06

180 XML to XML: XSLT Stylesheet with a Tree-Transforming Template 1
addresses Subtree <!-- process addresses and position address nester --> <xsl:template match="/addresses"> <addresses> <xsl:apply-templates/> </addresses> </xsl:template> XSLT addresses Subtree CS6795 Semantic Web Techniques 22-Sep-06

181 XML to XML: XSLT Stylesheet with a Tree-Transforming Template 2
address PCDATA name street town <!-- 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> </xsl:template> XSLT address PCDATA name street town place CS6795 Semantic Web Techniques 22-Sep-06

182 CS6795 Semantic Web Techniques
XQL and XPath XSLT uses XPath to select parts of the input XML documents, e.g.: <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!) XQL CS6795 Semantic Web Techniques 22-Sep-06

183 CS6795 Semantic Web Techniques
XQL Expressions 1 XQL expressions (relative to a context node): 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 XQL CS6795 Semantic Web Techniques 22-Sep-06

184 CS6795 Semantic Web Techniques
XQL Expressions 2 absolute XQL expressions: / document root (the node that contains the document element) /addresses/address/name //name „name“ element nodes anywhere in the document expressions with attributes (prefixed attribute nodes with name „type“ below „address“ element nodes as above, plus the value of the „type“ attribute is ´ ´ XQL CS6795 Semantic Web Techniques 22-Sep-06

185 CS6795 Semantic Web Techniques
XQL Expressions 3 filter expressions: address[name] select „address“ element nodes with a direct „name“ sub-element node address[name=´John Doe´] as above, plus the content of the „name“ element is ´John Doe´ select „address“ element nodes that have a „type“ attribute whose value is ´ ´ XQL CS6795 Semantic Web Techniques 22-Sep-06

186 CS6795 Semantic Web Techniques
XML-QL 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> XML-QL CS6795 Semantic Web Techniques 22-Sep-06

187 XML-QL Example 1 return short addresses (town-city renaming, without street): WHERE <address> <name>$n</> <town>$t</> </> IN "www.test.org/addresses.xml" CONSTRUCT <shortaddress> <name>$n</> <city>$t</> </> <address> <name>Xaver M. Linde</name> <street>Wikingerufer 7</street> <town>10555 Berlin</town> </address> <street> elements are also matched XML-QL <shortaddress> <name>Xaver M. Linde</name> <city>10555 Berlin</city> </shortaddress> CS6795 Semantic Web Techniques 22-Sep-06

188 CS6795 Semantic Web Techniques
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 </> XML-QL CS6795 Semantic Web Techniques 22-Sep-06

189 CS6795 Semantic Web Techniques
XQuery 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 XQuery CS6795 Semantic Web Techniques 22-Sep-06

190 CS6795 Semantic Web Techniques
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"] XQuery CS6795 Semantic Web Techniques 22-Sep-06

191 CS6795 Semantic Web Techniques
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> , <avgprice> $a </avgprice> </publisher> XQuery element constructor CS6795 Semantic Web Techniques 22-Sep-06

192 CS6795 Semantic Web Techniques
XQuery: Examples 3 Functions (& Namespaces, XML Schema Data Types): Find the maximum depth of the document named "partlist.xml" : NAMESPACE xsd = FUNCTION depth(ELEMENT $e) RETURNS xsd:integer { An empty element has depth Otherwise, add 1 to max depth of children IF empty($e/*) THEN ELSE max(depth($e/*)) } depth(document("partlist.xml")) XQuery CS6795 Semantic Web Techniques 22-Sep-06

193 XML-Based Agent Techniques
Agents Agents CS6795 Semantic Web Techniques 22-Sep-06

194 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) XML (and RDF) as language for message contents DAML DARPA Agent Markup Language ACORN Keyphrase-Based Information Sharing Multi-Agent Architecture: Virendra C. Bhavsar and Ali A. Ghorbani RACSA Rule Applying Comparison Shopping Agent Agents CS6795 Semantic Web Techniques 22-Sep-06

195 CS6795 Semantic Web Techniques
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 RACSA CS6795 Semantic Web Techniques 22-Sep-06

196 CS6795 Semantic Web Techniques
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 RACSA CS6795 Semantic Web Techniques 22-Sep-06

197 RACSA 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 RACSA Online Demo: CS6795 Semantic Web Techniques 22-Sep-06

198 Resource Description Framework
RDF RDF CS6795 Semantic Web Techniques 22-Sep-06

199 CS6795 Semantic Web Techniques
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.” RDF R.V. Guha, Epinions Adobe’s eXtensible Metadata Platform (XMP) now uses RDF for Photoshop® 7.0, Acrobat® 5.0, and FrameMaker®: CS6795 Semantic Web Techniques 22-Sep-06

200 CS6795 Semantic Web Techniques
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 Parser, Query, and Inference Engines RDF CS6795 Semantic Web Techniques 22-Sep-06

201 Why The Shift Towards More Semantics?
Information Overload Information on the Web currently aiming at Human Consumption Information Consumption is too time consuming Search Engines fail more and more combined coverage is less than 42% of the HTML-Web Data Interchange growing (e.g. B2B) needs a common semantics XML? RDF CS6795 Semantic Web Techniques 22-Sep-06

202 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 Gives a minimal level of validation RDF CS6795 Semantic Web Techniques 22-Sep-06

203 CS6795 Semantic Web Techniques
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! RDF CS6795 Semantic Web Techniques 22-Sep-06

204 Encoding of Knowledge: Example
“The Creator of the Resource “http://www.w3.org/Home/Lassila” is Ora Lassila Creator Ora Lassila Endless encoding possibilities in XML: <Creator> <uri>http://www.w3.org/Home/Lassila</uri> <name>Ora Lassila</name> </Creator> RDF <Document uri=“http://www.w3.org/Home/Lassila” <Creator>Ora Lassila</Creator> </Document> <Document uri=“http://www.w3.org/Home/Lassila” Creator=“Ora Lassila”/> CS6795 Semantic Web Techniques 22-Sep-06

205 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 </xsd:... </xsd:schema> DTD or XML Schema RDF Deployment XML-based Communication using DTD A Sender using DTD A XML- Parser Parse Tree Recipient using DTD A Common Semantics CS6795 Semantic Web Techniques 22-Sep-06

206 Many Previously Unknown Communication Partners
RDF CS6795 Semantic Web Techniques 22-Sep-06

207 New Partners Don’t Understand Each Other
? Communication Partner using DTD B Communication Partner using DTD C ? ? RDF XML-based Communication using DTD A Parse Tree XML- Parser Sender using DTD A Recipient using DTD A CS6795 Semantic Web Techniques 22-Sep-06

208 Merging Steps Between Models
DTD A DTD B <xsd:schema xmlns:xsd="http://..."> <xsd:annotation>B-Schema </xsd:... </xsd:schema> <xsd:schema xmlns:xsd="http://..."> <xsd:annotation>A-Schema </xsd:... </xsd:schema> Reengineering of the conceptual model Matching RDF Matching XML Document Translation Generation (e.g. in XSLT) <xsl:stylesheet version="1.0” xmlns:xsl="http://....Transform" <xsl:template match="/"> .... </xsl:template> </xsl:stylesheet> <xsl:stylesheet version="1.0” xmlns:xsl="http://....Transform" <xsl:template match="/"> .... </xsl:template> </xsl:stylesheet> XML Document Translation from DTD A to DTD B (and B to A) CS6795 Semantic Web Techniques 22-Sep-06

209 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 What are requirements for such a level? RDF CS6795 Semantic Web Techniques 22-Sep-06

210 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) RDF CS6795 Semantic Web Techniques 22-Sep-06

211 CS6795 Semantic Web Techniques
Introduction to RDF RDF (Resource Description Framework) Beyond Machine readable to Machine understandable RDF unites a wide variety of stakeholders: Digital librarians, content-raters, privacy advocates, B2B industries, AI... Significant (but less than XML) industrial momentum, lead by W3C RDF consists of two parts 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) RDF CS6795 Semantic Web Techniques 22-Sep-06

212 CS6795 Semantic Web Techniques
RDF Data Model Resources A resource is a thing you talk about (can reference) Resources have URI’s RDF definitions are themselves Resources (linkage, see requirement 1) Properties slots, define relationships to other resources or atomic values Statements “Resource has Property with Value” (Values can be resources or atomic XML data) Similar to Frame Systems RDF CS6795 Semantic Web Techniques 22-Sep-06

213 CS6795 Semantic Web Techniques
A Simple Example Statement “Ora Lassila is the creator of the resource Structure Resource (subject) Property (predicate) Value (object) "Ora Lassila” Directed graph RDF s:Creator Ora Lassila CS6795 Semantic Web Techniques 22-Sep-06

214 CS6795 Semantic Web Techniques
Another Example To add properties to Creator, point through an intermediate Resource. s:Creator RDF Person://fi/ Name Ora Lassila CS6795 Semantic Web Techniques 22-Sep-06

215 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 Core RDF does not enforce ‘set’ semantics amongst values RDF CS6795 Semantic Web Techniques 22-Sep-06

216 CS6795 Semantic Web Techniques
Example: Bag The students in course are Amy, Tim, John, Mary, and Sue /courses/6.001 Rdf:Bag rdf:type /Students/Amy students rdf:_1 RDF rdf:_2 /Students/Tim bagid1 rdf:_3 /Students/John rdf:_4 /Students/Mary rdf:_5 /Students/Sue CS6795 Semantic Web Techniques 22-Sep-06

217 CS6795 Semantic Web Techniques
Example: Alternative The source code for X11 may be found at ftp.x.org, ftp.cs.purdue.edu, or ftp.eu.net rdf:Alt rdf:type source RDF rdf:_1 altid ftp.x.org rdf:_2 ftp.cs.purdue.edu rdf:_3 ftp.eu.net CS6795 Semantic Web Techniques 22-Sep-06

218 Statements About Statements (Requirement 2: Dispute Statements)
Making statements about statements requires a process for transforming them into Resources subject the original resource predicate the original property object the original value type rdf:Statement RDF CS6795 Semantic Web Techniques 22-Sep-06

219 CS6795 Semantic Web Techniques
Example: Reification Ralph Swick believes that the creator of the resource is Ora Lassila s:Creator rdf:predicate rdf:subject s:Creator RDF genid1 rdf:object rdf:Statement rdf:type Ralph Swick b:believedBy Ora Lassila CS6795 Semantic Web Techniques 22-Sep-06

220 CS6795 Semantic Web Techniques
A Formal Model of RDF RDF itself is mathematically straightforward: Basic Definitions Resources Properties Ì Resources Literals Statements  Properties ´ Resources ´ {Resources È Literals} Typing rdf:type Î Properties {RDF:type, sub, obj} Î Statements Þ obj Î Resources for triples like {p,r1,r2} the RDF spec should use some different bracketing, like (p,r1,r2) RDF CS6795 Semantic Web Techniques 22-Sep-06

221 CS6795 Semantic Web Techniques
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 { 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, ... RDF CS6795 Semantic Web Techniques 22-Sep-06

222 CS6795 Semantic Web Techniques
RDF Syntax I Data model does not enforce particular syntax Specification suggests many different syntaxes based on XML General form: Starts an RDF-Description Subject (OID) RDF <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 Resource (possibly another RDF-description) Properties CS6795 Semantic Web Techniques 22-Sep-06

223 CS6795 Semantic Web Techniques
Resulting Graph Ora Lassila s:createdWith s:Creator RDF <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> CS6795 Semantic Web Techniques 22-Sep-06

224 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> RDF Ora Lassila s:createdWith s:Creator HTMLEditor s:Homepage rdf:type Property CS6795 Semantic Web Techniques 22-Sep-06

225 CS6795 Semantic Web Techniques
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 RDF CS6795 Semantic Web Techniques 22-Sep-06

226 Most Important Modeling Primitives
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) RDF CS6795 Semantic Web Techniques 22-Sep-06

227 RDF-Schema: Example (incomplete)
s = rdfs:subClassOf rdfs:Resource s xyz:MotorVehicle RDF s s s xyz:Van xyz:Truck s xyz:PassengerVehicle xyz:MiniVan s CS6795 Semantic Web Techniques 22-Sep-06

228 CS6795 Semantic Web Techniques
RDF-Schema: Example s = rdfs:subClassOf rdfs:Resource t = rdf:type s t s t rdfs:Class t xyz:MotorVehicle t t RDF t s s s xyz:Van xyz:Truck t s xyz:PassengerVehicle xyz:MiniVan s CS6795 Semantic Web Techniques 22-Sep-06

229 Example: RDF-Schema in RDF-Schema
Namespace-URL: <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"/> <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> RDF CS6795 Semantic Web Techniques 22-Sep-06

230 CS6795 Semantic Web Techniques
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) RDF CS6795 Semantic Web Techniques 22-Sep-06

231 Photo Archive Using RDF: Introduction
W3C project for describing & retrieving (digitized) photos with (RDF) metadata Explained in a W3C Note by Yves Lafon and Bert Bos Metadata separated into three different schemas: Dublin Core schema: Title, date, subject, etc. Technical schema: Photo and camera details Content schema: Vocabulary for DC "subject" property RDF CS6795 Semantic Web Techniques 22-Sep-06

232 Photo Archive Using RDF: Sample Photo
CS6795 Semantic Web Techniques 22-Sep-06

233 Photo Archive Using RDF: Photo Metadata
<?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 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> </DC:Date> <DC:Coverage>Brisbane - Australia</DC:Coverage> <DC:Creator>http://www.w3.org/People/Lafon/</DC:Creator> <Technical:devel-date> </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> RDF CS6795 Semantic Web Techniques 22-Sep-06

234 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 : <rdf:RDF xmlns:rdfs="http://www.w3.org/TR/1999/PR-rdf-schema #“ 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> . . . </rdf:RDF> RDF CS6795 Semantic Web Techniques 22-Sep-06

235 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> CS6795 Semantic Web Techniques 22-Sep-06

236 Ontology Languages on Top of RDF: The Principle
Legend: Instance Data Definition uses the data model of Defined in terms of Ontology Language RDF Is extension of RDF Schema RDF CS6795 Semantic Web Techniques 22-Sep-06

237 CS6795 Semantic Web Techniques
The Semantic Web 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: RDF CS6795 Semantic Web Techniques 22-Sep-06

238 CS6795 Semantic Web Techniques
Tools Tools for RDF and RDF Schema Editors Protégé-2000 (SMI) HTML Annotation Tool (Siegfied Handschuh) Parsers and Generators 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) RDF CS6795 Semantic Web Techniques 22-Sep-06

239 CS6795 Semantic Web Techniques
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 Web-directory) General Information: RDF Interest Mailing list: Archive: http//lists.w3.org/Archives/Public/www-rdf-interest/ SemanticWeb.org RDF CS6795 Semantic Web Techniques 22-Sep-06

240 CS6795 Semantic Web Techniques
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? B2B-Communication (e.g. ebXML.org ?) Interoperability between RDF-Schemas RDF CS6795 Semantic Web Techniques 22-Sep-06

241 Description Logic: Class-Forming Operations
DL CS6795 Semantic Web Techniques 22-Sep-06

242 e-Business Example in Description Logic: Classification - Before -
s = rdfs:subClassOf Organisation s DL s Business ForProfit operation Electronic Cybershop ForProfit transaction operation CS6795 Semantic Web Techniques 22-Sep-06

243 CS6795 Semantic Web Techniques
e-Business Example in Description Logic: Classification After - s = rdfs:subClassOf Organisation s DL Business ForProfit operation s Electronic Cybershop transaction CS6795 Semantic Web Techniques 22-Sep-06

244 Class Intersection: Example
s = rdfs:subClassOf TallThing DL 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 CS6795 Semantic Web Techniques 22-Sep-06

245 Class Intersection and Definition: Example
s = rdfs:subClassOf := = daml:Class TallThing DL s Man := TallMan s TallMan := TallThing Π Man CS6795 Semantic Web Techniques 22-Sep-06

246 Class Complement: Example
c = daml:complementOf DL Person c Car ¬Person CS6795 Semantic Web Techniques 22-Sep-06

247 Class Complement and Subsetting: Example
s = rdfs:subClassOf c = daml:complementOf DL Person s Car c Car ¬Person CS6795 Semantic Web Techniques 22-Sep-06

248 Qualified Role: Example
t = rdf:type DL Over17 age t RipeThing := age.Over17 Existential role: age.Over17(x)  y age(x,y)  Over17(y) Universal role similar CS6795 Semantic Web Techniques 22-Sep-06

249 Qualified Role and Definition : Example
t = rdf:type := = daml:Class DL Over17 := RipeThing age t RipeThing := age.Over17 CS6795 Semantic Web Techniques 22-Sep-06

250 CS6795 Semantic Web Techniques
DAML+OIL DAML+OIL DAML+OIL CS6795 Semantic Web Techniques 22-Sep-06

251 DARPA Agent Markup Language, OIL, and OWL
OIL: European Ontology Interchange Language DARPA funded Research Program (also funded the Development of the ARPANNET -> Internet): Foundation for the Semantic Web: Ontology Language DAML+OIL: Result of a Joint (European + American) Committee Rule Language SWRL, jointly with RuleML W3C’s recent OWL (Web Ontology Language) mainly divides DAML+OIL into three sublanguages: OWL Light: Frames OWL DL: Description logic OWL Full: A proper superset of DL and RDFS DAML CS6795 Semantic Web Techniques 22-Sep-06

252 CS6795 Semantic Web Techniques
DAML+OIL Extension of RDF Schema Ontology Language DAML+OIL: Result of a Joint (European + US-American) Committee Class Expressions (Intersection, Union, Complement) XML Schema Datatypes Enumerations Property Restrictions Cardinality Constraints Value Restrictions DAML CS6795 Semantic Web Techniques 22-Sep-06

253 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 <daml:Class rdf:ID="HumanBeing"> <daml:sameClassAs rdf:resource="#Person"/> </daml:Class> CS6795 Semantic Web Techniques 22-Sep-06

254 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: DAML <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> CS6795 Semantic Web Techniques 22-Sep-06

255 CS6795 Semantic Web Techniques
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 <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> CS6795 Semantic Web Techniques 22-Sep-06

256 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 <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> CS6795 Semantic Web Techniques 22-Sep-06

257 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 <daml:Class rdf:ID="Person"> . . . </daml:Class> CS6795 Semantic Web Techniques 22-Sep-06

258 CS6795 Semantic Web Techniques
Protégé as OIL Editor supports following subset of OIL: 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 OIL CS6795 Semantic Web Techniques 22-Sep-06

259 Protégé as OIL Editor: Screenshot
CS6795 Semantic Web Techniques 22-Sep-06

260 CS6795 Semantic Web Techniques
TRIPLE TRIPLE TRIPLE CS6795 Semantic Web Techniques 22-Sep-06

261 CS6795 Semantic Web Techniques
TRIPLE: Motivation RDF data available Needed: Query and Inference Language for/in RDF Existing Approaches: SiLRI Metalog RQL TRIPLE CS6795 Semantic Web Techniques 22-Sep-06

262 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 One large heap of RDF-Data TRIPLE CS6795 Semantic Web Techniques 22-Sep-06

263 Graph Separated in Models
source2 source1 source3 TRIPLE CS6795 Semantic Web Techniques 22-Sep-06

264 CS6795 Semantic Web Techniques
New System: Triple Native support for Resources + Namespaces Models (sets of RDF statements) Reification Data Integration/Translation Rules with Expressive Bodies (Full FOL Syntax) TRIPLE CS6795 Semantic Web Techniques 22-Sep-06

265 Object Expressions + Models
intersect mod2) union mod2) \ mod2) TRIPLE CS6795 Semantic Web Techniques 22-Sep-06

266 CS6795 Semantic Web Techniques
Reification hasAuthor “Ora Lassila” believedBy TRIPLE “Ralph Swick” <http://…1234[hasAuthor->”OraLassila”]>[believedBy->”Ralph Swick”]. CS6795 Semantic Web Techniques 22-Sep-06

267 CS6795 Semantic Web Techniques
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 #'. type := rdf:type. subPropertyOf := rdfs:subPropertyOf. subClassOf := rdfs:subClassOf. FORALL { FORALL O,P,V O[P->V] <- FORALL O,P,V O[P->V] <- EXIST S S[subPropertyOf->P] AND O[S->V]. FORALL O,V O[subClassOf->V] <- 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]).} Abbreviations Model Block TRIPLE Transitivity Rule CS6795 Semantic Web Techniques 22-Sep-06

268 CS6795 Semantic Web Techniques
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: TRIPLE CS6795 Semantic Web Techniques 22-Sep-06

269 CS6795 Semantic Web Techniques
Summary New RDF specific Query and Inference Language Allows specification of multiple semantics Integration/Translation of heterogeneous data (InterDataWorking.com) Every Horn Logic Inference Engine can be used Provides a formal foundation for N3 Part of RuleML ( ) TRIPLE CS6795 Semantic Web Techniques 22-Sep-06

270 CS6795 Semantic Web Techniques
Topic Maps Topic Maps TRIPLE CS6795 Semantic Web Techniques 22-Sep-06

271 CS6795 Semantic Web Techniques
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) TOPICMAPS CS6795 Semantic Web Techniques 22-Sep-06

272 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: occurrences have a role: eg. “MENTION” (again a Topic) TOPICMAPS CS6795 Semantic Web Techniques 22-Sep-06

273 Topic Navigation Maps in a Nutshell II
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 TOPICMAPS CS6795 Semantic Web Techniques 22-Sep-06

274 Example of a Browsing Interface
TOPICMAPS CS6795 Semantic Web Techniques 22-Sep-06

275 XML Topic Maps (XTM): Design Goals
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 CS6795 Semantic Web Techniques 22-Sep-06

276 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 A topic map captures the subjects of which resources speak, and the relationships between subjects, in a way that is implementation-independent CS6795 Semantic Web Techniques 22-Sep-06

277 XML Topic Maps (XTM): Topics, Associations, and Occurrences
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 CS6795 Semantic Web Techniques 22-Sep-06

278 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> CS6795 Semantic Web Techniques 22-Sep-06

279 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> <roleSpec><topicRef xlink:href="#work"/></roleSpec> <topicRef xlink:href="#hamlet"/> </association> CS6795 Semantic Web Techniques 22-Sep-06

280 CS6795 Semantic Web Techniques
Acknowledgements Stefan Decker and Michael Sintek for their key contributions to starting it all: 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: The Joint (Agent Markup Language) Committee and the Rule Markup Initiative for discussions: Acknowledgements CS6795 Semantic Web Techniques 22-Sep-06

281 CS6795 Semantic Web Techniques
References References References CS6795 Semantic Web Techniques 22-Sep-06

282 CS6795 Semantic Web Techniques
References Cocoon The Cocoon Publishing Framework. Available at CSS2 Cascading Style Sheets, level 2. Available at DAML DARPA Agent Markup Language. Availabe at , , and Dublin Core Available at Fernandez99 XML Query Languages: Experiences and Exemplars, Mary Fernandez, Jérôme Siméon, Philip Wadler, Available at FRODO The FRODO Project. Homepage available at OIL Ontology Interchange Language. Availabe at Protégé-XML The Protégé XML-Tab. Available at References CS6795 Semantic Web Techniques 22-Sep-06

283 CS6795 Semantic Web Techniques
References Q&T Querying and Transforming XML. Available at RACSA Online Demo at RDF Homepage: Specification: FAQ: Tutorial: Carl Lagoze et al: WWW7 Tutorial. Available at RDF-Schema Specification at RuleML The Rule Markup Language. Homepage at or Semantic Web Portal at SHOE Simple HTML Ontology Extensions. Available at XML Extensible Markup Language (XML), Version 1.0. W3C Recommendation. Available at References CS6795 Semantic Web Techniques 22-Sep-06

284 CS6795 Semantic Web Techniques
References XML Namespaces Namespaces in XML. W3C Recommendation at XML-QL XML-QL: A Query Language for XML. Available at XML-RPC XML Remote Procedure Calls. Available at XPath World Wide Web Consortium. XML Path Language. W3C Recommendation. Available at XPointer World Wide Web Consortium. XML Pointer Language (XPointer). W3C Working Draft. Available at XQuery A Query Language for XML. Available at XQL XML Query Language (XQL). Available at XSL World Wide Web Consortium. Extensible Stylesheet Language (XSL). W3C Working Draft. Available at XSLT World Wide Web Consortium. XSL Transformations (XSLT). W3C Recommendation. Available at References CS6795 Semantic Web Techniques 22-Sep-06


Download ppt "Introduction to the Semantic Web"

Similar presentations


Ads by Google