RDF RDF Facts Resource
Total Page:16
File Type:pdf, Size:1020Kb
Internet Engineering RDF -Resource Description Framework Tomasz Babaczy ńskii , Zofia Kruczkiewicz Tomasz Kubik Information systems modelling – UML and service description languages RDF RDF facts • It is a framework for representing information about • W3C Recommendation on 10 February 2004 resources in a graph form – primarily intended to describe metadata about WWW – RDF-CONCEPTS, resources – RDF-SYNTAX, – can be used to describe anything that can be identified on the Web, even if it is not accessible – RDF-VOCABULARY, • RDF description can be read and understand by – RDF-SEMANTICS, computers, and exchanged without loss of meaning • W3C maintains RDF in the scope of its Semantic Web – RDF-TESTS, RDF-PRIMER Activity Resource URI • Uniform Resource Identifier is a global, rigid resource identifier with the • RDF can represent anything that can be named: an following syntax: object, act, or concept: – Abstract ideas as “classess”, “properties”, “groups”, “sets” scheme ":" hier_part ["?" query ] [ # fragment ] – Abstract terms, as “love” or “money” scheme – string (a letter followed by letters, digits, and ["+"|"."|"-"] ) – Real world objects, as “rock” or “sand” hier_part – has the following syntax: – Web resourvces [userInfo "@"] hostname [:port_number] [path] query – optional information, commonly organized as a sequence of: – … <key>=<value> pairs , separated by ";" or "&" • In RDF sense “named” means “identified by URI” fragment – optional part (local reference) • RDF uses URIs to identify resources, or, more Example: precisely, URIRefs. http://example.org/family.rdf#fatherOf URIRef IRI • The syntax of URI has been defined in [RFC2396] and updated in [RFC2732] • Internationalized Resource Identifier is a a complement to URI • The current generic URI syntax specification is [RFC3986]. • provides wider repertoire of characters allowed • URI can be absolute or relative: – Unicode/ISO10646 characters beyond U+007F – Absolute : a resource is identified with full and context independent – private characters of that set can occur only in query parts resource reference • Standardized in [RFC3987] that defines "internationalized" – Relative : a reference has not given full information to identify a resource and missing information must be derived from the context versions corresponding to other constructs from [RFC3986], • A URIRef is relative form of URI such as URI references. – consists of URI and optional fragment preceded by # • In many cases URI and IRI are used interchangeably, but – absolute URI of #section2 from the document practical replacement of URIs (or URI references) by IRIs (or http://www.example.org/index.html is IRI references) depends on the application. http://www.example.org/index.html#section2 Statement Remarks on statements • RDF is based on Graph data model • RDF model = set of RDF triples • Represented by the triple : <subject, predicate, object> . – The triple links one object ( subject ) to another object ( object ) or a triple = (subject, predicate, object) = statement literal via a property ( predicate ). • – In other words: a resource ( subject ) has a property ( predicate ) valued – subject = resource by property value ( object ). • RDF requires that: – predicate = property (of the resource) – subject has URI or is b-node ; – predicate has URI; – object = value (of the property) – object has URI, is b-node or is literal. • URIRefs identify subject, predicate, and object • The same URI can be assigned to a node and to an arc as well. Remarks on namespaces RDF Graph • Graphical representation of a triple • Some domain names appearing in the URL – subject and object nodes are resources authority part have been reserved for testing Predicate or other similar uses [RFC2606] Subject Object • example.com , example.net , or example.org do not refer to any existing – object node is a literal resources but serve for illustrative purposes Predicate Subject Object RDF graph example Complex values • “John Smith is a father of Susan Smith” • Each triple in RDF graph is known as a ‘property’. • Nodes may have more than one arc originating from them, http://example.org/family.rdf#fatherOf mailto:[email protected] mailto:[email protected] indicating that multiple propertyTypes are associated with the same resource. http://example.org/family.rdf#name http://example.org/family.rdf#name • Groups of multiple properties are known as ‘descriptions’. • PropertyTypes may point to simple atomic values (strings and "John Smith"^^xsd:string "Susan Smith"^^xsd:string numbers) or to more complex values that are themselves made up of collections of properties. • Both persons are identified by their e-mail addresses and their names are • syntactically, the values can be embedded (lexically in-line) or provided as typed literals. referenced (linked) More complicated RDF graph blank node (b-node ) • is a node of RDF graph, which is not identified by a URI and rdf:type rdf:bag URI-p1 is not a literal rdf:_1 • informal model with a URI-0 URI-p2 • is a graph scoped identifier that cannot be directly URI-1 Literal-1 bag URI-p0 URI-p4 rdf:_2 referenced from outside URI-2 URI-p3 Literal-0 URI-4 is used mainly for graph branching as for representing rdf:_3 • URI-p2 URI-3 Literal-3 higher arity relations URI-0 Literal-4 URI-p2 URI-p1 URI-1 Literal-1 it can be used only as a subject or an object of a RDF triple. URI-p0 • URI-2 URI-p3 URI-4 • it cannot be used as a predicate (in in some syntaxes like • formal model with a Literal-0 N3 it is acceptable to use a blank node as a predicate) URI-p2 URI-3 Literal-3 Literal-4 bag and a blank node URI-p4 • Using b-nodes may cause problems in merging or querying – possible node ID conflicts (merging) – temporary node ID assignments (querying) RDF graph labeling Literals • All literals are Unicode strings and represents value such as • URI can be a subject, a predicate or an object string or number • Literals cannot be the subjects of statements, only the objects of a triple (target nodes in the RDF graphs). • only URI can be a predicate of a triple • Literals can be either plain literals (without type) or typed literals • only URI and bnode can be a subject of a triple – Plain literals can have an optional language tag assigned in form of a suffix starting with @ followed by the language code string (as defined • bnode , URI or literal can be an object of a by [RFC-3066], normalized to lowercase). – Typed literals have a lexical form ending with a suffix being RDF datatype triple URI reference (as in XML Schema Datatypes or an URI of custom datatype defined). The suffix starts with two caret characters ^^. Typed literals RDF datatype • Not all XML Schema datatypes are suitable for the use in RDF. • There is no built-in concept of numbers or dates or – xsd:duration – does not have a well-defined value space; other common values in RDF – xsd:QName and xsd:ENTITY – require an enclosing XML • RDF predefines just one datatype: rdf:XMLLiteral, document context; which is used for embedding XML in RDF – xsd:ID and xsd:IDREF – are for cross references within an • There is no mechanism for defining new datatypes as XML document; well – xsd:NOTATION – is not intended for direct use; – It is expected that any new datatypes will be provided – xsd:IDREFS, xsd:ENTITIES and xsd:NMTOKENS – are separately, and identified with URI references, as XML sequence-valued datatypes which do not fit the RDF Schema datatypes defined in [XML-SCHEMA2]. datatype model. Higher-order statements Reification • Allows to build higher-order statements, i.e. statements • One can make RDF statements about other RDF statements about other RDF statements – “Ralph believes that the web contains one billion documents” • Models of other statements must be created. – “the creator of the statement that the creator of the document on RDF • New statements becomes new and accessible resources syntax is Ora Lassila is the Library of Congress” • RDF built-in predicate vocabulary for reification: • Higher-order statements – rdf:subject said Anne – allow us to express beliefs (and other modalities) – rdf:predicate – are important for trust models, digital signatures,etc. – rdf:object rdf:subject rdf:predicate rdf:object – also: metadata about metadata – rdf:type – are represented by modeling RDF in RDF itself reification John likes Mary “Anne said that John likes Mary" RDF serialization RDF and RDF Schema (RDFS) • A set of URIRefs is known as a vocabulary • Serialization provides a way to convert between the • RDF vocabulary contains basic terms for expressing simple abstract RDF model to a concrete format, such as a statements about resources, using named properties and values [RDF-CONCEPTS]. file or other byte stream. The most popular methods • RDFS vocabulary extends RDF vocabulary providing of RDF graphs serialization are: mechanisms for describing properties and relationships between these properties and other resources [RDF- – RDF/XML, Terse RDF Triple Language (Turtle), and N- VOCABULARY]. Triples. • RDF and RDFS vocabularies can describe relationships • Serialization preserves the constructs of the original between items from multiple vocabularies developed independently, usually with the aid of XML namespace RDF graph. names. OOP and RDF RDF vocabulary • In object oriented-programming languages class definition: – implies the characteristic of the instances • namespace: http://www.w3.org/1999/02/22-rdf-syntax-ns# – is done in terms of the properties its instances may have • In RDF properties definitions implies the class membership of RDF property and RDF reification RDF container RDF collection the instance. type vocabulary vocabulary vocabulary vocabulary – RDF describes properties in terms of the classes of resource to which rdf:Property rdf:Statement rdf:Seq rdf:List they apply rdf:type rdf:subject rdf:Bag rdf:first – If an instance has a certain property asserted with a domain defined, rdf:XMLLiteral rdf:predicate rdf:Alt rdf:rest this domain specifies the class of this instance rdf:value rdf:object rdf:_1 rdf:nil • Naming convention rdf:_2 – the class’s names starts with an upper case letter ..