drkane / datasette-reconcile

Adds a reconciliation API endpoint to Datasette, based on the Reconciliation Service API specification.
MIT License
22 stars 6 forks source link

'Add standard service' stuck to guess-types-of-column #14

Closed JBPressac closed 3 years ago

JBPressac commented 3 years ago

Hello, Following #13 (thank you for solving the issue), I have a new problem: when I try to add the service in OpenRefine (Reconcile > Start reconciling > Add Standard Service and add the /-/reconcile URL), OpenRefine displays a spinner and nothing occurs. The OpenRefine console is stuck to the instruction: POST /command/core/guess-types-of-column.

I may send you the URL of the reconciliation service in a mail, if you wish (I would like to keep this URL private).

Thank you,

JBPressac commented 3 years ago

For information, the /-/reconcile URL returns:

{
  "versions": [
    "0.1",
    "0.2"
  ],
  "name": "PRELIB Personnes reconciliation",
  "identifierSpace": "http://rdf.freebase.com/ns/type.object.id",
  "schemaSpace": "http://rdf.freebase.com/ns/type.object.id",
  "defaultTypes": "personne",
  "view": "/prelib/prelib_personne/{{id}}"
}

however, the reconciliation Service API mentions that the defaultTypes field should contain a list of types:

A type represents a category of entities. It comprises the following fields: id an identifier, which is a non-empty string. This identifier must be unique among all types; name a human-readable name, which is a non-empty string.

In consequence, the manifest should rather be:

{
  "versions": [
    "0.1",
    "0.2"
  ],
  "name": "PRELIB Personnes reconciliation",
  "identifierSpace": "http://rdf.freebase.com/ns/type.object.id",
  "schemaSpace": "http://rdf.freebase.com/ns/type.object.id",
  "defaultTypes": [
    {
      "id": "/personne",
      "name": "personne"
    }
  ],
  "view": "/prelib/prelib_personne/{{id}}"
}
drkane commented 3 years ago

Thanks, I think you're right.

Tricky to know the best way to configure this. I think I might just check that type_default is in the correct format in the configuration, so you would need to add a list with the correct types in the config.

It's a bit confusing about what openrefine does and doesn't accept for the type value in the response too.

JBPressac commented 3 years ago

There is a way to validate the manifest: Using JSON Schema. The JSON Schema for reconciliation service manifests is listed in the reconciliation Service API (chapter A.1 Manifest Schema). This JSON schema could be used with an online validator as JSON Schema Validator and Generator. If you try to validate the preceding manifest, you could notice that there is also an error with the view field, which should use a url sub-field.

{
  "versions": [
    "0.1",
    "0.2"
  ],
  "name": "PRELIB Personnes reconciliation",
  "identifierSpace": "http://rdf.freebase.com/ns/type.object.id",
  "schemaSpace": "http://rdf.freebase.com/ns/type.object.id",
  "defaultTypes": [
    {
      "id": "/personne",
      "name": "personne"
    }
  ],
  "view": {"url" : "/prelib/prelib_personne/{{id}}"}
}