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

Add cli option to allow running checks against a graphstore journal. #542

Merged
merged 2 commits into from
May 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ public static void main(String[] args) {
validate_options.addOption("s", "shexpath", true, "Specify a shex schema file. Otherwise will download from go_shapes repo.");
validate_options.addOption("ontojournal", "ontojournal", true, "Specify a blazegraph journal file containing the merged, pre-reasoned tbox aka go-lego.owl");
validate_options.addOption("reasoner_report", "reasoner_report", false, "Add a report with reasoning results to the output of the validation. ");
validate_options.addOption("graph", "check-graph-type", false, "Run the checks agains a GO graphstore journal; check only graphs with graphType noctuaCam.");


cmd = parser.parse(validate_options, args, false);
Expand Down Expand Up @@ -403,7 +404,11 @@ public static void main(String[] args) {
if (cmd.hasOption("reasoner_report")) {
run_reasoner_report = true;
}
validateGoCams(input, outputFolder, ontologyIRI, catalog, modelIdPrefix, modelIdcurie, shexpath, shapemappath, travisMode, shouldFail, checkShex, go_lego_journal_file, run_reasoner_report);
boolean checkGraphType = false;
if (cmd.hasOption("check-graph-type")) {
checkGraphType = true;
}
validateGoCams(input, outputFolder, ontologyIRI, catalog, modelIdPrefix, modelIdcurie, shexpath, shapemappath, travisMode, shouldFail, checkShex, go_lego_journal_file, run_reasoner_report, checkGraphType);
}
} catch (ParseException exp) {
System.out.println("Parameter parse exception. Note that the first parameter must be one of: "
Expand Down Expand Up @@ -881,7 +886,7 @@ public static void legoToAnnotationsSPARQL(String modelIdPrefix, String modelIdc
public static void validateGoCams(String input, String outputFolder,
String ontologyIRI, String catalog, String modelIdPrefix, String modelIdcurie,
String shexpath, String shapemappath, boolean travisMode, boolean shouldFail, boolean checkShex,
String go_lego_journal_file, boolean run_reasoner_report) throws OWLOntologyCreationException, IOException {
String go_lego_journal_file, boolean run_reasoner_report, boolean checkGraphType) throws OWLOntologyCreationException, IOException {
LOGGER.setLevel(Level.INFO);
String inputDB = "blazegraph.jnl";
String shexFileUrl = "https://raw.githubusercontent.com/geneontology/go-shapes/master/shapes/go-cam-shapes.shex";
Expand Down Expand Up @@ -1092,6 +1097,17 @@ public static void validateGoCams(String input, String outputFolder,
//this is where everything actually happens
ModelContainer mc = m3.getModel(modelIRI);
OWLOntology gocam = mc.getAboxOntology();
final IRI graphType = IRI.create("http://model.geneontology.org/graphType");
final IRI noctuaCam = IRI.create("http://model.geneontology.org/noctuaCam");
if (checkGraphType) {
if (gocam.getAnnotations().stream().noneMatch(annotation ->
annotation.getProperty().getIRI().equals(graphType)
&& annotation.getValue().isIRI()
&& annotation.getValue().equals(noctuaCam))) {
System.out.println("SKIPPING: " + modelIRI);
continue;
}
}
try {
//if a model does not have an import statement that links in an ontology that defines all of its classes and object properties
//or if the model does not define the classes and object properties itself, parsing problems will prevail
Expand Down
Loading