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

'rdau' RDF namespace is not registered #1520

Closed
mjordan opened this issue May 26, 2020 · 10 comments
Closed

'rdau' RDF namespace is not registered #1520

mjordan opened this issue May 26, 2020 · 10 comments
Assignees

Comments

@mjordan
Copy link
Contributor

mjordan commented May 26, 2020

config/install/rdf.mapping.node.islandora_object.yml defines the following mapping:

  field_edition:
    properties:
      - 'rdau:P60329'

but the rdau namespace is not registered (or at least isn't known to the rdf_get_namespaces() function). Should we add that namespace to islandora_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?

@whikloj
Copy link
Member

whikloj commented May 26, 2020

Nevermind, co is defined in core islandora

@mjordan
Copy link
Contributor Author

mjordan commented May 26, 2020

Maybe we should do a review to see if all the namespaces for all the default mappings are registered?

@seth-shaw-unlv
Copy link
Contributor

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.

@mjordan
Copy link
Contributor Author

mjordan commented May 26, 2020

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.

@seth-shaw-unlv
Copy link
Contributor

seth-shaw-unlv commented May 26, 2020

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.

See http://www.rdaregistry.info/Elements/u/#P60329

@kspurgin
Copy link
Contributor

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

@dannylamb dannylamb added this to the Pre 2.0 Release Code Sprint milestone Apr 19, 2021
@seth-shaw-unlv seth-shaw-unlv self-assigned this Apr 19, 2021
@seth-shaw-unlv
Copy link
Contributor

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 ?

@kspurgin
Copy link
Contributor

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).

@dannylamb
Copy link
Contributor

Resolved via Islandora/islandora@5644455 and Islandora/jsonld@b7acb80

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 #1789 as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants