gbv / cocoda-db

Colibri Concordance Database: Database Backend (DEPRECATED)
https://coli-conc.gbv.de/cocoda/api
GNU Affero General Public License v3.0
1 stars 0 forks source link

Support wrappers #6

Open nichtich opened 8 years ago

nichtich commented 8 years ago

Alternatively to databases (#4) one could plugin in wrappers to external KOS services (e.g. Wikidata, VIAF, sameAs.org, http://id.loc.gov/,...)

nichtich commented 8 years ago

To give an example, DDC can be mapped to Wikidata via https://query.wikidata.org/. Instead of processing Wikidata dumps and loading mappings into a local cocoda-db database, Wikidata can be queried live.

The SPARQL query to get Wikidata mappings to DDC notation 172.42 is

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>

SELECT ?e ?eLabel WHERE {   
   ?e wdt:P1036 "172.42" . 
   SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
   }
 } LIMIT 10

The result can be transformed to JSKOS:

{
  "publisher": "http://www.wikidata.org/",
  "from": {
      "inScheme": ["http://dewey.info/"],    
      "conceptSet": [ {
          "uri": "http://dewey.info/class/172.42",
          "notation": ["172.42"]
      } ]
  },
  "to": {
      "inScheme": ["http://www.wikidata.org/"],
      "conceptSet": [ {
          "uri": "http://www.wikidata.org/entity/Q198",
          "prefLabel": { "en": "war" }
        },{
          "uri": "http://www.wikidata.org/entity/Q454",
          "prefLabel": { "en": "piece" }
      } ]
  }
}

Since http://dewey.info/ is down we need better DDC URIs and Wikidata qualifiers should be used to point to a selected edition of DDC - but this are details.

The response can be shown at http://coli-conc.gbv.de/concordances/ - the current database already contains a mapping from DDC 172.42 to Basisklassifikation (BK).