Package org.obolibrary.robot
Class ReportOperation
- java.lang.Object
-
- org.obolibrary.robot.ReportOperation
-
public class ReportOperation extends Object
Report issues with an ontology using a series of QC SPARQL queries.- Author:
- Rebecca Jackson, James A. Overton
-
-
Constructor Summary
Constructors Constructor Description ReportOperation()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Map<String,String>
getDefaultOptions()
Return a map from option name to default option value, for all the available report options.static Report
getReport(org.semanticweb.owlapi.model.OWLOntology ontology, IOHelper ioHelper, Map<String,String> options)
Given an ontology, an IOHelper, and a map of options, create a Report object and run the report queries specified in a profile (from options, or default).static Report
getTDBReport(String inputPath, Map<String,String> options)
Given an input path to an ontology and a map of options, create a Report object and run (on TDB dataset) the report queries specified in a profile (from options, or default).static Report
getTDBReport(org.apache.jena.query.Dataset dataset, Map<String,String> options)
Given a dataset and a map of options, create a Report object and run (on TDB dataset) the report queries specified in a profile (from options, or default).static Report
getTDBReport(IOHelper ioHelper, org.apache.jena.query.Dataset dataset, Map<String,String> options)
Given a dataset and a map of options, create a Report object and run (on TDB dataset) the report queries specified in a profile (from options, or default).static boolean
processReport(Report report, String outputPath, Map<String,String> options)
Given a Report, an output path, and a map of report options, process the Report results and save the report to the output path.static boolean
report(org.semanticweb.owlapi.model.OWLOntology ontology, String profilePath, String outputPath, String format, String failOn)
Given an ontology, a profile path (or null), an output path (or null), and a report format (or null) report on the ontology using the rules within the profile and write results to the output path.static void
report(org.semanticweb.owlapi.model.OWLOntology ontology, IOHelper ioHelper)
Report on the ontology using the rules within the profile and print results.static boolean
report(org.semanticweb.owlapi.model.OWLOntology ontology, IOHelper ioHelper, String profilePath, String outputPath, String format, String failOn)
Given an ontology, an IOHelper, a profile path (or null), an output path (or null), a report format (or null), and a level to fail on, report on the ontology using the rules within the profile and write results to the output path.static boolean
report(org.semanticweb.owlapi.model.OWLOntology ontology, IOHelper ioHelper, String profilePath, String outputPath, String format, String failOn, boolean useLabels)
Given an ontology, an IOHelper, a profile path (or null), an output path (or null), a report format (or null), a level to fail on, and a boolean indicating to use labels, report on the ontology using the rules within the profile and write results to the output path.static boolean
report(org.semanticweb.owlapi.model.OWLOntology ontology, IOHelper ioHelper, String outputPath, Map<String,String> options)
Given an ontology, an IOHelper, an output path (or null), and a map of options (or null), report on the ontology using the rules within the profile specified by the options and write results to the output path.static void
report(org.semanticweb.owlapi.model.OWLOntology ontology, IOHelper ioHelper, Map<String,String> options)
Report on the ontology using the rules within the profile and print results.static boolean
tdbReport(String inputPath, String outputPath, Map<String,String> options)
Given an input path, an output path (or null), and a map of options, report on the ontology using the rules within the profile specified by the options and write results to the output path.
-
-
-
Method Detail
-
getDefaultOptions
public static Map<String,String> getDefaultOptions()
Return a map from option name to default option value, for all the available report options.- Returns:
- a map with default values for all available options
-
report
public static void report(org.semanticweb.owlapi.model.OWLOntology ontology, IOHelper ioHelper) throws Exception
Report on the ontology using the rules within the profile and print results. Prefer report(OWLOntology ontology, String profilePath, String outputPath, String format, String failOn).- Parameters:
ontology
- the OWLOntology to reportioHelper
- IOHelper to work with ontology- Throws:
Exception
- on any reporting error
-
report
public static boolean report(org.semanticweb.owlapi.model.OWLOntology ontology, String profilePath, String outputPath, String format, String failOn) throws Exception
Given an ontology, a profile path (or null), an output path (or null), and a report format (or null) report on the ontology using the rules within the profile and write results to the output path. If profile is null, use the default profile in resources. If the output path is null, write results to console. If the format is null, write results in TSV format.- Parameters:
ontology
- OWLOntology to report onprofilePath
- user profile file path to use, or nulloutputPath
- string path to write report file to, or nullformat
- string format for the output report (TSV or YAML), or nullfailOn
- logging level to fail execution- Returns:
- true if successful, false if failed
- Throws:
Exception
- on any error
-
report
public static boolean report(org.semanticweb.owlapi.model.OWLOntology ontology, IOHelper ioHelper, String profilePath, String outputPath, String format, String failOn) throws Exception
Given an ontology, an IOHelper, a profile path (or null), an output path (or null), a report format (or null), and a level to fail on, report on the ontology using the rules within the profile and write results to the output path. If profile is null, use the default profile in resources. If the output path is null, write results to console. If the format is null, write results in TSV format. Exit with status 1 if any violations of fail-on level are found.- Parameters:
ontology
- OWLOntology to report onioHelper
- IOHelper to useprofilePath
- user profile file path to use, or nulloutputPath
- string path to write report file to, or nullformat
- string format for the output report (TSV or YAML), or nullfailOn
- logging level to fail execution- Returns:
- true if successful, false if failed
- Throws:
Exception
- on any error
-
report
public static void report(org.semanticweb.owlapi.model.OWLOntology ontology, IOHelper ioHelper, Map<String,String> options) throws Exception
Report on the ontology using the rules within the profile and print results. Prefer report(OWLOntology ontology, IOHelper ioHelper, String outputPath, Map<String,String> options).- Parameters:
ontology
- the OWLOntology to reportioHelper
- IOHelper to work with ontologyoptions
- map of report options- Throws:
Exception
- on any reporting error
-
report
public static boolean report(org.semanticweb.owlapi.model.OWLOntology ontology, IOHelper ioHelper, String profilePath, String outputPath, String format, String failOn, boolean useLabels) throws Exception
Given an ontology, an IOHelper, a profile path (or null), an output path (or null), a report format (or null), a level to fail on, and a boolean indicating to use labels, report on the ontology using the rules within the profile and write results to the output path. If profile is null, use the default profile in resources. If the output path is null, write results to console. If the format is null, write results in TSV format. Exit with status 1 if any violations of fail-on level are found.- Parameters:
ontology
- OWLOntology to report onioHelper
- IOHelper to useprofilePath
- user profile file path to use, or nulloutputPath
- string path to write report file to, or nullformat
- string format for the output report (TSV or YAML), or nullfailOn
- logging level to fail executionuseLabels
- if true, use labels for output- Returns:
- true if successful, false if failed
- Throws:
Exception
- on any error
-
report
public static boolean report(org.semanticweb.owlapi.model.OWLOntology ontology, IOHelper ioHelper, String outputPath, Map<String,String> options) throws Exception
Given an ontology, an IOHelper, an output path (or null), and a map of options (or null), report on the ontology using the rules within the profile specified by the options and write results to the output path. If profile is null, use the default profile in resources. If the output path is null, write results to console. If the format is null, write results in TSV format.- Parameters:
ontology
- the OWLOntology to reportioHelper
- IOHelper to work with ontologyoutputPath
- string path to write report file to, or nulloptions
- map of report options- Returns:
- false if there are violations at or above the fail-on level, true otherwise
- Throws:
Exception
- on any reporting error
-
getReport
public static Report getReport(org.semanticweb.owlapi.model.OWLOntology ontology, IOHelper ioHelper, Map<String,String> options) throws Exception
Given an ontology, an IOHelper, and a map of options, create a Report object and run the report queries specified in a profile (from options, or default). Return the completed Report object.- Parameters:
ontology
- OWLOntology to report onioHelper
- IOHelper to resolve labelsoptions
- Map of report options- Returns:
- Report object with violation details
- Throws:
Exception
- on any reporting error
-
tdbReport
public static boolean tdbReport(String inputPath, String outputPath, Map<String,String> options) throws Exception
Given an input path, an output path (or null), and a map of options, report on the ontology using the rules within the profile specified by the options and write results to the output path. Ontology is loaded to dataset backed on disk. The labels option is not supported with TDB.- Parameters:
inputPath
- String path of ontology to loadoutputPath
- String path to write report file to, or nulloptions
- map of report options- Returns:
- false if there are violations at or above the fail-on level, true otherwise
- Throws:
Exception
- on any reporting error
-
getTDBReport
public static Report getTDBReport(String inputPath, Map<String,String> options) throws Exception
Given an input path to an ontology and a map of options, create a Report object and run (on TDB dataset) the report queries specified in a profile (from options, or default). Return the completed Report object. The labels option is not supported with TDB.- Parameters:
inputPath
- path to load triples to TDBoptions
- map of report options- Returns:
- Report object with violation details
- Throws:
Exception
- on any loading, query, or reporting error
-
getTDBReport
public static Report getTDBReport(org.apache.jena.query.Dataset dataset, Map<String,String> options) throws Exception
Given a dataset and a map of options, create a Report object and run (on TDB dataset) the report queries specified in a profile (from options, or default). Return the completed Report object. The labels option is not supported with TDB.- Parameters:
dataset
- TDB Dataset to perform Report operation onoptions
- Map of report options- Returns:
- Report object with violation details
- Throws:
Exception
- on any reporting error
-
getTDBReport
public static Report getTDBReport(IOHelper ioHelper, org.apache.jena.query.Dataset dataset, Map<String,String> options) throws Exception
Given a dataset and a map of options, create a Report object and run (on TDB dataset) the report queries specified in a profile (from options, or default). Return the completed Report object. The labels option is not supported with TDB.- Parameters:
ioHelper
- IOHelper to resolve IRIsdataset
- TDB Dataset to perform Report operation onoptions
- Map of report options- Returns:
- Report object with violation details
- Throws:
Exception
- on any reporting error
-
processReport
public static boolean processReport(Report report, String outputPath, Map<String,String> options) throws IOException
Given a Report, an output path, and a map of report options, process the Report results and save the report to the output path.- Parameters:
report
- completed Report objectoutputPath
- path to save report tooptions
- Map of report options- Returns:
- true if report passed, false if it failed
- Throws:
IOException
- on issue writing to file
-
-