diff --git a/public/loaders/json-protege.ini b/public/loaders/json-protege.ini index 8f67e4f..50cab07 100644 --- a/public/loaders/json-protege.ini +++ b/public/loaders/json-protege.ini @@ -9,23 +9,84 @@ plugin = lodex [JSONParse] separator = * - [bufferize] path = bufferID -[filter] -path = @type.0 -if = http://www.w3.org/2002/07/owl#Class +[env] +path = bufferID +value = get('bufferID') + +; BEGIN (expand onProperty) { +[expand] +path = http://www.w3.org/2002/07/owl#onProperty +;file = ./json-protege-resolver.ini ; inline statements, it's more verbose but it's self-sufficient +[expand/exploding] +[expand/combine] +path = value.@id +primer = env('bufferID') +prepend = buffers + +[expand/combine/replace] +path = id +value = get('@id') +path = value +value = self().omit('bufferID') + +[expand/replace] +path = id +value = get('id') +path = value +value = get('value.@id.value').mapValues((o) => Array.isArray(o) && o.length === 1 ? o.pop() : o) + +[expand/aggregate] + +[exchange] +value = self().omit('bufferID') +; } END. + +; BEGIN (expand someValuesFrom) { +[expand] +path = http://www.w3.org/2002/07/owl#someValuesFrom +;file = ./json-protege-resolver.ini ; inline statements, it's more verbose but it's self-sufficient +[expand/exploding] +[expand/combine] +path = value.@id +primer = env('bufferID') +prepend = buffers + +[expand/combine/replace] +path = id +value = get('@id') +path = value +value = self().omit('bufferID') + +[expand/replace] +path = id +value = get('id') +path = value +value = get('value.@id.value').mapValues((o) => Array.isArray(o) && o.length === 1 ? o.pop() : o) + +[expand/aggregate] + +[exchange] +value = self().omit('bufferID') +; } END. + +; BEGIN (re-bufferize all nodes, with there enrichments) { +[bufferize] +path = bufferID [env] path = bufferID value = get('bufferID') +; } END. +; BEGIN (expand subClassOf) { [expand] path = http://www.w3.org/2000/01/rdf-schema#subClassOf +;file = ./json-protege-resolver.ini ; inline statements, it's more verbose but it's self-sufficient [expand/exploding] - [expand/combine] path = value.@id primer = env('bufferID') @@ -37,35 +98,81 @@ value = get('@id') path = value value = self().omit('bufferID') -; [expand/combine/OBJFlatten] -; safe = false -[expand/combine/exchange] -value = self() -[expand/combine/assign] +[expand/replace] +path = id +value = get('id') path = value -value = get('value').mapValues((o) => Array.isArray(o) && o.length === 1 ? o[0] : o) - +value = get('value.@id.value').mapValues((o) => Array.isArray(o) && o.length === 1 ? o.pop() : o) [expand/aggregate] [exchange] -value = self().mapValues((o) => Array.isArray(o) && o.length === 1 ? o[0] : o) +value = self().omit('bufferID') +; } END. + +; BEGIN (Use prefix) { +[OBJFlatten] +safe = false + +[OBJNamespaces] +prefix = dc: +namespace = http://purl.org/dc/terms/ + +prefix = dc: +namespace = http://purl.org/dc/elements/1.1/ + +prefix = place: +namespace = http://purl.org/ontology/places# + +prefix = rdfs: +namespace = http://www.w3.org/2000/01/rdf-schema# + +prefix = obo: +namespace = http://purl.obolibrary.org/obo/ + +prefix = swo: +namespace = http://www.ebi.ac.uk/swo/ + +prefix = swo: +namespace = http://www.ebi.ac.uk/efo/swo/ + +prefix = owl +namespace = http://www.w3.org/2002/07/owl# + +prefix = inist: +namespace = http://www.inist.fr/Ontology# + +prefix = skos: +namespace = http://www.w3.org/2004/02/skos/core# + +prefix = ontoTM: +namespace = http://data.loterre.fr/ontoTM# + +reference = (@id|@type)$ [OBJFlatten] +reverse = true +safe = false + +; } END. + +; BEGIN (Simplify arrays, fields hierachy) { +[assign] +path = rdfs:subClassOf +value = get('rdfs:subClassOf').reduce((obj, item) => ((obj[item['@id']] = item), obj), {}) [exchange] -value = self().omit('bufferID') \ - .mapKeys((value, key) => key \ - .replace(/(http:[^#]+#)|\/@id\/value|@|(http:\/\/[^\/]+\/)/g, '') \ - .replace(/(id\/id)/g,'id')) \ - .mapValues((value, key) => (key.search(/(id|type)$/) === -1 || !value || typeof value !== 'string' \ - ? value \ - : value \ - .replace(/(http:[^#]+#)|\/@id\/value|@|(http:\/\/[^\/]+\/)/g, '') \ - .replace(/(id\/id)/g,'id'))) +value = self().omit('bufferID').mapValues((o) => Array.isArray(o) && o.length === 1 ? o.pop() : o) + +[OBJFlatten] +; } END. +[remove] +reverse = true +test = get('rdfs:subClassOf/obo:IAO_0000594/@id').includes('obo:IAO_0000594') [objects2columns] +