Skip to content
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

Query version history #1214

Merged
merged 33 commits into from
Feb 25, 2019
Merged

Query version history #1214

merged 33 commits into from
Feb 25, 2019

Conversation

benjamingeer
Copy link

@benjamingeer benjamingeer commented Feb 13, 2019

  • getResourcePropertiesAndValuesGraphDB.scala.txt: Given a resource IRI and a timestamp, retrieve the resource as it was at that time.
  • ResourcesRouteV2: in the route /v2/resources/IRI, accept the query parameter version (an xsd:dateTimeStamp, or a Knora ARK URL timestamp).
  • getResourcePropertiesAndValuesGraphDB.scala.txt: optionally specify a property IRI, and get the resource's values for just that property at the specified time. Needed only internally, for Concurrent updates in API v2 #1079.
  • ValuesResponderV2.verifyValue(): Use version history to verify value updates (Concurrent updates in API v2 #1079).
  • ReadResourceV2.toJsonLD(): When returning a resource, include a knora-api:versionArkUrl containing a timestamp, referring to the version that's being returned.
  • StringFormatter: Reimplement the formatting and parsing of ARK URL timestamps to make them as short as possible, by removing trailing zeros in fractional seconds (depends on dasch-swiss/ark-resolver@b004034).
  • Record the IRI of the user who marked a resource or value as deleted (Record who marked a resource or value as deleted #1215), so we can include that information when querying the version history of a resource.
  • getResourceVersionHistoryGraphDB.scala.txt: Given a resource IRI, a start date, and an end date, retrieve a list of all the changes that were made in the resource's values between those dates (no need to return the changes themselves, just when they were made and by whom). Include the creation of the resource, even if it was created with no values.
  • ResourcesRouteV2: add the route /v2/resources/history/IRI, to get the version history of the resource's values.
  • When returning resource values, include their knora-api:valueCreationDate.
  • header.xsl: Adapt the XSLT transformation for generating TEI/XML headers from BEOL letters to handle the fact that, in RDF/XML, target resources may or may not be nested in link values.
  • Update docs and release notes.

A lot of the changes in this PR are in test data, to include knora-api:versionArkUrl and knora-api:valueCreationDate.

Resolves #1115.
Resolves #1215.
Fixes #1079.

@benjamingeer benjamingeer self-assigned this Feb 13, 2019
@benjamingeer benjamingeer mentioned this pull request Feb 13, 2019
Benjamin Geer added 2 commits February 19, 2019 10:27
- Include value creation dates when returning values.
@benjamingeer
Copy link
Author

@kilchenmann This PR adds knora-api:versionArkUrl to each resource, and @tobiasschweizer says this means that Knora-ui code and test data will need to be adapted. Tobias says he can help if needed.

@benjamingeer
Copy link
Author

@subotic Tobias and I need a little more time to fix a broken test here, no need to review yet.

@benjamingeer
Copy link
Author

@tobiasschweizer I implemented a function in header.xsl like you suggested, and it works, thanks! I also added a test for it in XMLUtilSpec.

@benjamingeer
Copy link
Author

@subotic I think this is finally ready for review now.

@benjamingeer
Copy link
Author

@subotic Could you possibly find time to review this PR this week?

@benjamingeer
Copy link
Author

No worries, thanks!

@subotic
Copy link
Collaborator

subotic commented Feb 25, 2019

Yes, sorry. Will do it today.

@benjamingeer
Copy link
Author

@subotic The Travis build is failing because it can't find the command typedoc to build the documentation:

Makefile:14: *** The 'typedoc' command was not found. Make sure you have Typedoc installed..  Stop.

@kilchenmann
Copy link
Contributor

We will update the knora-ui modules to use it with this version of knora.
PR #185

Copy link
Collaborator

@subotic subotic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks :-)

)
}
}
}
} ~ path("v2" / "resources" / "history" / Segment) { resourceIriStr: IRI =>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would personally prefer the following:

/v2/resources/[resourceIRI]/history

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would conflict with the existing route:

/v2/resources/[resourceIRI]/[resourceIRI]

responseSchema = ApiV2WithValueObjects
)
}
}
} ~ path("v2" / "resources" / Segments) { resIris: Seq[String] =>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I would prefer:

/v2/resources/[resourceIRI]/version/[timestamp]

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and for multiple IRIs:

/v2/resources/version/[timestamp]?Id=iri1,iri2,iri3

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the more information is in the URL path the better. I don't like URL parameters very much.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know whether changing this would break Knora-ui, BEOL, etc.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely. The comments are only meant as "food for thought". We can make an issue and do it sometime when @kilchenmann has more time.

@subotic
Copy link
Collaborator

subotic commented Feb 25, 2019

we are not the only ones: TypeStrong/typedoc#976

@subotic
Copy link
Collaborator

subotic commented Feb 25, 2019

we could comment out the documentation building test from travis for the time being.

@benjamingeer
Copy link
Author

we are not the only ones

Oh, great 🤦🏻‍♂️

we could comment out the documentation building test from travis for the time being.

OK.

@benjamingeer benjamingeer merged commit 5995f61 into develop Feb 25, 2019
@benjamingeer benjamingeer deleted the wip/1115-query-version-history branch February 25, 2019 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants