{ "info": { "author": "Rok Garbas", "author_email": "rok@garbas.si", "bugtrack_url": null, "classifiers": [ "Framework :: Plone", "Framework :: Zope2", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "What this package do?\n=====================\n\n`IMS VDEX`_ is a standard for exchanging vocabularies.\n``collective.vdexvocabulary`` bridges between vdex vocabularies and zope\nvocabularies (``zope.schema.vocabularies``), so you can easily use it in\nsystems like Plone/ Zope, Pyramid or any other Zope-Toolkit supporting system.\n\n\n.. contents::\n\n\nWhats so special about it?\n==========================\n\n``collective.vdexvocabulary`` contains two different types of vocabularies:\n\n1. If you have big vocabularies with a lot of relations, like +10.000\n terms with +30.000 relations, so this would be perfect use case to use\n the ``VdexVocabulary`` type of ``collective.vdexvocabulary``.\n\n2. If you have tree-like vocabularies this is perfect too. ``TreeVocabulary``\n supports nested/ hierachical vocabularies.\n\nAlso there is other stuff which not supported by other vocabulary packages\n(i.e. for Plone/Zope):\n\n* i18n support. IMS VDEX supports translations within the VDEX-XML-File, both\n vocabulary types are supporting this way of translations.\n\n* proper order also with unicode characters (if zope.ucol is installed,\n vdexvocabulary only). If VDEX is order-sigificant the order given by vdex\n file is taken (supported by both vocabulary types).\n\n* easy registration using zcml\n\n* relations as it specified in IMS VDEX standard (for now only VdexVocabulary)\n\n\nHow do I use it?\n================\n\nConfiguration\n-------------\n\nIn your configure.zcml add::\n\n \n\n \n \n\nAnd to register a vdex vocabulary simply add line bellow pointing to file\ncontaining vdex vocabulary::\n\n \n\n \n\nor for tree vocabularies::\n\n \n\nTo make registration of vocabularies even easier you can also register\nseveral vocabularies and just point to directory::\n\n \n\n \n\nor for tree vocabularies::\n\n \n\nvdex files in ``path-to/my-vdex-vocabularies`` directory should have ending\n``.vdex`` to be recognized by ``vdex:vocabulary`` ZCML directive.\n\nSometimes you dont want VDEX-files inside your code tree. Therefore an\nenvironment variable can be given defining the base directory::\n\n \n\nor for tree vocabularies::\n\n \n\nBefore running the code with environment variable relative filenames/directories\none has to set the environmant variable, i.e. do an\n``export VDEX_BASE_DIR=/home/joe/vdex/`` in order to make it look for the vdex\nat ``/home/joe/vdex/my-vocabulary.vdex``.\n\n\nUsage in Code\n-------------\n\nVocabularies are named utiltiies in a zope-toolkit manner. The name is taken\nfrom the vdex file, its the ``vocabIdentifier``.\n\nGiven a vocabulary with the name ``beeeurope`` (see tree example below) one has\nto get the utility using the zope component architecture way::\n\n >>> from zope.component import getUtility\n >>> from zope.schema.interfaces import IVocabularyFactory\n >>> factory = zope.component.getUtility(IVocabularyFactory, 'beeeurope')\n\nThe factory returns on call a vocabulary. It expects a context, which can be\n``None`` in our case. If you are in an application server pass here your current\ncontext. In case of flat vocabularies this is used to detect the language, for\ntree vocabularies it is ignored, here an more advanced method is used to support\ni18n::\n\n >>> context = None\n >>> vocabulary = factory(context)\n\nNow you can use the vocabulary::\n\n >>> for term in vocabulary:\n ... print term.value\n ... print term.token\n ... print term.title\n ... print term.description\n\n\nHow to use tree-vocabularies\n----------------------------\n\nOnce looked up as shown above traversing the tree is easy. It works as defined\nin ``zope.schema.interfaces.ITreeVocabulary``. The ``term`` is also the key for\nthe sublevel::\n\n >>> def printlevel(leveldict, ident=0):\n ... for term in leveldict:\n ... print indent * ' ' + term.title\n ... printlevel(leveldict[term], indent+1)\n\nHint: ``collective.dynatree`` uses this kind of vocabularies and can be used as\nan example for own implementations too.\n\n\nHow to access relations (from code)\n-----------------------------------\n\nRelations are defined by `ISO2788`_.\n\nTo get listing of BMW car models from above VDEX example you have to::\n\n >>> from zope.schema.vocabulary import getVocabularyRegistry\n\n >>> vr = getVocabularyRegistry()\n >>> car_manufacturers = vr.get(self.context, 'your.package.car_manufacturers')\n >>> car_models = vr.get(self.context, 'your.package.car_models')\n\n >>> bmw = car_manufacturers.getTerm('bmw')\n >>> bmw_car_models = bmw.related.get('NT', [])\n\n\nExample VDEX file\n=================\n\nFlat with with relations\n------------------------\n\nExample of car manufacturers list (``car_manufacturers.vdex``).::\n\n \n \n your.package.car_manufacturers\n \n ford\n \n Ford\n Una miedra de coche\n \n \n \n bmw\n \n BMW\n Be-eMe-uWe, mierda\n \n \n\n \n bmw\n very-special-bmw-model\n NT\n \n\n ...\n\n \n\nList of car models (``car_models.vdex``).::\n\n \n \n your.package.car_models\n\n \n very-special-bmw-model\n \n Very special BMW model\n Un modelo de Be-eMe-uWe\n \n \n\n \n very-special-bmw-model\n bmw\n BT\n \n\n ...\n\n \n\nHierachical Tree\n----------------\n\nexample of a tree vocabulary::\n\n \n beeeurope\n \n European Honey Bees\n \n \n nwe\n \n North-west of Europe\n \n \n nwe.1\n \n A. m. iberica\n \n \n \n nwe.2\n \n A. m. intermissa\n \n \n \n nwe.3\n \n A. m. lihzeni\n \n \n \n nwe.4\n \n A. m. mellifera\n \n \n \n nwe.5\n \n A. m. sahariensis\n \n \n \n \n swe\n \n South-west of Europe\n \n \n swe.1\n \n A. m. carnica\n \n \n \n \n swe.2\n \n A. m. cecropia\n \n \n \n swe.3\n \n A. m. ligustica\n \n \n \n swe.4\n \n A. m. macedonica\n \n \n \n swe.5\n \n A. m. ruttneri\n \n \n \n swe.6\n \n A. m. sicula\n \n \n \n \n\n\nWhere can I complain / help / send rum?\n=======================================\n\n:Home + Source: https://github.com/collective/collective.vdexvocabulary\n:Report Issues: https://github.com/collective/collective.vdexvocabulary/issues\n:Send rum: contact rok@garbas.si for more info\n\n\nCredit\n======\n\n* Rok Garbas, http://garbas.si, , Author\n\n* Seantis gmbh, http://www.seantis.ch\n Thank you for initial idea with seantis.vdex where got the idea and then\n reimplement and extend it.\n\n* Jens W Klein, http://kleinundpartner.at, ,\n Cleanup, Treevocabulary/ i18n-support\n\n\nTODO\n====\n\n* fetch vocab(s) via url (new directive)\n\n* load vocabs view entry_points\n\n* store vocabs (or changed vocabs in zodb), will probably also need diff and merge option\n\n* write test and get decent test coverage\n\n* write documentation\n\n* make ZCML optional\n\n* make through the web vdex editor (this would probably need sponsoring)\n\n* add relation support to TreeVocabulary\n\n\n.. _`ISO2788`: http://www.imsglobal.org/vocabularies/iso2788_relations.xml\n.. _`IMS VDEX`: http://en.wikipedia.org/wiki/IMS_VDEX\n\nChangelog\n=========\n\n0.2.2 (2015-09-01)\n------------------\n\n- Newer lxml doesn't allow accessing ``_root`` anymore.\n This switches to ``getroot()``.\n [pilz]\n\n\n0.2.1 (2015-06-22)\n------------------\n\n- Plone 4.3 compatibility\n [ale-rt]\n\n- lxml compatibility (imsvdex dropped elementtree in favour of lxml)\n [ale-rt]\n\n- entry point for z3c.autoinclude\n [ale-rt]\n\n\n0.2 (2014-11-03)\n----------------\n\n- A bunch of refactoring in order to add a new vocab type: TreeVocabulary.\n As the name suggests, treevocabulary supports\n ``zope.schema.interfaces.ITreeVocabulary``. It has better i18n-support using\n own i18n-domains for the caption and description of a term.\n [jensens]\n\n\n0.1.2 (2014-01-07)\n------------------\n\n- don't use context to determine current language, but use getSite.\n context may be adapter or other object without acquisition\n (eg. in forms with ignoreContext=True).\n [naro]\n\n- depend on \"setuptools\", not \"distribute\"\n [nutjob]\n\n\n0.1.1 (2010-10-11)\n------------------\n\n- added **History**, **How to access relations (from code)** and **Example\n VDEX file** section to README.\n [garbas]\n\n- moved code to http://github.com/collective/collective.vdexvocabulary.\n [garbas]\n\n- BUG(Fixed): when vdex file was loaded it failed if there were not terms.\n [garbas]\n\n\n0.1 (2010-06-23)\n----------------\n\n- add documentation and clean up code a little bit.\n [garbas]\n\n\n0.1a1 (2010-04-29)\n------------------\n\n- initial release.\n [garbas]", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/collective/collective.vdexvocabulary", "keywords": "plone vdex zope vocabulary", "license": "GPL", "maintainer": null, "maintainer_email": null, "name": "collective.vdexvocabulary", "package_url": "https://pypi.org/project/collective.vdexvocabulary/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/collective.vdexvocabulary/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/collective/collective.vdexvocabulary" }, "release_url": "https://pypi.org/project/collective.vdexvocabulary/0.2.2/", "requires_dist": null, "requires_python": null, "summary": "IMS VDEX Vocabularies as Zope Vocabulary", "version": "0.2.2" }, "last_serial": 1703502, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "39cc3cc3b5b427e28b142682e67bebc2", "sha256": "2d3d9fe6e43224c402a2dfe71825230570287aa5e3649389067cdda25f3c18a8" }, "downloads": -1, "filename": "collective.vdexvocabulary-0.1.tar.gz", "has_sig": false, "md5_digest": "39cc3cc3b5b427e28b142682e67bebc2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6817, "upload_time": "2010-06-23T02:27:24", "url": "https://files.pythonhosted.org/packages/f8/9c/3ebe19c8d48804cf76930a6fc91c11a2a5da135b7014ac07e04be5187d91/collective.vdexvocabulary-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "e4a2063bcab21260fbe39b794c062327", "sha256": "126b76fc00a88912499252611d42ba80a8ce4fb204f8b9e9a03f10b4f2395d04" }, "downloads": -1, "filename": "collective.vdexvocabulary-0.1.1.tar.gz", "has_sig": false, "md5_digest": "e4a2063bcab21260fbe39b794c062327", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9268, "upload_time": "2010-10-11T19:49:07", "url": "https://files.pythonhosted.org/packages/67/f8/1fc13a2e3c8844f89a9f6011d6e5085949aca251c80c728adb5193ba63d8/collective.vdexvocabulary-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "c430e134cb388a49ab16fa7feb6cd6ed", "sha256": "314145cf0103ce095c7df25b6af095d0cd9a73d6ad1d3ae654cddc24541e490b" }, "downloads": -1, "filename": "collective.vdexvocabulary-0.1.2.tar.gz", "has_sig": false, "md5_digest": "c430e134cb388a49ab16fa7feb6cd6ed", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10232, "upload_time": "2014-01-07T15:10:41", "url": "https://files.pythonhosted.org/packages/f1/89/6524b5be5dcd33d57493093dd4a33d5d191182d96185e215d64e8e7f36de/collective.vdexvocabulary-0.1.2.tar.gz" } ], "0.1a1": [ { "comment_text": "", "digests": { "md5": "3a027f061ebed8693f87f35c82060591", "sha256": "99fb0f2418df7f3cf26fd8e0eab8d8ea4178b8d13f83271d6e0690d9ce24fd05" }, "downloads": -1, "filename": "collective.vdexvocabulary-0.1a1.tar.gz", "has_sig": false, "md5_digest": "3a027f061ebed8693f87f35c82060591", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6818, "upload_time": "2010-04-30T04:26:55", "url": "https://files.pythonhosted.org/packages/40/8d/abffd5cf6e73b4a906504d522570e2b822a4cdaa40d61e137c5df0e9a5b6/collective.vdexvocabulary-0.1a1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "65a47d5919ecb7a5726c997310fd6568", "sha256": "c4919a335febec9e6930e9366a6fd76ea7889dee461f358960eb579408cba28f" }, "downloads": -1, "filename": "collective.vdexvocabulary-0.2.zip", "has_sig": false, "md5_digest": "65a47d5919ecb7a5726c997310fd6568", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 28948, "upload_time": "2014-11-03T12:55:02", "url": "https://files.pythonhosted.org/packages/1a/d9/b775cc44a7ca6f0a83a85380ddec1ca117d9be385181723429a2229abd8b/collective.vdexvocabulary-0.2.zip" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "eeb736bdaae71c98d0e119244ac0d46e", "sha256": "cbfe87883cc3e29e55a17978a88dc25aa0d26c814f6ebd909f705acec5a1284e" }, "downloads": -1, "filename": "collective.vdexvocabulary-0.2.1.zip", "has_sig": false, "md5_digest": "eeb736bdaae71c98d0e119244ac0d46e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 30248, "upload_time": "2015-06-22T14:28:53", "url": "https://files.pythonhosted.org/packages/e2/ea/c6236e124b33fb9ce1f9c60ca55c03d52b653712b6e8ce3d565db8fe072c/collective.vdexvocabulary-0.2.1.zip" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "8e93a53b76e10e921f520ad8981d5cf6", "sha256": "1f20cc4960df31e4a1136b9db1f3d4f16310916a4d77204782488773d763aab2" }, "downloads": -1, "filename": "collective.vdexvocabulary-0.2.2.zip", "has_sig": false, "md5_digest": "8e93a53b76e10e921f520ad8981d5cf6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 30471, "upload_time": "2015-09-01T16:52:02", "url": "https://files.pythonhosted.org/packages/d7/2c/1491e06641466792aefeafdb09f8ff358f2a148c93812250ab7c45bc26c2/collective.vdexvocabulary-0.2.2.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8e93a53b76e10e921f520ad8981d5cf6", "sha256": "1f20cc4960df31e4a1136b9db1f3d4f16310916a4d77204782488773d763aab2" }, "downloads": -1, "filename": "collective.vdexvocabulary-0.2.2.zip", "has_sig": false, "md5_digest": "8e93a53b76e10e921f520ad8981d5cf6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 30471, "upload_time": "2015-09-01T16:52:02", "url": "https://files.pythonhosted.org/packages/d7/2c/1491e06641466792aefeafdb09f8ff358f2a148c93812250ab7c45bc26c2/collective.vdexvocabulary-0.2.2.zip" } ] }