gbv / jskos-server

Web service to access JSKOS data
https://coli-conc.gbv.de/api/
MIT License
6 stars 4 forks source link

Extend /mappings/infer to infere mappings by hub vocabulary #35

Open nichtich opened 5 years ago

nichtich commented 5 years ago

Given a concept A look up all mappings from this concept (A-B1, A-B2 ...). Then look up all mappings from Bn to concept in a selected target scheme. Example:

The schemes of middle concepts are used as "mapping hubs".

Two issues:

Combination of mapping types:

= ~ > <
= = ~ > <
~ ~* ~*
~ ~ ~ ~
> > →*
< <

Marked by *: to be discussed

This combination rules (how to infer mappings from other mappings) should be part of jskos-tools.

Query parameters:

This gives best results for simple and exact 1-to-1 mappings but should also help in other cases.

stefandesu commented 5 years ago

Maybe as a separate service.

nichtich commented 2 years ago

A first version could be limited to indirect 1-to-1 mappings from a specific concept (from and fromScheme) to another vocabulary (toScheme) via a specific vocabulary (via). The three vocabularies fromScheme, via and toScheme must be distinct. The algorithm would be:

  1. Internally call /mappings/infer with via as toScheme to get the primary result set.
  2. For each target concept cᵢ in the primary result set, internally call /mappings/infer with the cᵢ as from and original toScheme, so there is a secondary result set for each cᵢ.
  3. Iterate the primary result set and use target concept of each mapping together with its secondary result set to infer indirect mappings

This could be provided at /mappings/infer (#177) as well, triggered by the parameter via.

An example: Given three vocabularies A, B, C two mappings and a hierarchical relation:

Query from Atomic Physics in A toScheme C via B:

  1. Infer Atomic Physics in A < Physical sciences in B using the hierarchy of A.
  2. Combine two mappings Atomic Physics in A < Physical sciences in B < Sciences in C ...
  3. ...to infer Atomic Physics in A < Sciences in C.

Worst case performance is when no mapping type is used to restrict inference.