loops/expert
helmutm 5271981119 merged Dojo 1.0 branch
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@2388 fd906abe-77d9-0310-91a1-e0d9ade77398
2008-02-10 09:56:42 +00:00
..
__init__.py added expert package (for intelligent query and filter features) 2007-03-10 11:06:00 +00:00
query.py work in progress: loops.expert 2007-03-17 14:18:12 +00:00
README.txt merged Dojo 1.0 branch 2008-02-10 09:56:42 +00:00
tests.py tests: ignore loops.expert when hurry.query is not present 2007-11-07 08:55:10 +00:00
testsetup.py merged Dojo 1.0 branch 2008-02-10 09:56:42 +00:00

===============================================================
loops - Linked Objects for Organization and Processing Services
===============================================================

The loops expert - knows what is in a loops site and how to make
use of it.

  ($Id$)

The query stuff depends on hurry.query, see
http://cheeseshop.python.org/pypi/hurry.query


Setting up a loops Site and Utilities
=====================================

Let's do some basic set up

  >>> from zope import component, interface
  >>> from zope.app.testing.setup import placefulSetUp, placefulTearDown
  >>> site = placefulSetUp(True)

and build a simple loops site with a concept manager and some concepts
(with a relation registry, a catalog, and all the type machinery - what
in real life is done via standard ZCML setup or via local utility
configuration):

  >>> from loops.expert.testsetup import TestSite
  >>> t = TestSite(site)
  >>> concepts, resources, views = t.setup()

  >>> #sorted(concepts)
  >>> #sorted(resources)
  >>> len(concepts) + len(resources)
  38


Type- and Text-based Queries
============================

  >>> from loops.expert import query
  >>> qu = query.Title('ty*')
  >>> list(qu.apply())
  [0, 1, 50]

  >>> qu = query.Type('loops:*')
  >>> len(list(qu.apply()))
  38

  >>> qu = query.Type('loops:concept:predicate')
  >>> len(list(qu.apply()))
  6

  >>> qu = query.Type('loops:concept:predicate') & query.Title('t*')
  >>> list(qu.apply())
  [1]


Relationship-based Queries
==========================

In addition to the simple methods of concepts and resources for accessing
relations to other objects the expert package provides methods
for selecting and filtering related objects using our basic querying
syntax (that in turn is based on hurry.query).

  >>> stateNew = concepts['new']
  >>> qu = query.Resources(stateNew)
  >>> list(qu.apply())
  [66, 71]


Fin de partie
=============

  >>> placefulTearDown()