880 likes | 929 Vues
OWL. Representing Information Using the Web Ontology Language. Enabling Technologies. Section 2. Section 2. Chapter 5: URIs and Namespaces Absolute URIs, URI references, namespaces, & base URIs Chapter 6: XML eXtensible Markup Language & XML Schema datatypes Chapter 7: RDF
E N D
OWL Representing Information Using the Web Ontology Language
Enabling Technologies Section 2
Section 2 • Chapter 5: URIs and Namespaces • Absolute URIs, URI references, namespaces, & base URIs • Chapter 6: XML • eXtensible Markup Language & XML Schema datatypes • Chapter 7: RDF • Resource Description Format features & data model • Chapter 8: RDF/XML • Using XML w/ RDF & creating RDF/XML statements • Chapter 9: RDFS • RDF Schema: features, classes, individuals • Chapter 10: OWL Language • Introduces OWL in its three species
URIs and Namespaces Chapter 5
5 URIs and Namespaces • Symbol/Reference Layer • Lowest layer • Naming & referencing representation constructs • Uniform Resource Identifiers • Absolute URIs • URI references • XML • Namespaces • Base URIs
5.1 Absolute URIs • Uniform Resource Identifiers (URIs) • Enable the web by providing a naming scheme • String of characters that • Identifies a resource (abstract or physical) • Conforms to a particular syntax • RFC2396: http://www.ietf.org/rfc/rfc2396.txt • Classified as • Absolute • Relative • Treated like logical constants • Do not have to be resolvable to network resources
5.1 Absolute URIs cont’d • Absolute URIs • Independent of context in which they are found • Syntax • URISchemeName:schemeSpecificPart • http://www.knightowlrestaurant.com • isbn:0595307191 • soap://www.visa.com/CreditCardService • Uniform, extensible, simple • Unambiguously specify a name for a resource • URLs (Uniform Resource Locator) • Specifies network protocol as scheme • Identify documents or document network resources • URNs (Uniform Resource Names) • Globally unique and persistent identifiers
5.1 Absolute URIs cont’d • URI Schemes • Standard way to interpret scheme-specific portion • Managed by Internet Assigned Numbers Authority • http, ftp, mailto, mid, tag, nfs, news… • Creation & use of URIs not controlled • Typical (but not required) URI style guidelines • Begin with company domain name • Use URLs that resolve to resources or documentation • Include version (date) information in URIs • http://xmlns.com/foaf/spec/20071002.html
5.2 URI References • Absolute URIs long and cumbersome • URI references (URIrefs) • Specifies a resource or portion of a resource • String of characters • Relative or absolute • Optional fragment identifier suffix • Follows fragment separator character “#” • Identifies portion of the resource • Relative URIs resolve to absolute URIs using • Base URI of containing document • Characters before fragment separator, if applicable • 4 forms
5.2 URI References • Form 1: Full URIref with fragment • http://www.restaurant.org/food-ont#Pizza • Form 2: Full URIref without fragment (absolute URI) • http://www.restaurant.org/food-ont • Form 3: Relative URIref with fragment • relativeURI#fragment • food-ont#pizza • Form 4: Relative URIref without fragment • food-ont • Special case of Form 3: fragment without URIref • #pizza
5.3 XML Namespaces (xmlns) • XML Namespaces • Disambiguate duplicate element names • Associate namespaces with URIrefs • Enable shorthand (alias) reference prefixes to specify qualified names (QNames) • http://www.w3.org/TR/REC-xml-names/ • Can go anywhere in an XML file • Recommended location: <rdf:RDF> tag
5.3 XML Namespaces cont’d • Syntax • xmlns:namespacePrefix="nsURIref" • URIrefs often end with # to avoid repeating it • If colon & namespacePrefix omitted, default namespace assumed (1 per file) • Example namespace declaration • <xmlns:rest="http://www.restaurant.org/menuontology#"> • "rest:pie" → "http://www.restaurant.org/menuontology#pie" • Example default namespace declaration • <xmlns="http://www.restaurant.org/menuontology"> • "#pie" → "http://www.restaurant.org/menuontology#pie"
5.3 XML Namespaces cont’d • Qualified Names (QNames) • Abbreviate element tag names & attribute names • Cannot be used for attribute values • Syntax • namespacePrefix:tagName • menu:dessert • Prevent local tag name collisions • Namespace recommended guideline • Use URL of an associated file as a namespace URI
5.4 Specifying Base URI (xml:base) • Normally, a relative URIref is resolved using URL of its containing file • Can change the base using xml:base • Syntax: xml:base = "baseURI" • http://www.w3.org/TR/xmlbase • Uses • File replicated on multiple sites, but URIrefs must be consistent • Group related items • Ensure that URIrefs remain valid when file renamed
5.5 URIs and Namespace Summary • URIs identify and name resources • Absolute URIs are fully-specified names • URIrefs can • Be relative (not fully-specified) • Specify components with fragments • Namespaces prevent name collisions • xml:base specifies base for relative URIrefs • URIs and namespaces referenced in XML statements
XML Chapter 6
6 XML • eXtensible Markup Language • Standardized format for serializing and exchanging information • Well-defined encoding of data with arbitrary structure • XML Schema • OWL uses XMLS datatypes • OWL does not require XML • But it provides a common, efficient mechanism for expressing OWL constructs
6.1 XML Overview • XML • Tag-based metalanguage used to define domain-specific grammars • Serializes tree-based data into linear text format • W3c standard • Simplified version of SGML • Standard Generalized Markup Language
6.1 XML Overview cont’d • De facto standard for interchanging structured data on the web • Parsers and translators widely available and high-quality • http://www.w3.org/TR/REC-xml <menu> <menuitem> <dishname>Key Lime Pie</dishname> <dishprice>$2.75</dishprice> </menuitem> <menuitem> <dishname>Apple Pie</dishname> <dishprice>$2.50</dishprice> </menuitem> </menu>
6.1.1 XML Features • Structured syntax • Widely adopted and supported • Consistent & parseable • Verbose & ugly, but human-readable • Vendor-neutral • Large community of developers
6.1.2 Syntax and Structure • Markup tags delimit • Elements • Attributes • Content • <element attribute="value">content</element> • EAC memory aid – Estimate at Complete, EACH • Tags can be nested • Each tag • Is a node in tree-structured data model • Can include attributes with values and content
6.1.3 XML Declaration • Optional but recommended • Used at beginning of XML document • Include version and encoding attributes • <?xml version="1.0" encoding="UTF-8"?> • Also recommended: • Containing file should have .xml suffix
6.1.4 Elements • Define tree structure • Indicated by tag names in angled brackets <> • Content terminated by matching end tag with “/” before tag name • If no content, can self-close: <tag/> • Tags label content & give meaning for humans • No semantics can be inferred from tags alone • Qnames can be used as element names
6.1.5 Element Attributes • Occur within a start tag or self-closing tag • Name and value occur after tag name • Provide information about the element • Best used for metadata (e.g. units), not content • Syntax • <someXMLTag attributeName="attributeValue"/> • Example • <menu:dishPrice currency="USD">2.5</menu:dishPrice>
6.1.5.1 Specifying Content Language • xml:lang attribute • Specifies language of element’s content • Can be specified at various levels in document • Applies to content within portion of document • http://www.ietf.org/rfc/rfc1766.txt • Syntax • xml:lang="languageIdentifier" • Example • <menu:meatDishxml:lang="en">chicken</menu:meatDish> • <menu:meatDishxml:lang="es">pollo</menu:meatDish> • Values usually 2-letter codes from ISO-639, extended with dialiects ("en-US" for US English)
6.1.5.2 XML Syntax Approaches • Element-centric (preferred) • <menuitem> <dishName>keyLimePie</dishName> <dishPrice>$2.75</dishPrice></menuitem> • Attribute-centric • <menuitemdishName="keyLimePie" dishPrice="$2.75"/> • Element-centric preferable because it’s parseable and can be further subdivided • Use attributes for metadata
6.1.5.3 XML Entities • Mechanism for abbreviating references to URIs • Useful in OWL documents for abbreviating URIref prefixes in attribute values (QNames can’t be used) • Syntax • <!ENTITY entityName "fullURI"> • Declare at beginning of document in DOCTYPE • <!DOCTYPE rdf:RDF [<!ENTITY owl http://www.w3.org/2002/07/owl#>]> • Example of use • <rdfs:subClassOf rdf:resource="&owl;Thing"/>
Simple Annotated Example <?xml version="1.0" encoding="UTF-8"?> <!-- Edited by YoursTruly --> <!DOCTYPE rdf:RDF [<!ENTITY owl http://www.w3.org/2002/07/owl#> ]> <rdf:RDF xml:base="http://ex.org/today/“> <head> <title ref=“&owl;Thing”>Virtual Library</title> </head> <body href=“lib”>A cool place. </body> </rdf:RDF> !-- is Comment (no /) ! Is instructive (no /) !Entity defines URI macro in scope of rdf:RDF Default base rather than filename. Href resolves to: http://ex.org/today/lib
6.2 XML Schema Datatypes • XML Schema (XMLS) • Documents XML structure, replacing DTDs • Define datatype features • OWL uses XMLS datatypes • http://www.w3.org/TR/xmlschema-2/ • <xmlns:xsd="http://www.w3.org/2001/XMLSchema"> • Defines primitive (string, decimal, float) & derived (integer sub-ranges) types • Restrict values and associate representations with values
6.2.1 User Defined Datatypes • Restrict numSlices datatype as integer from 1..8 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:simpleType name="numSlices"> <xsd:restriction base="&xsd;positiveInteger"> <xsd:maxExclusive value="8"/> </xsd:restriction> </xsd:simpleType> </xsd:schema>
6.3 XML Summary • XML • Standard metalanguage • Used to define • Custom tag sets • Interchange formats for exchanging information • Used by OWL as a serialization syntax • XMLS • Provides standard datatype definitions used by OWL
6.4 Why XML is not Enough • XML • Defines syntax, not semantics • Tag names • Meaningful to humans • Meaningless to parsing software • XMLS and DTDs • Define format, not relationships between resources • Can be ambiguous • RDF overcomes many of these limitations
RDF Chapter 7
7 RDF • Resource Description Format • W3C recommendation • Assert values of properties associated with web resources • With RDF/XML, forms Basic Relational Language Layer • Specifies OWL instances • Overview of • Features • Data Model
7.1 RDF Overview • RDF • Mechanism to make statements about resources • Resource: anything named with a URIref • Statements: describe Resources using attribute/value pairs • New but mature technology • Developed by W3C’s RDF Core Working Group • Influenced by metadata and knowledge representation principles
7.1.1 Metadata • Initial purpose of RDF: encode metadata • Metadata • Overused term with multiple interpretations • “Document-level”: “Dublin Core” specification • “Tagging”: All XML element tags are metadata
7.1.2 RDF Purpose • Purposes of RDF • Provide standard framework for making statements about resources and their attributes • Describe the semantics of data • Publish database contents on the web
7.3 RDF Specification • RDF Concepts and Abstract Syntax • http://www.w3c.org/TR/rdf-concepts/ • RDF Semantics • http://www.w3c.org.TR/rdf-mt/ • RDF Primer • http://www.w3c.org/TR/rdf-primer/ • RDF Test Cases • http://www.w3c.org/TR/rdf-testcases/
7.2 RDF Features • RDF Statements • Sets of triples • (Subject, Verb, Object) • Uniform, formal, standard, flexible • Can describe any domain • Distributed on servers like HTML content • Combined to create large virtual knowledgebase • Enable new capabilities, such as querying and inferencing
7.3 RDF Data Model • Simple and syntax-independent • Includes • Resources • Properties • Literals • Statements • Also specifies a graphical representation method, but not really useful
7.3.1 Resources • Key building block • Usually nouns • Anything associated with a URIref • Examples: • www.restaurant.org/RestOwner • #JoeSmith • location123 • Can be physical or virtual
7.3.1 Properties • Resource that serves as a predicate in statements to describe another resource • Describe a binary relationship between a subject resource and a value • Similar to methods in OOP, but • Unlike OOP methods which are bound to classes, Properties are “first-class” objects with URI names
7.3.2 Literals • RDF literals • Text strings (plain literals) with optional • Language identifiers • Datatype identifiers (typed literal) • Atomic datatype • Examples • Plain literals • “$3.45”, “Knight Owl Restaurant”, “123 Main Street” • Typed literals • xsd:time^^06:00:00, xsd:integer^^6
7.3.3 Statements • RDF statement “triples” provide • A subject resource • A predicate (named property) • An object (literal data value or resource value) • Forms • Examples • (KeyLimePie, price, “$2.75”) • (Person345, favoritePie, KeyLimePie)
7.4 RDF Summary • RDF • Framework for describing resources • Data model includes • Resources • Properties • Statements • Literals • Expresses simple statements about subject resources • Foundational support technology in OWL
7.5 Why RDF is not enough • RDF is only a content data model • Does not specify a serialization format • Can only express simple statements about resources • Ontologies need to express complex semantic relationships between resources
RDF/XML Chapter 8
8 RDF/XML • Standard XML syntax used to serialize the RDF data model • Easy for humans to read • Software support • Other alternatives • N-Triples, N3 • Supports basic relational language layer • Chapter • Overview of RDF/XML • Describe syntax features • Describe serialization