Open subotic opened 7 years ago
Title | Milestone | Assignees | Stage | State |
---|---|---|---|---|
Reposition list item #1388 | 2020-02 | LukasStoeckli, subotic | stage/backlog | Open |
Depends on: #486
Depends on: #572
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?
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.
I'm sure @subotic has a solution.
Otherwise I have to make two requests (and the ontology IRIs in project object are useless):
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
.
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.
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.
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)
.
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
OntologyV1
andOntologyV2
objects for each project, keeping the admin API version independent.Groups
Keywords
Permissions
Lists