Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added
- Add `--input-format` global option [#1038]
- Warn on missing `?property` and `?value` in `report` [#1273]

### Fixed
- Inherit OWLDocumentFormat when performing SPARQL update [#1267]
Expand Down
29 changes: 13 additions & 16 deletions docs/report.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,19 @@ If the report fails, the command will exit with a status of `1`, but a report wi

Each query retrieves a triple in the form of `?entity ?property ?value`. The `?entity` is the violating entity, the `?property` is the property that is being violated, and `?value` is what is causing the violation (which could be empty).

For example, the query to retrieve references to deprecated classes:
For example, in this query the `?value` is any deprecated class that is the object of a triple:

```
SELECT DISTINCT ?entity ?property ?value WHERE
{?value owl:deprecated true .
?entity a owl:Class .
?entity ?property ?value }
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT DISTINCT ?entity ?property ?value
WHERE {
?value a owl:Class ;
owl:deprecated "true"^^xsd:boolean .
?entity ?property ?value .
}
```
Here, the `?value` is any deprecated class that is referenced in another entity's axioms.

You can provide your own queries to use in the report (which can be included in the profile, described below). Please make sure to follow this `?entity ?property ?value` pattern when writing these queries.

Expand All @@ -110,18 +115,10 @@ INFO deprecated_class
For all default queries, include the query name shown above. If you do not wish to include a default query in your report, simply omit it from your profile. Any queries not named in the profile will not be run. Furthermore, your own queries can be included by providing the desired logging level followed by the absolute or relative path.
Note that in order for the queries to be included in the report, they _must_ return exactly three variables: `?entity ?property ?value`.

As an example, consider the query we have already mentioned:

```
SELECT DISTINCT ?entity ?property ?value WHERE
{?value owl:deprecated true .
?entity a owl:Class .
?entity ?property ?value }
```

For other examples, you can refer to [the full list of default checks](report_queries/).

This example would create a report with references to deprecated classes as ERROR and the user query violations as INFO:
This example profile would create a report with references to deprecated classes as ERROR and the user query violations as INFO:

```
ERROR deprecated_class
INFO file:///absolute/path/to/other_query.rq
Expand Down
2 changes: 1 addition & 1 deletion docs/report_queries/duplicate_exact_synonym.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ WHERE {
FILTER (UCASE(?value) = ?syn_std)
}
ORDER BY DESC(UCASE(str(?value)))
```
```
3 changes: 1 addition & 2 deletions docs/report_queries/equivalent_class_axiom_no_genus.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

**Solution:** Add a genus to the class expression like: C = B and R some A.

```
```sparql
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

Expand All @@ -17,5 +17,4 @@ SELECT DISTINCT ?entity ?property ?value WHERE {
BIND (if(isIRI(?property1), ?property1, "blank node" ) as ?property)
}
ORDER BY ?entity

```
2 changes: 1 addition & 1 deletion docs/report_queries/illegal_use_of_built_in_vocabulary.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

**Solution:** Remove any statements about build-in vocabulary

```
```sparql
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

Expand Down
4 changes: 2 additions & 2 deletions docs/report_queries/invalid_entity_uri.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Invalid Entity URI

**Problem:** An entity's URI is not formatted correctly. OBO entities are formatted http://purl.obolibrary.org/obo/IDSPACE_0000000. This format is assumed by many OBO tools. Often, accidental typos cause an entity to be malformed, which can cause problems for tools that deal with OBO ontologies.
**Problem:** OBO entities are formatted http://purl.obolibrary.org/obo/IDSPACE_0000000. This format is assumed by many OBO tools. Often, accidentally typos cause entity to be ignored during processing.

**Solution:** Fix the entity OBO URI.

```
```sparql
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

SELECT DISTINCT ?entity ?property ?value WHERE {
Expand Down
2 changes: 1 addition & 1 deletion docs/report_queries/missing_synonymtype_declaration.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ SELECT DISTINCT ?entity ?property ?value WHERE {
FILTER NOT EXISTS { ?entity ?property oboInOwl:SynonymTypeProperty }
}
ORDER BY ?entity
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,9 @@ private static List<Violation> getViolationsFromResults(
IOHelper ioHelper, String queryName, ResultSet violationSet, Integer limit) throws Exception {
List<Violation> violations = new ArrayList<>();

boolean propertyWarning = false;
boolean valueWarning = false;

// Counter for stopping at limit
int c = 0;
while (violationSet.hasNext()) {
Expand Down Expand Up @@ -977,9 +980,24 @@ private static List<Violation> getViolationsFromResults(
violation = new Violation("blank node");
}

// try and get a property and value from the query
// Try and get a property and value from the query.
// If none is found, print a warning, but only once.
String property = getQueryResultOrNull(qs, "property");
if (property == null) {
if (!propertyWarning) {
System.out.println(WARN + ": '" + queryName + "' query is missing ?property variable");
}
propertyWarning = true;
}

String value = getQueryResultOrNull(qs, "value");
if (value == null) {
if (!valueWarning) {
System.out.println(WARN + ": '" + queryName + "' query is missing ?value variable");
}
valueWarning = true;
}

// add details to Violation
if (property != null) {
OWLEntity e = dataFactory.getOWLClass(ioHelper.createIRI(property));
Expand Down