Skip to content

Commit

Permalink
Merge 96d45d1 into 4e0a977
Browse files Browse the repository at this point in the history
  • Loading branch information
koenedaele committed Jun 24, 2020
2 parents 4e0a977 + 96d45d1 commit b5fbc3d
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 12 deletions.
12 changes: 7 additions & 5 deletions docs/source/conf.py
Expand Up @@ -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)
}
33 changes: 27 additions & 6 deletions docs/source/customisation.rst
Expand Up @@ -677,16 +677,35 @@ 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
hierarchies.
- 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.

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_import_scripts.py
Expand Up @@ -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)
Expand Down

0 comments on commit b5fbc3d

Please sign in to comment.