Closed mjordan closed 3 years ago
Nevermind, co
is defined in core islandora
Maybe we should do a review to see if all the namespaces for all the default mappings are registered?
Maybe we should finally just make this namespace thing configurable....
Note: this is untested code... just something that popped into mind and written up real quick.
rdf_map.schema.yml
rdf_map:
type: config_object
mapping:
rdf_mappings:
type: sequence
label: 'RDF Mappings'
sequence:
type: mapping
mapping:
prefix:
type: string
label: 'RDF Prefix'
namespace:
type: string
label: 'Fully Qualified RDF Namespace'
rdf_map.yml
rdf_mappings:
-
prefix: 'ldp'
namespace: 'http://www.w3.org/ns/ldp#',
-
prefix: 'dc11'
namespace: 'http://purl.org/dc/elements/1.1/',
-
prefix: 'dcterms'
namespace: 'http://purl.org/dc/terms/',
-
prefix: 'nfo'
namespace: 'http://www.semanticdesktop.org/ontologies/2007/03/22/nfo/v1.1/',
-
prefix: 'ebucore'
namespace: 'http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#',
-
prefix: 'fedora'
namespace: 'http://fedora.info/definitions/v4/repository#',
-
prefix: 'owl'
namespace: 'http://www.w3.org/2002/07/owl#',
-
prefix: 'ore'
namespace: 'http://www.openarchives.org/ore/terms/',
-
prefix: 'rdf'
namespace: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
-
prefix: 'rdau'
namespace: 'http://rdaregistry.info/Elements/u/'
-
prefix: 'islandora'
namespace: 'http://islandora.ca/',
-
prefix: 'pcdm'
namespace: 'http://pcdm.org/models#',
-
prefix: 'use'
namespace: 'http://pcdm.org/use#',
-
prefix: 'iana'
namespace: 'http://www.iana.org/assignments/relation/',
-
prefix: 'premis'
namespace: 'http://www.loc.gov/premis/rdf/v1#',
-
prefix: 'premis3'
namespace: 'http://www.loc.gov/premis/rdf/v3/',
-
prefix: 'co'
namespace: 'http://purl.org/co/',
islandora.module
/**
* Implements hook_rdf_namespaces().
*/
function islandora_rdf_namespaces() {
$rdf_map_config = \Drupal::config('rdf_map');
$rdf_mappings = $rdf_map_config->get('rdf_mappings');
if (!is_array($rdf_mappings)) {
throw new \Exception("RDF Map config is not an array.");
}
$maps = [];
foreach ($rdf_mappings as $rdf_map) {
$maps[$rdf_map['prefix'] = $rdf_map['namespace'];
}
return $maps;
}
This is, of course, less efficient that simply returning a hard-coded list, but much easier for sites to update; especially with Features. Also, I recently learned that we can add weight to our module so it's module file is processed after others, making it more likely that our config will override other mappings set.
I like the idea of auto-discovery. Having to manage the mappings and their corresponding namespaces separately is going to be a PITA in the long run.
I think
rdau
is used as the namespace for http://www.rdaregistry.info/, but I can't find P60329 in any of the ontologies registered there.
Specifically, rdau
is the suggested prefix for the unconstrained properties RDA element set (namespace URI: http://www.rdaregistry.info/Elements/u/ )
I find http://www.rdaregistry.info to be kind of an unstable site in general. Maybe it was being weird when you were looking at it? Currently the link above (http://www.rdaregistry.info/Elements/u/#P60329) does resolve to the "has edition statement" property.
It is also registered at http://metadataregistry.org/schemaprop/show/id/14925.html
I can take this for the sprint. Simply adding the namespace is simple enough, but would folks like me to go ahead and move the namespaces to config as I suggested above? If so, should it go in the islandora module or in the JSON-LD module?
Thoughts, @Islandora/8-x-committers ?
I am not a committer, but +1 on making the namespaces configurable (preferably via the UI in such a way that metadata managers will be able to add namespaces as needed).
Resolved via https://github.com/Islandora/islandora/commit/56444554ef69e050e985f23ec5af688e753a8535 and https://github.com/Islandora/jsonld/commit/b7acb80a8793a35f3d688acbf12c9334a9fc59b8
You can now configure namespace prefixes through the UI in jsonld's config page. Be sure to run the update hook after fetching the newest code.
We should make note to that effect in https://github.com/Islandora/documentation/pull/1789 as well.
config/install/rdf.mapping.node.islandora_object.yml
defines the following mapping:but the
rdau
namespace is not registered (or at least isn't known to therdf_get_namespaces()
function). Should we add that namespace toislandora_rdf_namespaces()
?I think
rdau
is used as the namespace for http://www.rdaregistry.info/, but I can't find P60329 in any of the ontologies registered there. Metadata IG folks, any suggestions?