# OpenAPI Documentation - JSON format (dot notation)
mimeType = application/json

post.operationId = post-v1-2XK-identify
post.description = Associer une structure de recherche vocabulaire Loterre correspondant - https://www.loterre.fr/skosmos/2XK/fr/
post.summary = verbalisation à partir d'un tableau d'objets avec à minima un champ value contenant des termes
post.tags.0 = loterre-resolvers
post.requestBody.content.application/json.example.0.id = 1
post.requestBody.content.application/json.example.0.value = GDR3753
post.requestBody.content.application/json.example.1.id = 2
post.requestBody.content.application/json.example.1.value = Inist
post.requestBody.content.application/json.example.2.id = 3
post.requestBody.content.application/json.example.2.value = Centre Marc Bloch
post.requestBody.content.application/json.schema.$ref = #/components/schemas/JSONStream
post.requestBody.required = true
post.responses.default.content.application/json.example.0.id = 1
post.responses.default.content.application/json.example.0.value = {...}
post.responses.default.content.application/json.example.1.id = 2
post.responses.default.content.application/json.example.1.value = {...}
post.responses.default.content.application/json.example.2.id = 3
post.responses.default.content.application/json.example.2.value = {...}
post.responses.default.content.application/json.schema.$ref =  #/components/schemas/JSONStream
post.responses.default.description = Les prefixes DOI en verion textuel
post.parameters.0.description = Indenter le JSON résultant
post.parameters.0.in = query
post.parameters.0.name = indent
post.parameters.0.schema.type = boolean

[delegate]
file = ./v1/2XK.cfg

[delegate]
file = ./v1/process.cfg

[swing]
test = get('value').isObject()

# Sélection de champs
[swing/replace]

# id field is required in order to work with lodex
path = id
value = get('id')

path = value.id
value = get('value.id')

path = value.about
value = get('value.rdf$about')

path = value.prefLabel@fr
value = get('value.skos$prefLabel').castArray().concat({xml$t:_.get(self, 'value.skos$prefLabel', 'n/a'), xml$lang:_.get(self, 'value.skos$prefLabel.xml$lang', 'n/a')}).filter(Boolean).filter(y => (y.xml$lang === 'fr')).map(x => x.xml$t).shift()

path = value.prefLabel@en
value = get('value.skos$prefLabel').filter(y => (y.xml$lang === 'en')).map(x => x.xml$t).shift()

path = value.codeRNSR
value = get('value.wdt$P3016', []).castArray().map(item => (item.xml$t ? item.xml$t : item))

path = value.latitude
value = get('value.geo$lat')

path = value.longitude
value = get('value.geo$long')

path = value.codeUniteCNRS
value =  get('value.wdt$P4550', []).castArray().map(item => (item.xml$t ? item.xml$t : item))

path = value.libelleOrigine
value = get('value.wdt$P1705')

path = value.sigle
value = get('value.wdt$P1813')

path = value.type
value = get('value.wdt$P31')

path = value.GRID
value = get('value.wdt$P2427')

path = value.ISNI
value = get('value.wdt$P213')

path = value.VIAF
value =  get('value.wdt$P214')

path = value.HAL
value = get('value.wdt$P6773')

path = value.IdRef
value = get('value.wdt$P269')

path = value.SIREN
value = get('value.wdt$P1616')

path = value.SIRET
value = get('value.wdt$P3215')

path = value.dateCreation
value = get('value.wdt$P580')

path = value.dateFermeture
value =  get('value.wdt$P582')

path = value.libelleOrigine
value = get('value.wdt$P1705')

path = value.tutellePrincipale
value = get('value.inist$tutellePrincipale', []).castArray().map(item => (item.xml$t ? item.xml$t : item))

path = value.tutelleSecondaire
value = get('value.inist$tutelleSecondaire', []).castArray().map(item => (item.xml$t ? item.xml$t : item))

path = value.institutPrincipal
value = get('value.inist$institutPrincipal', []).castArray().map(item => (item.xml$t ? item.xml$t : item))

path = value.institutSecondaire
value = get('value.inist$institutSecondaire', []).castArray().map(item => (item.xml$t ? item.xml$t : item))

path = value.delegationRegionale_dep
value = get('value.inist$dr_cnrs_dep', []).castArray().map(item => (item.xml$t ? item.xml$t : item))

path = value.delegationRegionale_impl
value = get('value.inist$dr_cnrs_impl')

path = value.sectionComiteNational
value = get('value.inist$sectionCN', []).castArray().map(item => (item.xml$t ? item.xml$t : item))

path = value.portefeuilleDAS
value = get('value.inist$portefeuilleDAS', []).castArray().map(item => (item.xml$t ? item.xml$t : item))

path = value.site
value = get('value.inist$site', []).castArray().map(item => (item.xml$t ? item.xml$t : item))

path = value.childStructure
value = get('value.inist$structureComposite', []).castArray().map(item => (item.xml$t ? item.xml$t : item))

path = value.replacedBy
value = get('value.cdt$isReplacedBy', []).castArray().map(item => (item.xml$t ? item.xml$t : item))

path = value.replaces
value = get('value.cdt$replaces', []).castArray().map(item => (item.xml$t ? item.xml$t : item))

path = value.address
value = get('value.org$siteAddress', []).castArray().map(item => (item.xml$t ? item.xml$t : item))

path = value.homepage
value = get('value.foaf$homepage', []).castArray().map(item => (item.xml$t ? item.xml$t : item))

[delegate]
file = ./v1/send.cfg
