Skip to content

Commit

Permalink
Added is_format_of property to format property missing test
Browse files Browse the repository at this point in the history
  • Loading branch information
LucieLamothe committed Oct 13, 2022
1 parent ec6cdd5 commit 9be1a8d
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 7 deletions.
15 changes: 13 additions & 2 deletions caseologue/caseologue.py
Original file line number Diff line number Diff line change
Expand Up @@ -976,16 +976,27 @@ def test_object_relation_obsolete(self):
def test_format_property_missing(self):

"""
Checks the no mandatory property for format are missing (documentation).
Checks the no mandatory property for format are missing (documentation,is_format_of). To make sure not to miss the inhereted "is_format_of" property from parent concept, a CONSTRUCT query is used to add the missing triplets to the graph.
> SPARQL query available `here <https://github.com/edamontology/edam-validation/blob/main/caseologue/queries/format_property_missing.rq>`_
"""
construct = "queries/is_format_of_construct.rq"
with open(construct, "r") as f:
construct_term = f.read()

results_update = self.edam_graph.query(construct_term)
for r in results_update:
update_edam=self.edam_graph.add((r[0],r[1],r[2]))

f.close()
query = "queries/format_property_missing.rq"
with open(query, "r") as f:
query_term = f.read()
if len(results_update)!=0:
results = update_edam.query(query_term)
else:
results = self.edam_graph.query(query_term)

results = self.edam_graph.query(query_term)
nb_err = len(results)
f.close()

Expand Down
18 changes: 13 additions & 5 deletions caseologue/queries/format_property_missing.rq
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,17 @@ SELECT ?entity ?label ?property WHERE

?entity rdfs:subClassOf+ edam:format_1915 .
?entity rdfs:label ?label .

VALUES ?property { edam:documentation
}
FILTER NOT EXISTS {?entity ?property ?value .}

{
VALUES ?property { edam:documentation }
FILTER NOT EXISTS {?entity ?property ?value .}
}
UNION
{
VALUES ?property { edam:is_format_of }
FILTER NOT EXISTS {
?entity rdfs:subClassOf ?restriction .
?restriction rdf:type owl:Restriction ;
owl:onProperty ?property ;
owl:someValuesFrom ?data.}
}
}ORDER BY ?entity
6 changes: 6 additions & 0 deletions caseologue/queries/format_property_missing_test_data.owl
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@

<owl:Class rdf:about="http://edamontology.org/format_1975">
<rdfs:subClassOf rdf:resource="http://edamontology.org/format_2305"/>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://edamontology.org/is_format_of"/>
<owl:someValuesFrom rdf:resource="http://edamontology.org/data_0883"/>
</owl:Restriction>
</rdfs:subClassOf>
<created_in>beta12orEarlier</created_in>
<ontology_used rdf:resource="http://www.sequenceontology.org/"/>
<oboInOwl:hasDbXref rdf:resource="https://github.com/The-Sequence-Ontology/Specifications/blob/master/gff3.md"/>
Expand Down
21 changes: 21 additions & 0 deletions caseologue/queries/is_format_of_construct.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
PREFIX obo: <http://purl.obolibrary.org/obo/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX oboInOwl: <http://www.geneontology.org/formats/oboInOwl#>
PREFIX edam:<http://edamontology.org/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

CONSTRUCT {
?children_format rdfs:subClassOf ?restriction .
?restriction rdf:type owl:Restriction ;
owl:onProperty edam:is_format_of ;
owl:someValuesFrom ?data.
}
WHERE {
?parent_format rdfs:subClassOf ?restriction .
?restriction rdf:type owl:Restriction ;
owl:onProperty edam:is_format_of ;
owl:someValuesFrom ?data.
?children_format rdfs:subClassOf+ ?parent_format .
}

0 comments on commit 9be1a8d

Please sign in to comment.