Evolution of the Web
- v0 = the internet links computers
- v1 = the web links documents
- v2 = web applications
- v3 = the semantic web links data
- v4 = personnal web, private life, security
- ... physical world, AI, etc.
The Semantic Web
- wold-wide distributed database (URL used as key)
- formats (RDF, OWL) and vocabularies (ontologies)
- query language (SPARQL)
=> need for adapted frameworks
CubicWeb: concepts
- entity-relationship to model data
- query language (RQL, soon SPARQL)
- views display results of queries
- web app made out of views (HTML, JSON, etc.)
- semantic views (RDF, OWL, etc.)
=> web apps AND semantic apps in one framework
CubicWeb: architecture
- data repository queried in RQL
- federates sources: SQL, RQL, LDAP, VCS...
- web engine communicates with repository via RQL
- web user interface partially generated
- library of reusable components (cubes)
=> web apps AND semantic apps in one framework
Agility
- a data model is enough to get started
- CRUD user interface generated
- improve views progressively
- migrate data iteratively without stress
=> agile and iterative development
Efficiency
- develop web apps OO-style
- maximise code reuse
- web UI friendly to power users
- data sources are abstracted and federated
=> efficient development and maintenance
Definition of a cube
class Blog(EntityType):
title = String(maxsize=50, required=True)
description = String()
class BlogEntry(EntityType):
title = String(required=True, fulltextindexed=True)
content = String(required=True, fulltextindexed=True)
entry_of = SubjectRelation('Blog', cardinality='**')
Assembling cubes
__use__ = ('blog', 'comment', 'tag',)
class comments(RelationDefinition):
subject = 'Comment'
object = 'BlogEntry'
class tags(RelationDefinition):
subject = 'Tag'
object = 'BlogEntry'
RQL queries
- 10 latest blog entries in reverse order:
Any X ORDERBY CD DESC LIMIT 10
WHERE X is BlogEntry, X creation_date CD
- entities tagged cubicweb or semantic:
Any X WHERE T tags X,
T name IN ('cubicweb', 'semantic')
also UNION, EXISTS, sub-queries, optional variables (outer join), etc.
Object logic and views
- objects can implement interfaces:
class BlogEntry(AnyEntity):
__implements__ = (ICalendarable,)
def start(self):
return self.creation_date
def stop(self):
return self.creation_date
- views can be applied to interfaces
Semantic views
- OWL - Ontology Web Language (describe data model)
- FOAF - Friend Of A Friend (social networks)
- SIOC - Semantically-Interlinked Online Communities (forum, message)
- DOAP - Description of a Project (software)
- microformats, RDFa, RSS, iCal, vCard, etc.
- ...
=> publish data in RDF: LinkedData !
Using CubicWeb from TurboGears
- repository run as a server or embedded in app
class Root(controllers.RootController):
cwdb = CubicWebDatabase('bookdb', 'admin', 'admin')
@expose(template="cubictg.templates.welcome")
def index(self, rql=''):
rset, colnames = [], []
if rql:
rset = self.cwdb.execute(rql)
colnames = get_col_names(rset)
return dict(rql=rql, rset=rset, colnames=colnames)
CubicWeb: history
- started in 2001 - part of the Narval research project
- version 1.0 in 2004 - in production at Logilab
- version 2.0 in 2006 - in production at clients
- version 3.0 in 2008 - LGPL and free download
- http://www.cubicweb.org
CubicWeb: future
- SPARQL support (queries and sources)
- RDF/LinkedData source (DBPedia, Geonames...)
- more vocabularies and generic semantic views
- semantic web services (merge REST, RDF and content negociation)
- URI as metadata and generic sameAs
- ...