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

prov schema validation #4378 #4810

Merged
merged 12 commits into from
Jul 27, 2018
Merged

prov schema validation #4378 #4810

merged 12 commits into from
Jul 27, 2018

Conversation

matthew-a-dunlap
Copy link
Contributor

@matthew-a-dunlap matthew-a-dunlap commented Jul 3, 2018

Related Issues

Pull Request Checklist

  • Unit [tests][] completed
  • Integration [tests][]: None
  • Deployment requirements, [SQL updates][], [Solr updates][], etc.: None
  • [Documentation][docs] completed
  • Merged latest from "develop" [branch][] and resolved conflicts

Also code cleanup
Likely IT tests are now broken as some test prov we used may actually be broken...
@matthew-a-dunlap
Copy link
Contributor Author

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.

@coveralls
Copy link

coveralls commented Jul 3, 2018

Coverage Status

Coverage decreased (-0.08%) to 15.472% when pulling 3ae5d59 on 4378-prov-schema-validation into 834317b on develop.

Copy link
Member

@pdurbin pdurbin left a comment

Choose a reason for hiding this comment

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

Comments inline.

@@ -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.
Copy link
Member

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?

Copy link
Contributor Author

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/

Copy link
Contributor Author

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" +
Copy link
Contributor

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() {
Copy link
Contributor

Choose a reason for hiding this comment

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

again here

@matthew-a-dunlap
Copy link
Contributor Author

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.

@dlmurphy
Copy link
Contributor

dlmurphy commented Jul 9, 2018

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.

Copy link
Member

@pdurbin pdurbin left a comment

Choose a reason for hiding this comment

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

Looks fine.

@@ -7,28 +7,104 @@

import com.google.gson.JsonParser;
import com.google.gson.JsonObject;
import edu.harvard.iq.dataverse.api.AbstractApiBeanTest;
Copy link
Contributor

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

@kcondon kcondon merged commit 8f063fa into develop Jul 27, 2018
@kcondon kcondon deleted the 4378-prov-schema-validation branch July 27, 2018 19:47
@pdurbin pdurbin added this to the 4.9.2 - Stata Upgrades, etc. milestone Aug 5, 2018
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

Successfully merging this pull request may close these issues.

6 participants