CubicWeb

The Semantic Web is a construction game!

Nicolas.Chauvat@logilab.fr

http://www.cubicweb.org

Evolution of the Web

The Semantic Web

=> need for adapted frameworks

CubicWeb: concepts

=> web apps AND semantic apps in one framework

CubicWeb: architecture

=> web apps AND semantic apps in one framework

Agility

=> agile and iterative development

Efficiency

=> 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

Any X ORDERBY CD DESC LIMIT 10
WHERE X is BlogEntry, X creation_date CD
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

class BlogEntry(AnyEntity):
    __implements__ = (ICalendarable,)

    def start(self):
        return self.creation_date

    def stop(self):
        return self.creation_date

Semantic views

=> publish data in RDF: LinkedData !

Using CubicWeb from TurboGears

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

CubicWeb: future