<<

Repetition

INF3580/4580 – Semantic Technologies – Spring 2015 Lecture 15: RDFa 18 June: Guest lecture, Lars Marius Garshol 25 May: no lecture (Whit Monday) Martin Giese 1st June is reserved for “Repetition” No fixed lecture material 11th May 2015 You, the students, say what you want to hear Let me know in time, so I’m prepared. Department of University of Drop a mail to [email protected] until 18th May Informatics Oslo

INF3580/4580 :: Spring 2015 Lecture 15 :: 11th May 2 / 29

Reminder Today’s Plan Outline

1 Reminder 1 Reminder

2 Linking RDF to HTML 2 Linking RDF to HTML

3 RDFa 3 RDFa

4 Conclusion 4 Conclusion

INF3580/4580 :: Spring 2015 Lecture 15 :: 11th May 3 / 29 INF3580/4580 :: Spring 2015 Lecture 15 :: 11th May 4 / 29 Reminder Linking RDF to HTML RDF on the Web Outline

RDF data exists in many forms: 1 Reminder In RDF files, downloadable with HTTP, FTP, etc. FOAF profiles data files from .org, geonames, etc. 2 Linking RDF to HTML In RSS 1.0 feeds Published using LOD principles (hash/slash namespaces) As in PDF/A files 3 RDFa As data model behind SPARQL query endpoints for instance dbpedia.org, dblp, and others Embedded in HTML, as RDFa 4 Conclusion

INF3580/4580 :: Spring 2015 Lecture 15 :: 11th May 5 / 29 INF3580/4580 :: Spring 2015 Lecture 15 :: 11th May 6 / 29

Linking RDF to HTML Linking RDF to HTML The Problem Embedding RDF/XML in (X)HTML

First idea: Embed RDF/XML in HTML or XHTML: The HTML web contains lots of human-readable information How can clients discover the location of corresponding machine-readable information? My Homepage Martin Giese ? ... −→ Not recommended: Does not fit HTML or XHTML DTDs No satisfactory solution, due to flexible RDF vocabulary B.t.w. there is a metadata element in SVG for this!

INF3580/4580 :: Spring 2015 Lecture 15 :: 11th May 7 / 29 INF3580/4580 :: Spring 2015 Lecture 15 :: 11th May 8 / 29 Linking RDF to HTML Linking RDF to HTML HTML LINK elements LINKing to RDF

LINK may occur inside HTML HEAD elements relate a document to other documents CSS style sheets Alternative languages To link to an RDF representation: Next, previous, index, etc. xml" rel – the kind of relation title="RDF/XML version" type – the of the related document href="http://dbpedia.org/data/Oslo.xml"> href – the URL of the other document title – the title of the other document Also: rel="meta" (and some more) Note: difference between meta-data and alternative representation E.g. a style sheet: Various web browser plugins exist to detect these LINKs My Homepage INF3580/4580 :: Spring 2015 Lecture 15 :: 11th May 9 / 29 INF3580/4580 :: Spring 2015 Lecture 15 :: 11th May 10 / 29

Linking RDF to HTML RDFa HTTP Link: response headers Outline

Problems with elements: Only works with HTML data, not PDF, Images, etc. 1 Reminder Need to download HTML content and search LINK. Idea: put information in HTTP response header. Non-standardized proposal, originally by Berners-Lee, 1992 2 Linking RDF to HTML Generated by a few servers, recognized by a few clients Same information as in LINK HTML element, but as HTTP header: 3 RDFa Link: ; rel="alternate"; type="application/rdf+xml" Advantages: 4 Conclusion can be sent also with non-HTML data requires only HEAD request

INF3580/4580 :: Spring 2015 Lecture 15 :: 11th May 11 / 29 INF3580/4580 :: Spring 2015 Lecture 15 :: 11th May 12 / 29 RDFa RDFa Once More: Embedding RDF in (X)HTML RDFa Processing

Web browsers ignore RDFa attributes Directly embedding RDF/XML in (X)HTML does not work well RDFa processors extract a single RDF graph from a document Use a different “serialization” that blends well with (X)HTML!

From the RDFa specification (http://www.w3.org/TR/rdfa-syntax/) XHTML+RDFa The aim of RDFa is to allow a single RDF graph to be carried in various types of document mark-up. Web browser RDFa processor XHTML in spec., but works with HTML and other XML RDFa adds a fixed set of attributes to (X)HTML Document type: Web page RDF graph

INF3580/4580 :: Spring 2015 Lecture 15 :: 11th May 13 / 29 INF3580/4580 :: Spring 2015 Lecture 15 :: 11th May 14 / 29

RDFa RDFa RDFa Concepts Reminder: (X)HTML Meta and Link

Links and metadata in HTML header: RDFa adds semantic annotations to hyper-links (href) Page 507 textual content RDFa attributes can appear in (almost) any element As the XHTML is processed, there is always a “current subject” that generated triples refer to ... The current subject starts as the base URI of the document, but can change on the way Meaning of name and rel informal Only a few values defined by the standard

INF3580/4580 :: Spring 2015 Lecture 15 :: 11th May 15 / 29 INF3580/4580 :: Spring 2015 Lecture 15 :: 11th May 16 / 29 RDFa RDFa RDFa property and rel Attribute rel on A elements

“semantic” meta and link in RDFa: rel="cc:license" MG’s home page href="http://creativecommons.org/licenses/by-nc-nd/3.0/"> Creative Commons License . ... Extracted triple: <> cc:license . Extracted triples: (<> is base URI!) Can use rev instead of rel to swap subject and object <> dc:creator "Martin Giese" . <> foaf:topic .

INF3580/4580 :: Spring 2015 Lecture 15 :: 11th May 17 / 29 INF3580/4580 :: Spring 2015 Lecture 15 :: 11th May 18 / 29

RDFa RDFa The property attribute Changing the Subject

rel is for resource objects, property for literal objects: about changes subject of contained rel and property annotations: xmlns:foaf="http://xmlns.com/foaf/0.1/"> ...

Martin Giese

Email:

Kransen

Written in 1920 [email protected]

Phone: Extracted triples: 31 41 59 26

<> dc:title "Kransen" ; dc:created "1920" .
Can also use content attribute together with property: Extracted triples: foaf:name "Martin Giese" ; content="2007-09-16T16:00:00-05:00"> foaf:mbox ; September 16th at 4pm foaf:phone . INF3580/4580 :: Spring 2015 Lecture 15 :: 11th May 19 / 29 INF3580/4580 :: Spring 2015 Lecture 15 :: 11th May 20 / 29 RDFa RDFa Types and Blank Nodes Know Your Friends

typeof adds an rdf:type triple Missing objects collected from contained elements (chaining): Missing URIs can lead to blank nodes:

xmlns:foaf="http://xmlns.com/foaf/0.1/">
  • Martin [] a foaf:Person ;
  • foaf:name "Martin Giese" ; foaf:mbox ;

    INF3580/4580 :: Spring 2015 Lecture 15 :: 11th May 21 / 29 INF3580/4580 :: Spring 2015 Lecture 15 :: 11th May 22 / 29

    RDFa RDFa Triples From Chaining Example RDFa Summary

    http:/...kjernsmo.net/ Allows to “hide” an RDF graph in an XHTML document XHTML processor can ignore RDFa foaf:homepage RDFa processor can extract RDF graph foaf:name Kjetil rdf:type Treat links and text as subjects/objects and literals

    foaf:knows Many, many more details! Specification hardly less complicated than RDF/XML foaf.rdf#me foaf:Person See spec. at http://www.w3.org/TR/rdfa-syntax/ foaf:knows

    rdf:type Nothing you couldn’t do with a LINK and an RDF file

    foaf:name Can be convenient to have information in one place Martin foaf:homepage Used by Google as one data format for “Rich Snippets” https://developers.google.com/structured-data/

    http:/.../martige/ NOTE: this lecture was about RDFa 1.0. Search the web for RDFa 1.1!

    INF3580/4580 :: Spring 2015 Lecture 15 :: 11th May 23 / 29 INF3580/4580 :: Spring 2015 Lecture 15 :: 11th May 24 / 29 Conclusion Conclusion Outline Topics Covered

    1 Reminder RDF, principles, syntax The Jena API for RDF 2 Linking RDF to HTML The SPARQL Query Language Basics of the RDFS and OWL ontology languages 3 RDFa Basics of model semantics and reasoning Linked Open Data, RDFa

    4 Conclusion Publishing as RDF

    INF3580/4580 :: Spring 2015 Lecture 15 :: 11th May 25 / 29 INF3580/4580 :: Spring 2015 Lecture 15 :: 11th May 26 / 29

    Conclusion Conclusion Topics Not Covered Help! I Can’t Get Enough!

    Rule Languages (SWRL, RIF, Jena rules, etc.) For more information on theory: SW application structures Book on Foundations of SW Technologies Services Take a course in logic or automated reasoning Details of RDF/RDFS model semantics For more information on practical questions: Some details of OWL Book on Semantic Web Programming Standards texts on W3C Web pages Details of OWL 2 profiles Google Logical theory: Soundness, Completeness,. . . Still not enough? (You ain’t seen nothing yet :-) Contact us for possible MSc topics! And many more!

    INF3580/4580 :: Spring 2015 Lecture 15 :: 11th May 27 / 29 INF3580/4580 :: Spring 2015 Lecture 15 :: 11th May 28 / 29