IKS Semantic Workshop
                  Amsterdam 2010



  FISE integration with
    Python and Plone

Jens W. Klein <jk@kleinundpartner.at>

            2010-12-09
                              Creative Commons Namensnennung-
                              Keine kommerzielle Nutzung-
               Page 1 of 14   Keine Bearbeitung 3.0 Österreich Lizenz
Who we are

●   Jens Klein
        –   Managing Director an founder of KUP
        –   Software Architect and FOSS Enthusiaist
●   KUP - Klein & Partner KG
        –   web technology agency based in Innsbruck (AT)
        –   focused on Python, App-Engine, BFG, Zope, Plone
        –   founding member of BlueDynamics Alliance
●   BlueDynamics Alliance
        –   cluster of seven companies in region D-A-CH

                                              Creative Commons Namensnennung-
                                              Keine kommerzielle Nutzung-
                            Page 2 of 14      Keine Bearbeitung 3.0 Österreich Lizenz
PYTHON

●   programming language
●   used by Google, NASA and many more
●   increasing number of users
●   interpreted language (byte-code compiler)
●   untyped, lean, easy-to-read and understand
●   functional, object-oriented programming
●   powerful standard library
●   thousands of addon libraries

                                       Creative Commons Namensnennung-
                                       Keine kommerzielle Nutzung-
                       Page 3 of 14    Keine Bearbeitung 3.0 Österreich Lizenz
ZOPE

●   Python Technology for Web Applications
●   Zope 2 Web Application Server
        –   more than 10 years old, but continiously
             modernized
●   Bluebream webapplication framework
        –   application related parts of former Zope 3
●   Zope Toolkit Library
        –   used/created by devs of Zope2, BlueBream, BFG
●   BFG/ Pylons Pyramid light weight web-app
    framework (related)
                                                Creative Commons Namensnennung-
                                                Keine kommerzielle Nutzung-
                            Page 4 of 14        Keine Bearbeitung 3.0 Österreich Lizenz
PLONE

●   Web Content Management System
       –   built on top of Zope 2
       –   large community with >200 core contributors, in
             top 3% of FOSS-communities
       –   trademark and IP managed by non-profit
             Plone Foundation
       –   excellent security record
       –   common WebCMS with focus on users/usability,
             scalability
       –   addons and plugins for hundreds of use-cases

                                             Creative Commons Namensnennung-
                                             Keine kommerzielle Nutzung-
                           Page 5 of 14      Keine Bearbeitung 3.0 Österreich Lizenz
bring FISE to the Plone
                                    Community:
                               Conference 2010
●   Talk at Plone Conference 2010/ Bristol
        –   recorded at
              http://ploneconference2010.blip.tv/file/4317791
●   Open Space Session on Semantics in Plone
●   One Day Sprint (aka Hackathon) on FISE




                                               Creative Commons Namensnennung-
                                               Keine kommerzielle Nutzung-
                            Page 6 of 14       Keine Bearbeitung 3.0 Österreich Lizenz
FISE Python API
                                                 Goals
●   offer a pythonic API to all FISE features exposed
    by its RESTFul API
●   hide as much as possible the HTTP aspect
●   use a widely used, well tested and scaleable
    foss-library for RESTFul http connections
●   full test coverage with Python doctests
●   provide an zc.buildout based installation which
    includes FISE itself and the tests


                                              Creative Commons Namensnennung-
                                              Keine kommerzielle Nutzung-
                        Page 7 of 14          Keine Bearbeitung 3.0 Österreich Lizenz
FISE Python-API
                                              fise.client

Wanna smell code? Doctest style:
FISE „engines“

1   >>> from fise.client import FISE
2   >>> fise = FISE('http://localhost:8080/')
3   >>> somedoc = u"This is an example text."
4   >>> fise.engines(somedoc)
5   '<rdf:RDF...</rdf:RDF>n'
6 >>> fise.engines(somedoc, format='rdfjson')
7 '{"...}'
8 >>> fise.engines(somedoc, parsed=True)
9 <Graph identifier=... (<class 'rdflib.Graph.Graph'>)>

                                                Creative Commons Namensnennung-
                                                Keine kommerzielle Nutzung-
                         Page 8 of 14           Keine Bearbeitung 3.0 Österreich Lizenz
FISE Python-API
                                             fise.client

FISE „store“

1   >>> generated_id = fise.store.add(somedoc)
2   >>> fise.store[existing_id] = somedoc
3   >>> fise.store[generated_id] == somedoc
4   True
5 >>> fise.store.metadata(existing_id)
6 '<rdf:RDF...</rdf:RDF>n'
7 >>> fise.store.metadata(existing_id, parsed=True)
8 <Graph identifie... (<class 'rdflib.Graph.Graph'>)>
 9 >>> fise.store.page(generated_id)
10 '<html>...</html>'

                                               Creative Commons Namensnennung-
                                               Keine kommerzielle Nutzung-
                        Page 9 of 14           Keine Bearbeitung 3.0 Österreich Lizenz
FISE Python API
                      Implementation Details
●   uses restkit as rest library
●   uses rdflib to transform results to Python object
    graphs,
●   uses SuRF library (on top of rdflib) for Sparql
    queries.
●   code at http://github.com/collective/fise.client
●   integration buildout at
    http://github.com/collective/fise-buildout


                                          Creative Commons Namensnennung-
                                          Keine kommerzielle Nutzung-
                         Page 10 of 14    Keine Bearbeitung 3.0 Österreich Lizenz
fise.client
                                        code location
●   Python-API
    http://github.com/collective/fise.client
●   Python Integration Buildout
    http://github.com/collective/fise-buildout
●   Plone Integration Package
    http://github.com/collective/fise.plone




                                             Creative Commons Namensnennung-
                                             Keine kommerzielle Nutzung-
                        Page 11 of 14        Keine Bearbeitung 3.0 Österreich Lizenz
Plone Integration

Work done so far:
●   „indexing“ in FISE after creation and changes of
    content-objects.
Whats missing?
●   query facility
        –   Zope plugin index to FISE sparql endpoint
        –   Integration with Collections
●   passing the site-structure and DC to FISE.
●   asynchronous processing
                                               Creative Commons Namensnennung-
                                               Keine kommerzielle Nutzung-
                            Page 12 of 14      Keine Bearbeitung 3.0 Österreich Lizenz
Plone Demo




DEMO TIME




                     Creative Commons Namensnennung-
                     Keine kommerzielle Nutzung-
  Page 13 of 14      Keine Bearbeitung 3.0 Österreich Lizenz
The End




Questions

 Answers

Discussions


                  Creative Commons Namensnennung-
                  Keine kommerzielle Nutzung-
  Page 14 of 14   Keine Bearbeitung 3.0 Österreich Lizenz

FISE Integration with Python and Plone

  • 1.
    IKS Semantic Workshop Amsterdam 2010 FISE integration with Python and Plone Jens W. Klein <jk@kleinundpartner.at> 2010-12-09 Creative Commons Namensnennung- Keine kommerzielle Nutzung- Page 1 of 14 Keine Bearbeitung 3.0 Österreich Lizenz
  • 2.
    Who we are ● Jens Klein – Managing Director an founder of KUP – Software Architect and FOSS Enthusiaist ● KUP - Klein & Partner KG – web technology agency based in Innsbruck (AT) – focused on Python, App-Engine, BFG, Zope, Plone – founding member of BlueDynamics Alliance ● BlueDynamics Alliance – cluster of seven companies in region D-A-CH Creative Commons Namensnennung- Keine kommerzielle Nutzung- Page 2 of 14 Keine Bearbeitung 3.0 Österreich Lizenz
  • 3.
    PYTHON ● programming language ● used by Google, NASA and many more ● increasing number of users ● interpreted language (byte-code compiler) ● untyped, lean, easy-to-read and understand ● functional, object-oriented programming ● powerful standard library ● thousands of addon libraries Creative Commons Namensnennung- Keine kommerzielle Nutzung- Page 3 of 14 Keine Bearbeitung 3.0 Österreich Lizenz
  • 4.
    ZOPE ● Python Technology for Web Applications ● Zope 2 Web Application Server – more than 10 years old, but continiously modernized ● Bluebream webapplication framework – application related parts of former Zope 3 ● Zope Toolkit Library – used/created by devs of Zope2, BlueBream, BFG ● BFG/ Pylons Pyramid light weight web-app framework (related) Creative Commons Namensnennung- Keine kommerzielle Nutzung- Page 4 of 14 Keine Bearbeitung 3.0 Österreich Lizenz
  • 5.
    PLONE ● Web Content Management System – built on top of Zope 2 – large community with >200 core contributors, in top 3% of FOSS-communities – trademark and IP managed by non-profit Plone Foundation – excellent security record – common WebCMS with focus on users/usability, scalability – addons and plugins for hundreds of use-cases Creative Commons Namensnennung- Keine kommerzielle Nutzung- Page 5 of 14 Keine Bearbeitung 3.0 Österreich Lizenz
  • 6.
    bring FISE tothe Plone Community: Conference 2010 ● Talk at Plone Conference 2010/ Bristol – recorded at http://ploneconference2010.blip.tv/file/4317791 ● Open Space Session on Semantics in Plone ● One Day Sprint (aka Hackathon) on FISE Creative Commons Namensnennung- Keine kommerzielle Nutzung- Page 6 of 14 Keine Bearbeitung 3.0 Österreich Lizenz
  • 7.
    FISE Python API Goals ● offer a pythonic API to all FISE features exposed by its RESTFul API ● hide as much as possible the HTTP aspect ● use a widely used, well tested and scaleable foss-library for RESTFul http connections ● full test coverage with Python doctests ● provide an zc.buildout based installation which includes FISE itself and the tests Creative Commons Namensnennung- Keine kommerzielle Nutzung- Page 7 of 14 Keine Bearbeitung 3.0 Österreich Lizenz
  • 8.
    FISE Python-API fise.client Wanna smell code? Doctest style: FISE „engines“ 1 >>> from fise.client import FISE 2 >>> fise = FISE('http://localhost:8080/') 3 >>> somedoc = u"This is an example text." 4 >>> fise.engines(somedoc) 5 '<rdf:RDF...</rdf:RDF>n' 6 >>> fise.engines(somedoc, format='rdfjson') 7 '{"...}' 8 >>> fise.engines(somedoc, parsed=True) 9 <Graph identifier=... (<class 'rdflib.Graph.Graph'>)> Creative Commons Namensnennung- Keine kommerzielle Nutzung- Page 8 of 14 Keine Bearbeitung 3.0 Österreich Lizenz
  • 9.
    FISE Python-API fise.client FISE „store“ 1 >>> generated_id = fise.store.add(somedoc) 2 >>> fise.store[existing_id] = somedoc 3 >>> fise.store[generated_id] == somedoc 4 True 5 >>> fise.store.metadata(existing_id) 6 '<rdf:RDF...</rdf:RDF>n' 7 >>> fise.store.metadata(existing_id, parsed=True) 8 <Graph identifie... (<class 'rdflib.Graph.Graph'>)> 9 >>> fise.store.page(generated_id) 10 '<html>...</html>' Creative Commons Namensnennung- Keine kommerzielle Nutzung- Page 9 of 14 Keine Bearbeitung 3.0 Österreich Lizenz
  • 10.
    FISE Python API Implementation Details ● uses restkit as rest library ● uses rdflib to transform results to Python object graphs, ● uses SuRF library (on top of rdflib) for Sparql queries. ● code at http://github.com/collective/fise.client ● integration buildout at http://github.com/collective/fise-buildout Creative Commons Namensnennung- Keine kommerzielle Nutzung- Page 10 of 14 Keine Bearbeitung 3.0 Österreich Lizenz
  • 11.
    fise.client code location ● Python-API http://github.com/collective/fise.client ● Python Integration Buildout http://github.com/collective/fise-buildout ● Plone Integration Package http://github.com/collective/fise.plone Creative Commons Namensnennung- Keine kommerzielle Nutzung- Page 11 of 14 Keine Bearbeitung 3.0 Österreich Lizenz
  • 12.
    Plone Integration Work doneso far: ● „indexing“ in FISE after creation and changes of content-objects. Whats missing? ● query facility – Zope plugin index to FISE sparql endpoint – Integration with Collections ● passing the site-structure and DC to FISE. ● asynchronous processing Creative Commons Namensnennung- Keine kommerzielle Nutzung- Page 12 of 14 Keine Bearbeitung 3.0 Österreich Lizenz
  • 13.
    Plone Demo DEMO TIME Creative Commons Namensnennung- Keine kommerzielle Nutzung- Page 13 of 14 Keine Bearbeitung 3.0 Österreich Lizenz
  • 14.
    The End Questions Answers Discussions Creative Commons Namensnennung- Keine kommerzielle Nutzung- Page 14 of 14 Keine Bearbeitung 3.0 Österreich Lizenz