GrottoCenter / Basekarst

Basekarst is a software for managing data related to Karst. Developments made for use with APIs
0 stars 0 forks source link

Un dwc:PreservedSpecimen qui contient des échantillons de un ou plusieurs taxa #3

Open jmvanel opened 3 years ago

jmvanel commented 3 years ago

Comment tirer parti des informations présentes, représentant la pluralité des taxons déterminés dans un flacon? Actuellement nous avons dans v3 , API https//geb.ffspeleo/api/api/v3 qui sert d'API de test.

      "dct:hasPart": [
        {
          "@id": "2198",
          "@type": "Point",
          "rdfs:label": "station_879-2176",
          "locates": [
            {
              "@id": "22895",
              "@type": [
                "dwc:Occurrence",
                "dwc:PreservedSpecimen"
              ],
              "event date": "2020-09-20",
              "dwciri:inDataset": "datagc:Josiane/speleo",
              "dwciri:inCollection": "datagc:Josiane/collection",
              "dwc:organismID": "22987",
              "associated taxa": [
                {
                  "xxxxxx": "Ptomaphagus",
                  "dwci:toTaxon": "http://taxref.mnhn.fr/lod/taxon/205080/13.0",
                  "identified by": "Bernard Lips"
                }
              ]
            },

Je propose

      "dct:hasPart": [
        {
          "@id": "2198",
          "@type": "Point",
          "rdfs:label": "station_879-2176",
          "locates": [
            {
              "@id": "22895",
              "@type": [
                "dwc:PreservedSpecimen"
              ],
              "event date": "2020-09-20",
              "dwciri:inDataset": "datagc:Josiane/speleo",
              "dwciri:inCollection": "datagc:Josiane/collection",
              "dwc:materialSampleID": "22987",
              "dct:hasPart" : [
                {
                 "@type": [ dwc:Occurrence, dwc:Identification ] ,
                  "@id": "333333",
                  "dwc:associatedTaxa": "Ptomaphagus",
                  "dwciri:toTaxon": "http://taxref.mnhn.fr/lod/taxon/205080/13.0",
                  "identified by": "Bernard Lips"
                }
              ]
            },

A NOTER

Discussion Une fois de plus Darwin Core et https://github.com/darwin-sw/dsw ne nous aident guère . Il y a bien la notion de dsw:Token , mais ça ne cadre pas directement avec notre cas , lequel n'a rien d'inusuel !

AlainGresse commented 3 years ago

Je n'étais pas disponible ce matin. Je vais essayer d'intégrer toutes les modifications demandées cet après-midi et faire des tests sur http://geb.ffspeleo.fr/api/api/v3 ensuite.

AlainGresse commented 3 years ago

J'ai modifié http://geb.ffspeleo.fr/api/api/v3. Le résultat est correct en ce qui concerne le format JSON et la pluralité des taxons dans un flacon.

            {   "@id": "2176",
                "@type":"Point",
                "rdfs:label": "station_869-2133",
                "locates":[
                    {   "@id": "22487",
                        "@type":["dwc:PreservedSpecimen"],
                        "event date": "2016-11-20",
                        "dwciri:inDataset": "datagc:Josiane/speleo" ,
                        "dwciri:inCollection": "datagc:Josiane/collection",
                        "dwc:materialSampleID": "22577",
                        "dct:hasPart":[
                            {   "@type":["dwc:Occurence", "dwc:Identification"],
                                "@id":"1548",
                                "dwc:associatedTaxa":"Clausiliidae",
                                "dwciri:toTaxon":"http://taxref.mnhn.fr/lod/taxon/186383/13.0"
                            },
                            {   "@type":["dwc:Occurence", "dwc:Identification"],
                                "@id":"2184","dwc:associatedTaxa":"Hydrobiidae",
                                "dwciri:toTaxon":"http://taxref.mnhn.fr/lod/taxon/186358/13.0"
                            }
                        ]

                    }
                ]
            },
            {   "@id": "2177",
                "@type":"Point",

MAIS Il y a un problème remonté par JSON-LD Playground: jsonld.InvalidUrl: Dereferencing a URL did not result in a valid JSON-LD object. Possible causes are an inaccessible URL perhaps due to a same-origin policy (ensure the server uses CORS if you are using client-side JavaScript), too many redirects, a non-JSON response, or more than one HTTP Link Header was provided for a remote context. Puis-je basculer l'API http://geb.ffspeleo.fr/api/api/v3 en "production" (http://geb.ffspeleo.fr/api/api/v2)?

jmvanel commented 3 years ago

Je constate le problème avec le Playground, mais ça va bien avec Titanium, utilisé dans semantic_forms : http://semantic-forms.cc:1952/json2rdf?src=https%3A%2F%2Fgeb.ffspeleo.fr%2Fapi%2Fapi%2Fv3%2F&context=https%3A%2F%2Fgithub.com%2Fjmvanel%2FKarstlink-ontology%2Fraw%2Fmaster%2Fgeb.ffspeleo.fr_context.jsonld Il y a une petite imperfection : l'URI /occurences/stations/6252 généré par JSON-LD (au début) :

<https://geb.ffspeleo.fr/api/api/v2/occurences/stations/6252>
        a       <http://rs.tdwg.org/dwc/terms/Identification> , <http://rs.tdwg.org/dwc/terms/Occurence> ;
        <http://rs.tdwg.org/dwc/iri/toTaxon>
                <http://taxref.mnhn.fr/lod/taxon/767/13.0> ;
        <http://rs.tdwg.org/dwc/terms/associatedTaxa>
                "Eiseniella tetraedra" ;
        <http://rs.tdwg.org/dwc/terms/identifiedBy>
                "Sarah Guillocheau" .

je voudrais avoir un préfixe d'URI par table SQL , donc ici /identification/6252 ; mais je pense corriger ça dans le @context .

Distiller mentionne aussi un problème: http://rdf.greggkellogg.net/distiller?command=serialize&url=https:%2F%2Fgeb.ffspeleo.fr%2Fapi%2Fapi%2Fv3%2F

no implicit conversion of Sinatra::IndifferentHash into String

Je vais quand même regarder (par dichotomie) ce qui provoque ces messages, mais pour moi on peut avancer et basculer l'API http://geb.ffspeleo.fr/api/api/v3 en "production" (http://geb.ffspeleo.fr/api/api/v2)

Je ne ferme pas encore l'issue ... mais ça va plutôt bien ...

jmvanel commented 3 years ago

Je prends le début du JSON de l'API, et le problème sur Playground se manifeste aussi:

{
  "@context": "https://ontology.uis-speleo.org/geb.ffspeleo.fr_context.jsonld",
  "@graph": [
    {
      "@id": "879",
      "@type": "UndergroundCavity",
      "name": "Balcourt (Trou de)",
      "dct:hasPart": [
        {
          "@id": "2198",
          "@type": "Point",
          "rdfs:label": "station_879-2176",
          "locates": [
            {
              "@id": "22895",
              "@type": [
                "dwc:PreservedSpecimen"
              ],
              "event date": "2020-09-20",
              "dwciri:inDataset": "datagc:Josiane/speleo",
              "dwciri:inCollection": "datagc:Josiane/collection",
              "dwc:materialSampleID": "22987",
              "dct:hasPart": [
                {
                  "@type": [
                    "dwc:Occurence",
                    "dwc:Identification"
                  ],
                  "@id": "9582",
                  "dwc:associatedTaxa": "Ptomaphagus",
                  "dwciri:toTaxon": "http://taxref.mnhn.fr/lod/taxon/205080/13.0",
                  "identified by": "Bernard Lips"
                }
              ]
            }
      ]
    }
      ]
    }
  ]
}

A SUIVRE: enlever encore du contenu jusqu'à avoir le problème "chimiquement pur" . Ensuite ce sera soit un problème du Playground qui ne comprend pas ce qui est pourtant légitime, soit Titanium est plus tolérant (pas forcément un problème ! ) .

jmvanel commented 3 years ago

Le problème sur Playground se manifeste encore avec ceci, et donc était là depuis longtemps, mais personne n'avait testé !

{
  "@context": "https://ontology.uis-speleo.org/geb.ffspeleo.fr_context.jsonld",
  "@graph": [
    {
      "@id": "879",
      "@type": "UndergroundCavity"
    }
  ]
}

A SUIVRE: analyser le pb .

jmvanel commented 3 years ago

Finalement le problème se manifeste avec Titanium sur le petit JSON précédent , et le problème semble être dans le @context :

scala> JsonLd.toRdf( "file:///home/jmv/data/geb.ffspeleo.fr/test.petit-01-06.jsonld" ) . get
com.apicatalog.jsonld.JsonLdError: There was a problem encountered loading a remote context [code=LOADING_REMOTE_CONTEXT_FAILED].
  at com.apicatalog.jsonld.context.ActiveContextBuilder.fetch(ActiveContextBuilder.java:572)
  at com.apicatalog.jsonld.context.ActiveContextBuilder.create(ActiveContextBuilder.java:173)
  at com.apicatalog.jsonld.expansion.ObjectExpansion.initLocalContext(ObjectExpansion.java:202)
  at com.apicatalog.jsonld.expansion.ObjectExpansion.expand(ObjectExpansion.java:101)
  at com.apicatalog.jsonld.expansion.Expansion.compute(Expansion.java:116)
  at com.apicatalog.jsonld.processor.ExpansionProcessor.expand(ExpansionProcessor.java:124)
  at com.apicatalog.jsonld.processor.ToRdfProcessor.toRdf(ToRdfProcessor.java:69)
  at com.apicatalog.jsonld.processor.ToRdfProcessor.toRdf(ToRdfProcessor.java:58)
  at com.apicatalog.jsonld.api.ToRdfApi.get(ToRdfApi.java:175)
  ... 31 elided
Caused by: com.apicatalog.jsonld.JsonLdError: The local context defined within a term definition is invalid [code=INVALID_SCOPED_CONTEXT].
  at com.apicatalog.jsonld.context.TermDefinitionBuilder.create(TermDefinitionBuilder.java:534)
  at com.apicatalog.jsonld.context.ActiveContextBuilder.create(ActiveContextBuilder.java:451)
  at com.apicatalog.jsonld.context.ActiveContextBuilder.fetch(ActiveContextBuilder.java:565)
  ... 39 more
Caused by: com.apicatalog.jsonld.JsonLdError: An invalid base IRI has been detected [code=INVALID_BASE_IRI].

A SUIVRE !!!

jmvanel commented 3 years ago

Nous avons fait , par copiés collés :( , cette redoutable faute d'orthographe: ce n'est pas Occurence, mais Occurrence ! cf http://rs.tdwg.org/dwc/terms/Occurrence Et actuellement nos erreurs , dans le JSON et dans context, ne se compensent pas et le résultat est faux:

<https://geb.ffspeleo.fr/api/api/v2/occurences/stations/6252>
        a       <http://rs.tdwg.org/dwc/terms/Identification> , <http://rs.tdwg.org/dwc/terms/Occurence> ;

Mais ça n'a rien à voir avec le problème révélé par Playground ! A SUIVRE!

AlainGresse commented 3 years ago

Je crois comprendre que Playground considère qu'il y a deux "@contexte" sur la même ligne.et que cela n'est pas acceptable contenu de la ligne 1 de http://geb.ffspeleo.fr/api/api/v2 "@context": "https://ontology.uis-speleo.org/geb.ffspeleo.fr_context.jsonld", contenu de la ligne 1 de https://github.com/jmvanel/Karstlink-ontology/blob/master/geb.ffspeleo.fr_context.jsonld#L12 "@context": { "karstlink": "https://ontology.uis-speleo.org/ontology/#", Si je remplace "https://ontology.uis-speleo.org/geb.ffspeleo.fr_context.jsonld", par "karstlink": "https://ontology.uis-speleo.org/ontology/#",... Playground ne sort plus d'anomalie

AlainGresse commented 3 years ago

Occurence a été remplacé par Occurrence pour http://geb.ffspeleo.fr/api/api/v2

image

AlainGresse commented 3 years ago

Fait : Occurence a été remplacé par Occurrence dans http://geb.ffspeleo.fr/api/api/v2

Le 06/01/2021 à 12:08, Jean-Marc Vanel a écrit :

Nous avons fait , par copiés collés :( , cette redoutable faute d'orthographe: ce n'est pas Occurence, mais Occurrence ! cf http://rs.tdwg.org/dwc/terms/Occurrence Et actuellement nos erreurs , dans le JSON et dans context, ne se compensent pas et le résultat est faux:

|https://geb.ffspeleo.fr/api/api/v2/occurences/stations/6252 a http://rs.tdwg.org/dwc/terms/Identification , http://rs.tdwg.org/dwc/terms/Occurence ; |

Mais ça n'a rien à voir avec le problème révélé par Playground ! A SUIVRE!

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/GrottoCenter/Basekarst/issues/3#issuecomment-755237688, or unsubscribe https://github.com/notifications/unsubscribe-auth/AR5X5HDI3HMY5E5XVMYCZKLSYRAETANCNFSM4VUZXCHQ.


L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast. https://www.avast.com/antivirus

jmvanel commented 3 years ago

Je crois comprendre que Playground considère qu'il y a deux "@Contexte" sur la même ligne.et que cela n'est pas acceptable contenu de la ligne 1 de http://geb.ffspeleo.fr/api/api/v2 "@context": "https://ontology.uis-speleo.org/geb.ffspeleo.fr_context.jsonld", contenu de la ligne 1 de https://github.com/jmvanel/Karstlink-ontology/blob/master/geb.ffspeleo.fr_context.jsonld#L12 "@context": { "karstlink": "https://ontology.uis-speleo.org/ontology/#", Si je remplace "https://ontology.uis-speleo.org/geb.ffspeleo.fr_context.jsonld", par "karstlink": "https://ontology.uis-speleo.org/ontology/#",... Playground ne sort plus d'anomalie

En fait , la ligne 1 de http://geb.ffspeleo.fr/api/api/v2 sert à renvoyer au @context externe, et la ligne 3 de https://github.com/jmvanel/Karstlink-ontology/blob/master/geb.ffspeleo.fr_context.jsonld dit que c'est un ̀@context` . C'est ainsi que nous faisons depuis quelques jours; voir la doc. officielle: https://w3c.github.io/json-ld-syntax/#example-5-referencing-a-json-ld-context

Le problème est dans un sous contexte contenant un @base ( en modifiant Titanium, j'ai accès à + de détails d'exécution ). Ce qui me surprend dans ce cas, c'est qu'un sous contexte qui n'est pas utilisé soit quand même analysé et aboutit à une erreur bloquante. JSON-LD se révèle plus complexe que je pensais ...

PATIENCE, je vais trouver !

jmvanel commented 3 years ago

J'ai avancé assez pour poser des questions pertinentes à l'auteur Filip du logiciel Titanium. A ce stade rien me prouve que nous faisions mal; ce qui est sûr , c'est que fixer la @base par l'API Java règle le problème.

Par contre, je vois dans le résultat actuel http://semantic-forms.cc:1952/json2rdf?src=https%3A%2F%2Fgeb.ffspeleo.fr%2Fapi%2Fapi%2Fv2%2F&context=https%3A%2F%2Fontology.uis-speleo.org%2Fgeb.ffspeleo.fr_context.jsonld des URLs qui n'ont pas de sens: <occurences/stations/6252> :

<occurences/12112>  a  <http://rs.tdwg.org/dwc/terms/PreservedSpecimen> ;
        dct:hasPart  <occurences/stations/6252> ;
        <http://rs.tdwg.org/dwc/iri/inCollection>
                "datagc:Josiane/collection" ;
        <http://rs.tdwg.org/dwc/iri/inDataset>
                "datagc:Josiane/speleo" ;
        <http://rs.tdwg.org/dwc/terms/eventDate>
                "2016-06-05" ;
        <http://rs.tdwg.org/dwc/terms/materialSampleID>
                "12141" .

Le problème est qu'on a 2 fois la propriété dct:hasPart dans 2 significations très différentes; ce qui n'est pas interdit en soi, mais pose problème avec JSON-LD. Je suis obligé de revenir sur ma demande initiale. On va utiliser https://www.dublincore.org/specifications/dublin-core/dcmi-terms/#http://purl.org/dc/terms/spatial pour l'usage , justement , spatial, et garder dct:hasPart pour indiquer un spécimen identifié dans le lot matériel.

      "@id":"879","@type": "UndergroundCavity","name": "Balcourt (Trou de)",
      "dct:spatial": [
        {
          "@id": "2198",
          "@type": "Point",
          "rdfs:label": "station_879-2176",
          "locates": [
            {
              "@id": "22895",
              "@type": [
                "dwc:PreservedSpecimen"
              ],
              "event date": "2020-09-20",
              "dwciri:inDataset": "datagc:Josiane/speleo",
              "dwciri:inCollection": "datagc:Josiane/collection",
              "dwc:materialSampleID": "22987",
              "dct:hasPart" : [
                {
                 "@type": [ dwc:Occurrence, dwc:Identification ] ,
                  "@id": "333333",
                  "dwc:associatedTaxa": "Ptomaphagus",
                  "dwciri:toTaxon": "http://taxref.mnhn.fr/lod/taxon/205080/13.0",
                  "identified by": "Bernard Lips"
                }
              ]
            },
AlainGresse commented 3 years ago

Fait : dans :http://geb.ffspeleo.fr/api/api/v2 "dct:hasPart" a été remplacé par "dct:spatial" dans le bloc "UndergroundCavity

AlainGresse commented 3 years ago

J'ai modifié http://geb.ffspeleo.fr/api/api/v2 |"dct:hasPart"| a été remplacé par |  "dct:spatial" dans le bloc ||"UndergroundCavity"|

||

||

Le 14/01/2021 à 10:38, Jean-Marc Vanel a écrit :

J'ai avancé assez pour poser des questions pertinentes à l'auteur Filip du logiciel Titanium. A ce stade rien me prouve que nous faisions mal; ce qui est sûr , c'est que fixer la @base https://github.com/base par l'API Java règle le problème.

Par contre, je vois dans le résultat actuel http://semantic-forms.cc:1952/json2rdf?src=https%3A%2F%2Fgeb.ffspeleo.fr%2Fapi%2Fapi%2Fv2%2F&context=https%3A%2F%2Fontology.uis-speleo.org%2Fgeb.ffspeleo.fr_context.jsonld des URLs qui n'ont pas de sens: |<occurences/stations/6252>| :

<occurences/12112> a http://rs.tdwg.org/dwc/terms/PreservedSpecimen ;

     dct:hasPart  <occurences/stations/6252> ;

     <http://rs.tdwg.org/dwc/iri/inCollection>

             "datagc:Josiane/collection"  ;

     <http://rs.tdwg.org/dwc/iri/inDataset>

             "datagc:Josiane/speleo"  ;

     <http://rs.tdwg.org/dwc/terms/eventDate>

             "2016-06-05"  ;

     <http://rs.tdwg.org/dwc/terms/materialSampleID>

             "12141"  .

Le problème est qu'on a 2 fois la propriété dct:hasPart dans 2 significations très différentes; ce qui n'est pas interdit en soi, mais pose problème avec JSON-LD. Je suis obligé de revenir sur ma demande initiale. On va utiliser https://www.dublincore.org/specifications/dublin-core/dcmi-terms/#http://purl.org/dc/terms/spatial pour l'usage , justement , spatial, et garder dct:hasPart pour indiquer un spécimen identifié dans le lot matériel.

|"@id":"879","@type": "UndergroundCavity","name": "Balcourt (Trou de)", "dct:spatial": [ { "@id": "2198", "@type": "Point", "rdfs:label": "station_879-2176", "locates": [ { "@id": "22895", "@type": [ "dwc:PreservedSpecimen" ], "event date": "2020-09-20", "dwciri:inDataset": "datagc:Josiane/speleo", "dwciri:inCollection": "datagc:Josiane/collection", "dwc:materialSampleID": "22987", "dct:hasPart" : [ { "@type": [ dwc:Occurrence, dwc:Identification ] , "@id": "333333", "dwc:associatedTaxa": "Ptomaphagus", "dwciri:toTaxon": "http://taxref.mnhn.fr/lod/taxon/205080/13.0", "identified by": "Bernard Lips" } ] }, |

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/GrottoCenter/Basekarst/issues/3#issuecomment-760078742, or unsubscribe https://github.com/notifications/unsubscribe-auth/AR5X5HHRAGIUC4BZVBL5PODSZ23S3ANCNFSM4VUZXCHQ.


L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast. https://www.avast.com/antivirus