diff --git a/docs/source/conf.py b/docs/source/conf.py index 97f72483..017007e8 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -267,9 +267,11 @@ # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = { 'python': ('http://docs.python.org/', None), - 'skosprovider': ('http://skosprovider.readthedocs.org/en/latest', None), - 'pyramidskosprovider': ('http://pyramid-skosprovider.readthedocs.org/en/latest', None), - 'skosprovidersqlalchemy': ('http://skosprovider-sqlalchemy.readthedocs.org/en/latest', None), - 'pyramid': ('http://docs.pylonsproject.org/projects/pyramid/en/latest', None), - 'colander': ('http://docs.pylonsproject.org/projects/colander/en/latest', None) + 'skosprovider': ('https://skosprovider.readthedocs.io/en/latest', None), + 'pyramidskosprovider': ('https://pyramid-skosprovider.readthedocs.io/en/latest', None), + 'skosprovidersqlalchemy': ('https://skosprovider-sqlalchemy.readthedocs.io/en/latest', None), + 'pyramid': ('https://docs.pylonsproject.org/projects/pyramid/en/latest', None), + 'colander': ('https://docs.pylonsproject.org/projects/colander/en/latest', + None), + 'rdflib': ('https://rdflib.readthedocs.io/en/latest', None) } diff --git a/docs/source/customisation.rst b/docs/source/customisation.rst index 82972b5d..b96bd271 100644 --- a/docs/source/customisation.rst +++ b/docs/source/customisation.rst @@ -677,9 +677,11 @@ datamodel. The supported file types: -- RDF (.html, .hturtle, .mdata, .microdata, .n3, .nquads, .nt, .rdfa, .rdfa1.0, .rdfa1.1, .trix, .turtle, .xml) - using :class:`~skosprovider_rdf.providers.RDFProvider`. This provider supports - the full datamodel. +- RDF using :class:`~skosprovider_rdf.providers.RDFProvider`. This provider supports + the full datamodel. Since the heavy lifting is done by `RDFlib`, most of the + dialects supported by `RDFlib` should work. The full list can be found in + `rdflib.util.SUFFIX_FORMAT_MAP`. Formats like `rdf/xml` and `turtle` should + work. - CSV (.csv) using :class:`~skosprovider.providers.SimpleCsvProvider`. The provider only supports importing and id, a prefLabel, a note and a source. It will work well when importing a simple flat list, but not for complex @@ -687,6 +689,23 @@ The supported file types: - JSON (.json) using :class:`~skosprovider.providers.DictionaryProvider`. This provider supports the full datamodel. +Some things to take into account: + +- Atramhasis only supports concepts with a numeric id. This ensures they can be + auto-generated when adding new concepts or collections. These map to the + `concept_id` attribute in the database, which is unique per conceptscheme as + opposed to the `id` attribute that is unique for the entire database. +- When importing from an RDF vocabulary, the id will be read from a `dc` or + `dcterms` `identifier` property if present. Please ensure this property + contains a numeric id, not a string or a URI. +- When importing from RDF, the import file could possibly contain more than one + conceptscheme. Please ensure only one conceptscheme is present or + no conceptschemes are presents and specify the URI and label on the command + line. +- When importing from CSV or JSON, the data file only contains the concepts and + collections in the scheme, but not the conceptscheme itself. In this case, + please specify the URI and label of the conceptscheme on the command line. + The script can be called through the commandline in the project virtual environment. Call it with the `help` argument to see the possible arguments. @@ -717,9 +736,11 @@ PostGreSQL and SQLite are supported. The structure is either `postgresql://username:password@host:port/db_name` or either `sqlite:///path/db_name.sqlite`. The default value is `sqlite:///atramhasis.sqlite`. -The data is loaded in a :class:`~skosprovider_sqlalchemy.models.ConceptScheme`. The -conceptscheme needs a label. The label can be added to the `conceptscheme_label` -argument. The default label is the name of the file. +The data is loaded in a :class:`~skosprovider_sqlalchemy.models.ConceptScheme`. With a +:class:`~skosprovider_rdf.providers.RDFProvider` the conceptscheme can be present +in the RDF file. The other providers can specify it on the command line +through the `conceptscheme_label` argument. If no `conceptscheme_label` is present, +the default label is the name of the file. Once the data is loaded in the database, the configuration of the added provider must be included in the :file:`my_thesaurus/skos/__init__.py`. A successfull run of the diff --git a/tests/test_import_scripts.py b/tests/test_import_scripts.py index c1f40b1e..12eb7ccc 100644 --- a/tests/test_import_scripts.py +++ b/tests/test_import_scripts.py @@ -47,7 +47,7 @@ def _check_trees(self, conceptscheme_label): sql_prov = SQLAlchemyProvider({'id': 'TREES', 'conceptscheme_id': 1}, self.session) dump = dict_dumper(sql_prov) - self.assertEqual(conceptscheme_label, sql_prov.concept_scheme.labels[0].label) + self.assertEqual(conceptscheme_label, sql_prov.concept_scheme.label('en').label) obj_1 = [item for item in dump if item['uri'] == 'http://id.trees.org/2'][0] self.assertEqual(obj_1['broader'], []) self.assertEqual(obj_1['id'], 2)