Presentation is loading. Please wait.

Presentation is loading. Please wait.

OWL Representing Information Using the Web Ontology Language.

Similar presentations


Presentation on theme: "OWL Representing Information Using the Web Ontology Language."— Presentation transcript:

1 OWL Representing Information Using the Web Ontology Language

2 Section 2

3 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

4 Chapter 5

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

6 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.txthttp://www.ietf.org/rfc/rfc2396.txt ▫Classified as  Absolute  Relative ▫Treated like logical constants ▫Do not have to be resolvable to network resources

7 5.1 Absolute URIs cont’d Absolute URIs ▫Independent of context in which they are found ▫Syntax  URISchemeName:schemeSpecificPart  http://www.knightowlrestaurant.com 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

8 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 http://xmlns.com/foaf/spec/20071002.html

9 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

10 5.2 URI References Form 1: Full URIref with fragment ▫http://www.restaurant.org/food-ont#Pizzahttp://www.restaurant.org/food-ont#Pizza Form 2: Full URIref without fragment (absolute URI) ▫http://www.restaurant.org/food-onthttp://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

11 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/http://www.w3.org/TR/REC-xml-names/ ▫Can go anywhere in an XML file  Recommended location: tag

12 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 ▫ ▫"rest:pie" → "http://www.restaurant.org/menuontology#pie" Example default namespace declaration ▫ ▫"#pie" → "http://www.restaurant.org/menuontology#pie"

13 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

14 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/xmlbasehttp://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

15 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

16 Chapter 6

17 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

18 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

19 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- xmlhttp://www.w3.org/TR/REC- xml Key Lime Pie $2.75 Apple Pie $2.50

20 6.1.1 XML Features Structured syntax Widely adopted and supported Consistent & parseable Verbose & ugly, but human-readable Vendor-neutral Large community of developers

21 6.1.2 Syntax and Structure Markup tags delimit ▫Elements ▫Attributes ▫Content content ▫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

22 6.1.3 XML Declaration Optional but recommended Used at beginning of XML document Include version and encoding attributes Also recommended: ▫Containing file should have.xml suffix

23 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: Tags label content & give meaning for humans No semantics can be inferred from tags alone Qnames can be used as element names

24 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 ▫ Example ▫ 2.5

25 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.txthttp://www.ietf.org/rfc/rfc1766.txt Syntax ▫xml:lang="languageIdentifier" Example ▫ chicken ▫ pollo Values usually 2-letter codes from ISO-639, extended with dialiects ("en-US" for US English)

26 6.1.5.2 XML Syntax Approaches Element-centric (preferred) ▫ keyLimePie $2.75 Attribute-centric ▫ Element-centric preferable because it’s parseable and can be further subdivided Use attributes for metadata

27 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 ▫ Declare at beginning of document in DOCTYPE ▫ ]>http://www.w3.org/2002/07/owl# Example of use ▫

28 Simple Annotated Example http://www.w3.org/2002/07/owl# ]> Virtual Library A cool place. !-- is Comment (no /) Default base rather than filename. ! Is instructive (no /) !Entity defines URI macro in scope of rdf:RDF Href resolves to: http://ex.org/today/li b

29 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/http://www.w3.org/TR/xmlschema-2/ ▫ Defines primitive (string, decimal, float) & derived (integer sub-ranges) types Restrict values and associate representations with values

30 6.2.1 User Defined Datatypes Restrict numSlices datatype as integer from 1..8

31 6.2.2 Built-in OWL Datatypes Datatype CategoryDatatype Stringsxsd:string xsd:normalizedString xsd:token xsd:language xsd:NMTOKEN xsd:Name xsd:NCName Binaryxsd:hexBinary xsd:base64Binary Date/Time-relatedxsd:dateTime xsd:time xsd:date xsd:gYearMonth xsd:gYear xsd:gMonthDay xsd:gDay xsd:gMonth Booleanxsd:boolean Numericalxsd:decimal xsd:float xsd:double Decimal-derivedxsd:integer xsd:nonNegativeInteger xsd:positiveInteger xsd:nonPositiveInteger xsd:negativeInteger xsd:long xsd:int xsd:short xsd:byte xsd:unsignedLong xsd:unsignedInt xsd:unsignedShort xsd:unsignedByte Resourcexsd:anyURI

32 6.2.2 Built-in OWL Datatypes cont’d

33 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

34 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

35 Chapter 7

36 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

37 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

38 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

39 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

40 7.3 RDF Specification RDF Concepts and Abstract Syntax ▫http://www.w3c.org/TR/rdf-concepts/http://www.w3c.org/TR/rdf-concepts/ RDF Semantics ▫http://www.w3c.org.TR/rdf-mt/http://www.w3c.org.TR/rdf-mt/ RDF Primer ▫http://www.w3c.org/TR/rdf-primer/http://www.w3c.org/TR/rdf-primer/ RDF Test Cases ▫http://www.w3c.org/TR/rdf-testcases/

41 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

42 7.3 RDF Data Model Simple and syntax-independent Includes ▫Resources ▫Properties ▫Literals ▫Statements Also specifies a graphical representation method, but not really useful

43 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

44 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

45 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

46 Statement TypeSubjectPredicateObject Literal valued statementResourcePropertyLiteral data value Resource valued statementResourcePropertyResource 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)

47 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

48 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

49 Chapter 8

50 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

51 8.1 RDF/XML Overview Standard linear notation for ▫Serializing the RDF model ▫Exchanging RDF statements Specifies ▫Full serialization syntax ▫Abbreviated syntax Uses ▫XML namespaces ▫URIs ▫Properties ▫Values

52 8.1.1 Relation to XML RDF/XML ▫XML syntax for serializing RDF statements ▫Overcomes ambiguity ▫Makes assertions using XML format & transport

53 8.1.2 RDF/XML Specifications RDF/XML Specification ▫http://www.w3c.org/TR/rdf-syntax-grammar/http://www.w3c.org/TR/rdf-syntax-grammar/ Mime type & namespace ▫Indication to software how to interpret a file ▫Recommended namespace prefix: rdf ▫Namespace:  http://www.w3c.org/1999/02/22-rdf-syntax-ns# http://www.w3c.org/1999/02/22-rdf-syntax-ns# ▫Mime type:  application/rdf+xml

54 8.2 RDF Syntax Features (Using XML) RDF/XML ▫Standardized syntax ▫Benefits from XML features ▫Large installed base of tools & professionals ▫Leverages investments in tools and people ▫Benefits from XML’s tagging, namespaces, parsers, and APIs

55 8.3 RDF/XML Documents RDF/XML documents contain ▫A header ▫A series of RDF statement assertions  Provided as rdf:Description XML elements

56 8.3.1 File Header (rdf:RDF) RDF/XML headers contain ▫XML declaration ▫RDF element ▫Namespace declaration rdf:RDF element ▫Indicates its contents must be interpreted as RDF ▫All RDF content should be contained in it ▫Best practice: only one rdf:RDF per file Example start tag ▫

57 8.3.2 Resource Names RDF resources ▫Named with case-sensitive symbol names ▫Best practice: use “Lower CamelCase”  firstCourse, menuDish, ownedBy URIrefs provide identifiers for RDF resources Resources can be ▫Statement subjects ▫Predicates ▫Objects

58 8.3.3 RDF Statements (rdf:Description) rdf:Description element ▫Serializes a single RDF statement ▫“Description” about a resource ▫Contains property/value pairs ▫Subject is attribute of rdf:Description element  Identified by  rdf:ID attribute, if it’s a new resource  rdf:about attribute, if it was previously declared ▫Properties are contained elements ▫Property values either  Content inside property tags or  Attributes of property tags

59 8.3.3 RDF/XML Statements cont’d Statements can serve as predicates (i.e. nesting) ▫Same as giving statement an rdf:ID and referencing in a resource attribute ▫Best practice: give it an ID so it can be reused ▫Alternating subjects & predicates called striping Multiple property/value pairs can be contained within the same rdf:Description element Subject resource can be new or existing Property values can be ▫Literal ▫Existing individual resource ▫Container resource ▫Collection resource

60 8.3.3 RDF/XML Statements cont’d Subject Object Value Type LiteralExisting Resource Container Resource Collection Resource New Resource Form 1Form 2Form 3Form 4 Existing Resource Form 5Form 6Form 7Form 8 Forms 1-4 define new resources Forms 5-8 describe existing resources

61 <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:exterms="http://www.example.org/terms/"> August 16, 1999 en Example XML and Graph RDF entity started, namespaces defined Subject with multiple predicates.

62 8.3.4.1 Creating a Subject rdf:ID attribute of rdf:Description element ▫Creates a new resource referenced by its identifier ▫Statement forms 1-4 Syntax ▫ Example ▫ (Form 1) Full URI for resource is concatenation ▫base URI + "#" + value of rdf:ID attribute Can then be referenced as relative URIref in rdf:about attributes

63 8.3.4.2 Describing a Subject rdf:about attribute of rdf:Description element ▫Describes an existing resource by its identifier ▫Statement forms 5-8 ▫Extends definition of resources in another part of the ontology or in a different ontology Syntax ▫ propertyValue Example ▫ Key Lime Pie

64 8.3.5 Describing a Property RDF/XML properties ▫Are specified with URIrefs ▫Are specified as elements within rdf:Description elements ▫Should be named using lowerCamelCase

65 8.3.6 Describing a Property Value RDF subjects have multiple properties Each property is associated to a value Property values can be ▫A literal ▫A singular existing resource ▫A container resource ▫A collection resource

66 8.3.6.1 Literal Property Values Literals can be objects of statements ▫Forms 1 & 5 Literals cannot be subjects of statements

67 8.3.6.1.1 Plain Literal Parse Type A plain literal is ▫Untyped string with ▫Optional language identifier rdf:parseType=“Literal” attribute tells parsers to treat contents as literal rather than RDF/XML ▫Used to encode XML content as property value Syntax ▫ xmlContent Enables embedding XML without confusing parser

68 8.3.6.1.2 Typed Literals RDF typed literals are character string values with an associated datatype ▫Type specified using rdf:datatype attribute ▫Normally associated with an XML Schema datatype ▫Literal should be consistent with specified type Syntax ▫ literalValue Example ▫ 22:00:00 Best practice: stick with XMLS datatypes for literals

69 8.3.6.1.3 RDF Types rdf:type property ▫Equivalent to declaring the “class” of the resource ▫Represents a set to which the resource belongs ▫Asserts that an individual has all characteristics of the specified type ▫Supports “instance-of” relationships between resources & classes Individuals can belong to multiple types (classes) Syntax ▫ Example ▫ Alternate “typed node” syntax

70 8.3.6.1.3 RDF Types: Typed Nodes Typed node syntax ▫Shorthand notation for declaring that an individual is a member of a class ▫Uses the class’s QName as the tag name instead of rdf:Description with rdf:type property ▫Semantically the same; easier for humans to read, but interpreted identically by software Individuals in >1 class can only use typed node one time Syntax ▫ Example (multi-class): “Rice is a starch and a side dish” ▫

71 8.3.6.2 Existing Individual Resource rdf:resource attribute ▫Specifies that the already existing resource is the value of the property ▫Used in forms 2 & 6 Syntax ▫ Example: “Pizzaria 312 reports to Pizzaria 314” ▫

72 <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:exterms="http://www.example.org/terms/"> August 16, 1999 en Example XML and Graph

73 Example as Separate Statements <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:exterms="http://www.example.org/terms/"> August 16, 1999 en

74 8.3.6.3 Container Resource Normally, property value is 1 item (one-to-one) Can specify group of items as property value ▫Forms 3 & 7 ▫RDF “containers” used to treat group as 1 item 3 types of RDF containers ▫Bags ▫Sequences ▫Alternatives All container types treated the same semantically by RDF and OWL! ▫But types convey more information to developers

75 8.3.6.3.1 Container Properties No formal rules for interpreting container types ▫Not like defining a data structure; more like defining an enumerated list ▫Resources can occur in containers > 1 time ▫Containers can contain themselves! ▫“Open-ended”: no way to specify that no additional items can be added! Two types of container membership properties ▫Numbered properties (rdf:_n) ▫List properties (rdf:li)

76 8.3.6.3.1.1 Numbered Properties rdf:_n, where n is the index of the item ▫n must be a positive integer with no leading zeroes ▫Used to define/access the item at the nth position Syntax ▫ Example ▫

77 8.3.6.3.1.2 List Item Properties rdf:li property ▫Alternative to numbered properties ▫Automatically generates numbered properties ▫Replaced by parser with appropriate rdf:_n tag Syntax ▫ Example ▫

78 8.3.6.3.2 Unordered Container rdf:Bag class ▫Defines containers where order has no meaning ▫May contain resources and/or literals ▫May contain duplicate members Syntax ▫ Example: “Tonight’s pies are cherry & apple” ▫

79 <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:s="http://example.org/students/vocab#"> Example XML and Graph

80 8.3.6.3.3 Ordered Container rdf:Seq class ▫Defines containers representing ordered lists ▫May contain resources and/or literals ▫May contain duplicate members Syntax ▫ Example: “Courses in a 3 course meal” ▫

81 8.3.6.3.4 Alternatives Container rdf:Alt class ▫Defines lists of alternatives (resources or literals) where any one item is a valid selection ▫The first item in the list is the default selection  So there must always be at least one item in the list Syntax ▫ Example ▫

82 8.3.6.3.5 RDF Container Summary Container TypeNotes Bag (rdf:Bag)Collection of resources or literals such that the order of contained items is not significant Sequence (rdf:Seq)Collection of resources or literals such that the order of contained items is significant Alternatives (rdf:Alt)Collection of equally valid option items with the intent of selecting just one; at least one item must exist in the container, and the 1 st item in the container is the default selected value

83 8.3.6.4 RDF Collections rdfParseType=“Collection” attribute ▫Alternative to containers ▫Represent fixed finite list of items (closed set)  Once specified, items cannot be added ▫Forms 4 & 8 Syntax ▫ collectedContents Example ▫

84 8.3.6.4 RDF Collections cont’d rdf:List ▫Predefined collection class ▫rdf:first  First item in sub-list (“car”) ▫rdf:rest  Rest of sub-list (“cdr”)  End list with &rdf;nil Example ▫

85 8.3.6.4.2 & 3 rdf:first & rdf:rest rdf:first property ▫Represents the first item in a list or sub-list ▫Value must be a resource ▫Syntax  rdf:rest property ▫Represents the remaining items in a list or sub-list ▫Value is either another List or “&rdf:nil” indicating the end of the list ▫Syntax  or  …

86 <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:s="http://example.org/students/vocab#"> Example XML and Graph

87 Additional Examples Additional Examples at RDF Primer ▫Especially Sections 1-5 ▫http://www.w3c.org/TR/rdf-primer/http://www.w3c.org/TR/rdf-primer/


Download ppt "OWL Representing Information Using the Web Ontology Language."

Similar presentations


Ads by Google