Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show only mainConceptScheme in hierarchy #1540

Open
wants to merge 1 commit into
base: skosmos-2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions controller/RestController.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@
'uri' => '@id',
'type' => '@type',
'conceptschemes' => 'onki:hasConceptScheme',
'mainConceptScheme' => array(
'@id' => 'onki:mainConceptScheme',
'@type' => '@id'
),

Check warning on line 231 in controller/RestController.php

View check run for this annotation

Codecov / codecov/patch

controller/RestController.php#L228-L231

Added lines #L228 - L231 were not covered by tests
'id' => 'onki:vocabularyIdentifier',
'defaultLanguage' => 'onki:defaultLanguage',
'languages' => 'onki:language',
Expand All @@ -241,6 +245,7 @@
'defaultLanguage' => $vocab->getConfig()->getDefaultLanguage(),
'languages' => array_values($vocab->getConfig()->getLanguages()),
'conceptschemes' => $conceptschemes,
'mainConceptScheme' => $vocab->getConfig()->getMainConceptSchemeURI()

Check warning on line 248 in controller/RestController.php

View check run for this annotation

Codecov / codecov/patch

controller/RestController.php#L248

Added line #L248 was not covered by tests
);

if ($vocab->getConfig()->getTypes($request->getLang())) {
Expand Down
9 changes: 5 additions & 4 deletions resource/js/hierarchy.js
Original file line number Diff line number Diff line change
Expand Up @@ -442,11 +442,12 @@ function getTreeConfiguration() {
req_kind: $.ajaxQ.requestKind.SIDEBAR_PRIVILEGED,
success: function (response) {
schemeObjects = schemeRoot(response.conceptschemes);
// if there are multiple concept schemes display those at the top level
if (schemeObjects.length > 1 && node.id === '#' && $('#vocab-info').length) {
// if there are multiple concept schemes and none of them is the main concept scheme,
// display them all at the top level
if (schemeObjects.length > 1 && node.id === '#' && $('#vocab-info').length && response.mainConceptScheme === null) {
return cb(schemeObjects);
}
// if there was only one concept scheme display it's top concepts at the top level
}
// if there was only one concept scheme (possibly main) display its top concepts at the top level
else if(node.id === '#' && $('#vocab-info').length) {
$.ajax({
data: $.param({'lang': clang}),
Expand Down
3 changes: 3 additions & 0 deletions swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1551,6 +1551,9 @@
"$ref": "#/definitions/ConceptScheme"
}
},
"mainConceptScheme": {
"type": "string"
},
"type": {
"description": "Optional vocabulary classification e.g. 'http://publications.europa.eu/resource/authority/dataset-type/ONTOLOGY'",
"type": "array",
Expand Down
Loading