Semantic TYPO3

Post on 11-May-2015

4.490 views 1 download

Tags:

description

Develop for TYPO3 with Semantic Web in mind.

Transcript of Semantic TYPO3

Semantic TYPO3

Develop Extensions with Semantic Web in MindJochen Rau @ T3CON11SFJune 11, 2011

(c) by Benjamin Nowack, Attribution 3.0 Unported (CC BY 3.0)

Concepts

(c) by Benjamin Nowack, Attribution 3.0 Unported (CC BY 3.0)

Implementations

(c) by Benjamin Nowack, Attribution 3.0 Unported (CC BY 3.0)

No Rocket Science

Jochen's is a Person.Jochen's age is 40.Jochen's name is Jochen Rau.Jochen likes TYPO3 and Wine.Jochen lives in Massachusetts.

Let's make some assertions about me

Jochen's is a Person.Jochen's age is 40.Jochen's name is Jochen Rau.Jochen likes TYPO3 and Wine.Jochen lives in Massachusetts.

Let's make some assertions about me

Subject Predicate Object

Jochen's is a Person.Jochen's age is 40.Jochen's name is Jochen Rau.Jochen likes TYPO3 and Wine.Jochen lives in Massachusetts.

Let's make some assertions about me

Subject Predicate ObjectTriple

Jochen's is a Person.Jochen's age is 40.Jochen's name is Jochen Rau.Jochen likes TYPO3 and Wine.Jochen lives in Massachusetts.

Let's make some assertions about me

Jochen 40

name Jochen Rau

age

TYPO3

WineMassachusetts

likeslikes

lives inPerson

is a

Jochen's is a Person.Jochen's age is 40.Jochen's name is Jochen Rau.Jochen likes TYPO3 and Wine.Jochen lives in Massachusetts.

Let's make some assertions about me

Jochen 40

name Jochen Rau

age

TYPO3

WineMassachusetts

likeslikes

lives in

TYPO3

PHP

TYPO3 is a free and open source content management system as well as a Model–view–controller (MVC) Web Application Development framework written in PHP.

description

platform

GNU General Public License

license

Person

is a

Jochen's is a Person.Jochen's age is 40.Jochen's name is Jochen Rau.Jochen likes TYPO3 and Wine.Jochen lives in Massachusetts.

Let's make some assertions about me

Jochen 40

name Jochen Rau

age

TYPO3

WineMassachusetts

likeslikes

lives in

TYPO3

PHP

TYPO3 is a free and open source content management system as well as a Model–view–controller (MVC) Web Application Development framework written in PHP.

description

platform

GNU General Public License

license

Person

is a

Unique Names for Resources

Jochen

Sebastian

likes

knows

Paris

Unique Names for Resources

<http://typoplanet.de/resource/Jochen>

<http://sebastian.kurfuerst.eu/>

<http://xmlns.com/foaf/0.1/knows>

<http://xmlns.com/foaf/0.1/likes>

<http://en.wikipedia.org/wiki/Paris_(2008_film)>

<http://sebastian.kurfuerst.eu/>

<http://typoplanet.de/resource/Jochen>

<http://typoplanet.de/resource/hg132k4jhjh1234t><urn:uuid:67ecc3bd-07e2-44f4-a788-597bf9949f0c>

<tel:+1-617-555-7332><mailto:jochen.rau@typoplanet.de>

Unique Names for Resources

<http://typoplanet.de/resource/Jochen>

<http://sebastian.kurfuerst.eu/>

<http://xmlns.com/foaf/0.1/knows>

<http://xmlns.com/foaf/0.1/likes>

<http://en.wikipedia.org/wiki/Paris_(2008_film)>

<http://sebastian.kurfuerst.eu/>

<http://example.com/JR> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .

<http://example.com/JR> <http://xmlns.com/foaf/0.1/age> "40" .

<http://example.com/JR> <http://xmlns.com/foaf/0.1/name> "Jochen Rau" .

<http://example.com/JR> <http://xmlns.com/foaf/0.1/interest> <http://dbpedia.org/resource/TYPO3> .

<http://example.com/JR> <http://xmlns.com/foaf/0.1/interest> <http://dbpedia.org/resource/Wine> .

<http://example.com/JR> <http://example.com/livesIn> <http://data.nytimes.com/Massachusetts> .

Turtle Serialization of an RDF Graph

@prefix ex: <http://example.org/> .@prefix dbp: <http://dbpedia.org/resource/> .@prefix nyt: <http://data.nytimes.com/> .@prefix foaf: <http://xmlns.com/foaf/0.1/> .

ex:JR a foaf:Person .ex:JR foaf:age "40" .ex:JR foaf:name "Jochen Rau" .ex:JR foaf:interest dbp:TYPO3 .ex:JR foaf:interest dbp:Wine .ex:JR ex:livesIn nyt:Massachusetts .

Turtle Serialization of an RDF Graph

@prefix ex: <http://example.org/> .@prefix dbp: <http://dbpedia.org/resource/> .@prefix nyt: <http://data.nytimes.com/> .@prefix foaf: <http://xmlns.com/foaf/0.1/> .

ex:JR a foaf:Person ; ex:age "40" ; ex:name "Jochen Rau" ; ex:likes dbp:TYPO3 ; ex:likes dbp:Wine ; ex:livesIn nyt:Massachusetts .

Turtle Syntactic sugar

@prefix ex: <http://example.org/> .@prefix dbp: <http://dbpedia.org/resource/> .@prefix nyt: <http://data.nytimes.com/> .@prefix foaf: <http://xmlns.com/foaf/0.1/> .

ex:JR a foaf:Person ; ex:age "40" ; ex:name "Jochen Rau" ; ex:likes dbp:TYPO3 , dbp:Wine ; ex:livesIn nyt:Massachusetts .

Turtle And even more syntactic sugar

RDF at a Glance

Simple, ubiquitous way of modeling dataMain concepts

Triples of subject, predicate, and objectUnique names for resourcesObjects can also be literal values (with data type or language)

Performant data stores (e.g. Virtuoso, AllegroGraph, BigOWLIM)Existing frameworks with rich APIs (e.g. JENA, Sesame, Erfurt)Billions of triples as Open Data available (e.g. Wikipedia, MusicBrainz)Many di!erent serialization formats (e.g. RDF/XML, Turtle, N3)Makes data migration much easier

Description Logic and Rules OWL and RIF

What? Why?Knowledge is spread all over the system:Domain model, database scheme, TS con"gurartion, FlexForm, TCA, documentation, Templates ...In di!erent Formats:SQL, TypoScript, XML, PHP, HTML ...Using inconsistent terminology:"Template" in TYPO3?

So, what to do?data and metadata in the same data structure (RDF)use well de"ned languages to describe (meta)data (OWL RIF)

Knublauch, Holger. KBeans Specification: Semantic Transparency for Components and Domain Models. Technical Report FAW-TR-01001, FAW Ulm, 2001.

Description Logic and Rules OWL and RIF

RDF in HTML

Three di!erent standards to markup your HTML codeMicroformatsMicrodata (part of HTML5 spec)RDFa ("RDF for attributes", W3C Recommendation)

A subset of RDFMakes web pages machine readable by your favorite search engine

<div>

<p> Alice Birpemswick </p> <p> Email: <a href="mailto:alice@example.com">alice@example.com</a> </p> <p> Phone: <a href="tel:+1-617-555-7332">+1 617.555.7332</a> </p></div>

RDF in HTML RDFa

<div prefix="foaf: http://xmlns.com/foaf/0.1/" about="http://example.com/resource/alice" typeof="Person"> <p property="foaf:name"> Alice Birpemswick </p> <p> Email: <a rel="foaf:mbox" href="mailto:alice@example.com">alice@example.com</a> </p> <p> Phone: <a rel="foaf:phone" href="tel:+1-617-555-7332">+1 617.555.7332</a> </p></div>

RDF in HTML RDFa

<div prefix="foaf: http://xmlns.com/foaf/0.1/" about="http://example.com/resource/alice" typeof="Person"> <p property="foaf:name"> Alice Birpemswick </p> <p> Email: <a rel="foaf:mbox" href="mailto:alice@example.com">alice@example.com</a> </p> <p> Phone: <a rel="foaf:phone" href="tel:+1-617-555-7332">+1 617.555.7332</a> </p></div>

RDF in HTML RDFa

http://example.com/resource/alice

<div prefix="foaf: http://xmlns.com/foaf/0.1/" about="http://example.com/alice#me" rel="knows"> <ul> <li typeof="Person"> <a rel="foaf:homepage" href="http://example.com/bob" property="foaf:name">Bob</a> </li> <li typeof="Person" > <a rel="foaf:homepage" href="http://example.com/eve" property="foaf:name">Eve</a> </li> <li typeof="Person" > <a rel="foaf:homepage" href="http://example.com/manu" property="foaf:name">Manu</a> </li> </ul></div>

RDF in HTML RDFa

<div prefix="foaf: http://xmlns.com/foaf/0.1/" about="http://example.com/alice#me" rel="knows"> <ul> <li typeof="Person"> <a rel="foaf:homepage" href="http://example.com/bob" property="foaf:name">Bob</a> </li> <li typeof="Person" > <a rel="foaf:homepage" href="http://example.com/eve" property="foaf:name">Eve</a> </li> <li typeof="Person" > <a rel="foaf:homepage" href="http://example.com/manu" property="foaf:name">Manu</a> </li> </ul></div>

RDF in HTML RDFa

RDF in HTML GoodRelations Vocabulary

# Set the doctype and add common namespacesconfig.doctype = xhtml+rdfa_10config.namespaces { xml = http://www.w3.org/XML/1998/namespace xmlns = http://www.w3.org/2000/xmlns/ xsd = http://www.w3.org/2001/XMLSchema# xhv = http://www.w3.org/1999/xhtml/vocab# rdfa = http://www.w3.org/ns/rdfa# rdf = http://www.w3.org/1999/02/22-rdf-syntax-ns# rdfs = http://www.w3.org/2000/01/rdf-schema# owl = http://www.w3.org/2002/07/owl# rif = http://www.w3.org/2007/rif#

[...]

dbo = http://dbpedia.org/ontology/ foaf = http://xmlns.com/foaf/0.1/ geo = http://www.w3.org/2003/01/geo/wgs84_pos# gr = http://purl.org/goodrelations/v1# cal = http://www.w3.org/2002/12/cal/ical# og = http://ogp.me/ns# v = http://rdf.data-vocabulary.org/# bibo = http://purl.org/ontology/bibo/}

RDF in HTML Enable RDFa in TYPO3

Demo

EXT:semantic SPARQL Client

Linked Data Cloud

Querying a Graph SPARQL

W3C RecommendationGraph pattern matchingSimilar to SQL and Turtle

Querying a Graph Filter, Functions, Ordering ...

Querying a Graph Custom Functions

Querying a Graph Property Paths

Querying a Graph Property Paths and Inference

Querying a Graph Subqueries

EXT:semantic SPARQL Query Administration

Default namespaces(RDFa default pro"le)Syntax highlightingCode indentation

Content Manager

EXT:semantic SPARQL Query Administration

Default namespaces(RDFa default pro"le)Syntax highlightingCode indentationFrontend and backend

Content Manager

EXT:semantic Custom Content Elements

Default layouts and custom HTML template codeSupport for pagination (dynamic query re-writing)

EXT:semantic Custom Content Elements

Frontend Backend

EXT:semantic Custom Content Elements

Query results variables are bound to the template variablesand are used as labels in a human readable form

Demo

class Tx_BlogExample_Domain_Repository_PostRepository extends Tx_Extbase_Persistence_Repository {

public function findByTagAndBlog($tag, Tx_BlogExample_Domain_Model_Blog $blog, $limit = 20) { $query = $this->createQuery(); return $query->matching( $query->logicalAnd( $query->equals('blog', $blog), $query->equals('tags.name', $tag) ) ) ->setOrderings(array('date' => Tx_Extbase_Persistence_QueryInterface::ORDER_DESCENDING)) ->setLimit((integer)$limit) ->execute(); }

public function findNext(Tx_BlogExample_Domain_Model_Post $post) { $query = $this->createQuery(); $posts = $query->matching($query->greaterThan('date', $post->getDate())) ->setOrderings(array('date' => Tx_Extbase_Persistence_QueryInterface::ORDER_DESCENDING)) ->execute(); return $posts->getFirst(); }

}

Query Object Model

Developer

Semantic TYPO3 Current Projects

SPARQL Client (EXT:semantic, Jochen Rau)RDF/RDFa support (Sebastian Kurfürst, masters thesis)CMS ontology (Andreas Wolf, GSoC)Taxonomy and Categories (EXT:taxonomy, Fabien Udriot)Semantic persistence backend (EXT:semantic, Thomas Maroschik)Globally unique identi"ers in v4 (EXT:identity, Thomas Maroschik)Tagging support for Editors (v4: RTE plugin, v5: Aloha)

Semantic TYPO3 Roadmap

Improve usability of SPARQL ClientTransform Domain Models into RDF(a)Transform OWL Ontologies into PHP Code and MetadataExtbase Query Object Model -> SPARQL Query

Semantic TYPO3 Vision

Semantic TYPO3 Vision

Semantic TYPO3 Vision

Demo

Thanks!

Twitter @jocrauEmail jochen.rau@typoplanet.deBlog http://blog.typoplanet.deTalk Lunch