-
Notifications
You must be signed in to change notification settings - Fork 500
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
prov schema validation #4378 #4810
Conversation
Also code cleanup Likely IT tests are now broken as some test prov we used may actually be broken...
Note: As of the creation of this PR, the Prov IT tests are failing, but this is due to publish being broken (see #4800). As the parts of the code changed in this branch are before publish I decided to go ahead with the PR. |
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.
Comments inline.
src/main/java/Bundle.properties
Outdated
@@ -1794,6 +1794,7 @@ file.editProvenanceDialog.tip=Provenance is a record of the origin of your data | |||
file.editProvenanceDialog.uploadSuccess=Upload complete | |||
file.editProvenanceDialog.uploadError=An error occurred during upload and parsing of your provenance file. | |||
file.editProvenanceDialog.noEntitiesError=The uploaded provenance file does not contain any entities that can be related to your Data File. | |||
file.editProvenanceDialog.invalidSchemaError=The upload provenance file does not comply with the provenance standard. |
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.
Should we indicate the name of the standard?
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.
Yea! If @dlmurphy wants to take a look at this it may also help. This is the standard: https://www.w3.org/Submission/2013/SUBM-prov-json-20130424/
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.
This error shows up on the prov page when uploaded prov json and the uploaded file does not comply with the schema
//Not the prettiest way of accessing the schema, but loading the .json file as an external resource | ||
//turned out to be very painful, especially when also trying to exercise it via unit tests | ||
public final String provSchema = | ||
"{\n" + |
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.
You should probably look at how RemoteDataFrameService loads a file in #4814
InputStream resourceStream = RemoteDataFrameService.class.getResourceAsStream(path);
String resourceAsString = "";
// Try opening a buffered reader stream
try {
resourceAsString = IOUtils.toString(resourceStream, "UTF-8");
resourceStream.close();
} catch (IOException ex) {
logger.warning(String.format("RDATAFileReader: (readLocalResource) resource stream from path \"%s\" was invalid", path));
}
return resourceAsString;`
|
||
@Before | ||
public void setUp() { | ||
provUtilBean = new ProvUtilFragmentBean(); | ||
jsonParser = new JsonParser(); | ||
} | ||
|
||
@Test | ||
public void testProvValidator() { |
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.
again here
I took another stab at trying to get the paths work for the prov schema. None of the examples in our code touch on the problem I'm facing, which is having the same external file accessible via the running code and via the unit tests running the prov validation code from the outside. The hardcoded string isn't pretty but also does not cause any problems. I need to move on to DCM S3 so I think we should merge this after @dlmurphy has a chance to look at the bit of new messaging. |
Looked over this w/ Matthew. Plan is to change the error message to: "The uploaded provenance file does not comply with the W3C Provenance standard." Also, on the page itself, in the instructions, link "W3C standard" to: https://www.w3.org/Submission/2013/SUBM-prov-json-20130424/ This way, users can refer to the W3C standard if they're interested in learning more about proper formatting. |
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.
Looks fine.
Running these on each build wastes a lot of time for developers and this code is pretty isolated
@@ -7,28 +7,104 @@ | |||
|
|||
import com.google.gson.JsonParser; | |||
import com.google.gson.JsonObject; | |||
import edu.harvard.iq.dataverse.api.AbstractApiBeanTest; |
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.
This file should be renamed to the place it should go
Related Issues
Pull Request Checklist