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

ProvRecord validate method to assert required attributes #62

Open
bruth opened this issue Oct 23, 2014 · 7 comments
Open

ProvRecord validate method to assert required attributes #62

bruth opened this issue Oct 23, 2014 · 7 comments

Comments

@bruth
Copy link
Contributor

bruth commented Oct 23, 2014

Most of the PROV concepts have at least one attribute required for it to be considered valid. Is there any desire to integrate a method like this?

@bruth
Copy link
Contributor Author

bruth commented Oct 25, 2014

This could be implemented easily using the JSON Schema document defined in the spec: http://www.w3.org/Submission/2013/SUBM-prov-json-20130424/#validation

@bruth bruth closed this as completed Oct 25, 2014
@krischer
Copy link
Contributor

I guess this would also be easy to implement programmatically and then it can work on the internal graph structure.

Why is this closed?

@bruth
Copy link
Contributor Author

bruth commented Oct 25, 2014

I closed it because it is simple enough to do outside of this library, however if it's built-in that would be great as well. Reopened for discussion.

@bruth bruth reopened this Oct 25, 2014
@trungdong
Copy link
Owner

I think this validation should be optional. It was desired to support both well-formed provenance and scruffy provenance in the W3C Provenance working group (this is an example or these).

A practical example would be:

  1. An application asserted a record at time t in a bundle b1.
  2. At t + x, after running some code, it then asserted some properties of the record in another bundle b2.

The record in b1 and b2 might not be valid, but when merged will be.

I'm inclined to have the prov package more accommodating than restrictive, unless it breaks some fundamental requirements.

Having said that, I think a function that validates a record or a bundle can be useful in some cases.
@bruth, could you defined exactly what you mean by a valid record?

@bruth
Copy link
Contributor Author

bruth commented Oct 25, 2014

Validation definitely needs to be optional to support your example. The idea is to simply have a validate method on ProvRecord, ProvBundle, or ProvDocument which, when called on an instance, will raise an exception if the instance is not valid. I think it would complement the cases where you are iteratively building a document and needing/wanting to validate it at the end before you store it or process it further.

@bruth
Copy link
Contributor Author

bruth commented Oct 25, 2014

could you defined exactly what you mean by a valid record?

I realized I still didn't answer your question. The spec defines which attributes are required and optional. For example, a generation event needs to reference the entity that was generated. However the time is not required. If you have a generation record, it would check whether it defines an entity and if it is available in the same scope (bundle of document).

@bruth
Copy link
Contributor Author

bruth commented Oct 25, 2014

Using the PROV-JSON schema, the structure can be validated, i.e. whether the attributes are satisfied with the correct types, however there needs to be a second step of ensuring the references are valid (the entity foo exists in the document that the generation event is referencing).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants