-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(api-v2): Make values citable #1322
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
d9fe0b2
feature(api-v2): Give each value a UUID so it can be cited.
170b1f0
feat(api-v2): Add a route for querying a value given its UUID.
846ab5b
test(api-v2): Add unit tests.
9773a19
Merge branch 'develop' into wip/941-cite-value
673c1af
test(api-v2): Fix tests.
ddba997
feat(api-v2): Give values ARK URLs (ongoing).
9249c2d
feat(api-v2): Give values ARK URLs.
514b580
Merge branch 'develop' into wip/941-cite-value
04119a9
test(api-v2): Add e2e test for values GET route.
c7379c5
Merge branch 'develop' into wip/941-cite-value
e0eae97
feat(upgrade): Add upgrade script (ongoing).
f4f6ee9
test(api-v2): Fix test data.
f17b3eb
feat(upgrade): Add upgrade script (ongoing).
a60359c
Merge branch 'develop' into wip/941-cite-value
4fc0c2c
docs(api-v2): Document value permalinks.
a6b89ee
docs(api-v2): Distinguish between complex and simple schema in discus…
d899e2c
refactor: Store a UUID only in the current version of each value.
5f76a3a
docs(knora-base): Document valueHasUUID.
578dabf
fix(api-v2): Fix cardinality on valueHasUUID in complex schema.
2da6419
Merge branch 'develop' into wip/941-cite-value
00267e6
Merge branch 'develop' into wip/941-cite-value
391b995
Merge branch 'develop' into wip/941-cite-value
b79a62d
test(api-v2): Test value UUID updates.
87e6f50
test(api-v2): Fix test data.
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
<!--- | ||
Copyright © 2015-2019 the contributors (see Contributors.md). | ||
|
||
This file is part of Knora. | ||
|
||
Knora is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published | ||
by the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
|
||
Knora is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
|
||
You should have received a copy of the GNU Affero General Public | ||
License along with Knora. If not, see <http://www.gnu.org/licenses/>. | ||
--> | ||
|
||
# Permalinks | ||
|
||
@@toc | ||
|
||
Knora provides a permanent, citable URL for each resource and value. | ||
These URLs use [Archival Resource Key (ARK) Identifiers](http://n2t.net/e/ark_ids.html), | ||
and are designed to remain valid even if the resource itself is moved | ||
from one Knora repository to another. | ||
|
||
## Obtaining ARK URLs | ||
|
||
In the @ref:[complex schema](introduction.md#api-schema), a resource or value | ||
is always returned with two ARK URLs: one that will always refer | ||
to the latest version of the resource or value (`knora-api:arkUrl`), and one that refers | ||
specifically to the version being returned (`knora-api:versionArkUrl`). | ||
For example: | ||
|
||
```jsonld | ||
{ | ||
"@id" : "http://rdfh.ch/0803/2a6221216701", | ||
"@type" : "incunabula:book", | ||
"incunabula:book_comment" : { | ||
"@id" : "http://rdfh.ch/0803/2a6221216701/values/56c287fc9505", | ||
"@type" : "knora-api:TextValue", | ||
"knora-api:arkUrl" : { | ||
"@type" : "xsd:anyURI", | ||
"@value" : "http://ark.dasch.swiss/ark:/72163/1/0803/2a6221216701W/dhaRsvZATjmOxhCOOzHqewB" | ||
}, | ||
"knora-api:versionArkUrl" : { | ||
"@type" : "xsd:anyURI", | ||
"@value" : "http://ark.dasch.swiss/ark:/72163/1/0803/2a6221216701W/dhaRsvZATjmOxhCOOzHqewB.20160302T150521Z" | ||
}, | ||
"knora-api:attachedToUser" : { | ||
"@id" : "http://rdfh.ch/users/91e19f1e01" | ||
}, | ||
"knora-api:hasPermissions" : "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser", | ||
"knora-api:userHasPermission" : "V", | ||
"knora-api:valueAsString" : "Katalogaufnahme anhand ISTC und v.d.Haegen", | ||
"knora-api:valueCreationDate" : { | ||
"@type" : "xsd:dateTimeStamp", | ||
"@value" : "2016-03-02T15:05:21Z" | ||
}, | ||
"knora-api:valueHasUUID" : "dhaRsvZATjmOxhCOOzHqew" | ||
}, | ||
"knora-api:arkUrl" : { | ||
"@type" : "xsd:anyURI", | ||
"@value" : "http://ark.dasch.swiss/ark:/72163/1/0803/2a6221216701W" | ||
}, | ||
"knora-api:versionArkUrl" : { | ||
"@type" : "xsd:anyURI", | ||
"@value" : "http://ark.dasch.swiss/ark:/72163/1/0803/2a6221216701W.20160302T150521Z" | ||
}, | ||
"knora-api:attachedToProject" : { | ||
"@id" : "http://rdfh.ch/projects/0803" | ||
}, | ||
"knora-api:attachedToUser" : { | ||
"@id" : "http://rdfh.ch/users/91e19f1e01" | ||
}, | ||
"knora-api:creationDate" : { | ||
"@type" : "xsd:dateTimeStamp", | ||
"@value" : "2016-03-02T15:05:21Z" | ||
}, | ||
"knora-api:hasPermissions" : "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:UnknownUser", | ||
"knora-api:userHasPermission" : "V", | ||
"rdfs:label" : "Reise ins Heilige Land", | ||
"@context" : { | ||
"rdf" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#", | ||
"knora-api" : "http://api.knora.org/ontology/knora-api/v2#", | ||
"rdfs" : "http://www.w3.org/2000/01/rdf-schema#", | ||
"incunabula" : "http://0.0.0.0:3333/ontology/0803/incunabula/v2#", | ||
"xsd" : "http://www.w3.org/2001/XMLSchema#" | ||
} | ||
} | ||
``` | ||
|
||
In the @ref:[simple schema](introduction.md#api-schema), resources are returned | ||
with ARK URLs, but values are returned as literals, so ARK URLs are not provided | ||
for values. | ||
|
||
For more information on getting past versions of resources and values, see: | ||
|
||
- @ref:[Get a Full Representation of a Version of a Resource by IRI](reading-and-searching-resources.md#get-a-full-representation-of-a-version-of-a-resource-by-iri) | ||
- @ref:[Get a Version of a Value in a Resource](reading-and-searching-resources.md#get-a-version-of-a-value-in-a-resource) | ||
- @ref:[Get the Version History of a Resource](reading-and-searching-resources.md#get-the-version-history-of-a-resource) | ||
|
||
## Resolving Knora ARK URLs | ||
|
||
A Knora ARK URL is intended to be resolved by the [Knora ARK resolver](https://github.com/dhlab-basel/ark-resolver). | ||
|
||
## Knora ARK URL Format | ||
|
||
For details, see @ref:[Archival Resource Key (ARK) Identifiers](../../05-internals/design/api-v2/ark.md). | ||
|
||
### ARK URLs for Resources | ||
|
||
The format of a Knora resource ARK URL is as follows: | ||
|
||
``` | ||
http://HOST/ark:/NAAN/VERSION/PROJECT/RESOURCE_UUID[.TIMESTAMP] | ||
``` | ||
|
||
For example, given the Knora resource IRI `http://rdfh.ch/0001/0C-0L1kORryKzJAJxxRyRQ`, | ||
and using the DaSCH's ARK resolver hostname and NAAN, the corresponding | ||
ARK URL without a timestamp is: | ||
|
||
``` | ||
http://ark.dasch.swiss/ark:/72163/1/0001/0C=0L1kORryKzJAJxxRyRQY | ||
``` | ||
|
||
The same ARK URL with an optional timestamp is: | ||
|
||
``` | ||
http://ark.dasch.swiss/ark:/72163/1/0001/0C=0L1kORryKzJAJxxRyRQY.20180604T085622513Z | ||
``` | ||
|
||
Without a timestamp, a Knora resource ARK URL refers to the latest version of the | ||
resource at the time when the URL is resolved. | ||
|
||
### ARK URLs for Values | ||
|
||
The format of a Knora value ARK URL is as follows: | ||
|
||
``` | ||
http://HOST/ark:/NAAN/VERSION/PROJECT/RESOURCE_UUID/VALUE_UUID[.TIMESTAMP] | ||
``` | ||
|
||
For example, given a value with `knora-api:valueHasUUID "4OOf3qJUTnCDXlPNnygSzQ"` in the resource | ||
`http://rdfh.ch/0001/0C-0L1kORryKzJAJxxRyRQ`, and using the DaSCH's ARK resolver | ||
hostname and NAAN, the corresponding ARK URL without a timestamp is: | ||
|
||
``` | ||
http://ark.dasch.swiss/ark:/72163/1/0001/0C=0L1kORryKzJAJxxRyRQY/4OOf3qJUTnCDXlPNnygSzQX | ||
``` | ||
|
||
The same ARK URL with an optional timestamp is: | ||
|
||
``` | ||
http://ark.dasch.swiss/ark:/72163/1/0001/0C=0L1kORryKzJAJxxRyRQY/4OOf3qJUTnCDXlPNnygSzQX.20180604T085622513Z | ||
``` | ||
|
||
Without a timestamp, a Knora value ARK URL refers to the latest version of the | ||
value at the time when the URL is resolved. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain how Knora gets a previous version of the value if the client submits a UUID with a timestamp?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or just link to the permalinks section and add one sentence there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no special logic for this. It gets the previous version of the value the same way that it would get it if you requested a resource with a timestamp without specifying a value UUID.
Specifying a UUID just adds a FILTER in the SPARQL query:
https://github.com/dhlab-basel/Knora/blob/2da6419cc62bf4e6aa92bf352c308732b3549565/webapi/src/main/twirl/queries/sparql/v2/getResourcePropertiesAndValuesGraphDB.scala.txt#L168
I haven't documented how that query gets previous versions of values using timestamps, would you like me to open a separate issue for that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it could be useful in the design docs, what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#1342
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks