dasch-swiss / dsp-api

DaSCH Service Platform API
http://admin.dasch.swiss
Apache License 2.0
74 stars 18 forks source link

Admin API #553

Open subotic opened 7 years ago

subotic commented 7 years ago

The following list will provide an easier overview of what is implemented and what is still missing. Also, it provides the information if the feature is already available in develop or implemented in a PR (which would require using a specific branch).

User

Projects

Groups

Keywords

Permissions

Lists

subotic commented 7 years ago
do-not-edit-start-codetree-epic-issues

Issues in this epic:

Title Milestone Assignees Stage State
Reposition list item #1388 2020-02 LukasStoeckli, subotic stage/backlog Open
do-not-edit-end-codetree-epic-issues

Depends on: #486

subotic commented 7 years ago

Depends on: #572

kilchenmann commented 6 years ago

I get wrong ontology iris in the ProjectResponse. For example: I make a project info request for incunabula http://0.0.0.0:3333/admin/projects/http%3A%2F%2Frdfh.ch%2Fprojects%2F0803 and I get an array of ontologies: ["http://www.knora.org/ontology/0803/incunabula"]

But when I want to use this IRI to get the ontology information (e.g. /allentities) http://0.0.0.0:3333/v2/ontologies/allentities/http%3A%2F%2Fwww.knora.org%2Fontology%2F0803%2Fincunabula

I get the following response:

{
    "error": "org.knora.webapi.BadRequestException: Invalid ontology IRI: http://www.knora.org/ontology/0803/incunabula"
}

The ontology IRI in this project should be http://0.0.0.0:3333/ontology/0803/incunabula/v2

So, how should we fix this?

benjamingeer commented 6 years ago

The admin API uses internal IRIs (the ones used in the triplestore) rather than API v2's external IRIs. Not sure of the best way to deal with this.

kilchenmann commented 6 years ago

I'm sure @subotic has a solution.

Otherwise I have to make two requests (and the ontology IRIs in project object are useless):

  1. /v2/ontologies/metadata to get the ontology IRIs
  2. /v2/ontologies/allentities
subotic commented 6 years ago

I see two possibilities:

What happens when we have V3, V4, etc. ontology IRIs? What should the admin API return then?

It would be a small function in the GUI to transform an internal ontology IRI to an external V2 ontology IRI: replace www.knora.org with host:port and append /v2.

benjamingeer commented 6 years ago

replace www.knora.org with host:port and append /v2.

That only works for project-specific ontologies. For a built-in Knora ontology, the external hostname is always api.knora.org. Also, the external name of the knora-base ontology is knora-api.

Seems error-prone to have this knowledge in more than one place. I don’t see the harm in doing two requests as @kilchenmann said, especially since the GUI caches ontologies.

subotic commented 6 years ago

Does it maybe make sense to return in the admin API both, the internal and external ontology IRIs?

Or when requesting the project info, tell the API that you would like to have internal or external v2 /v3 /vx ontology IRIs.

Anyhow, this will take a moment to implement. So the fastest way, for now, would be to make a second request, as @benjamingeer suggested.

benjamingeer commented 6 years ago

Does it maybe make sense to return in the admin API both, the internal and external ontology IRIs?

Or when requesting the project info, tell the API that you would like to have internal or external v2 /v3 /vx ontology IRIs.

Either would be easy to do. To get an IRI in any schema you like, you just have to do something like iri.toSmartIri.toOntologySchema(ApiV2WithValueObjects).