Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


This uses a 'magic property' called 'definesStatements' that is only available in TopBraid Composer. This It can be made to work without this magic property, if just the one ontology is loaded and the imports are removed.  This should probably migrate to the hygiene tests suite. It's here for now for my own use.

# Find all URIs for Classes, Object, Datatype and Annotation Properties that are defined
# in a given ontology (?ont) whose namespace does not match the current ontology.
# The definition should already be in an imported ontology and removed from the given ontology.
SELECT ?s ?p ?o
# BIND ("" as ?ontStr)
BIND ("" as ?ontStr)
# BIND ("" as ?ontStr)

BIND (uri(?ontologyontStr) as ?ontURIont)
?ontologyont tops:definesStatements (?s ?p ?o) .
FILTER (?p in (rdf:type))
FILTER (?o in (owl:Class, owl:ObjectProperty, owl:DatatypeProperty, owl:AnnotationProperty))
FILTER (!(strstarts(str(?s), ?ontStr)))

Find Ontologies

that need to be Imported

# Find all URIs that are referred to in a given ontology whose namespace does not match the ontology. 
# This will help indicate what ontologies need to be imported.
SELECT distinct ?x
# BIND ("" as ?ontStr)
# BIND ("" as ?ontStr)
BIND ("" as ?ontStr)
BIND (uri(?ontStr) as ?ont)
{?ont tops:definesStatements (?x ?p ?o) .}
UNION {?ont tops:definesStatements (?s ?x ?o) .}
UNION {?ont tops:definesStatements (?s ?p ?x) .}
FILTER (isURI(?x))
 FILTER (!(strstarts(str(?x), ?ontStr)))
FILTER (!(strstarts(str(?x), "")))
FILTER (!(strstarts(str(?x), "")))
FILTER (!(strstarts(str(?x), "")))
FILTER (!(strstarts(str(?x), "")))
 FILTER (!(strstarts(str(?x), "")))

Preparing to Review Definitions and Other Annotations


TODO: generalize so that the loans URL is not hard coded, making it useful for other FCTs.




# Returns every resource of one or more specified types in the loan namespace along with their selected annotations. 
SELECT ?Resource ?Label ?Type ?Def ?ExpNote ?EdNote ?UseNote ?NormRef ?Comment
WHERE { ?Resource rdf:type ?Type .
FILTER(?Type in (owl:Class, owl:DatatypeProperty,owl:ObjectProperty ))
OPTIONAL { ?Resource skos:definition ?Def. }
OPTIONAL { ?Resource rdfs:label ?Label. }
OPTIONAL { ?Resource rdfs:comment ?Comment. }
OPTIONAL { ?Resource skos:editorialNote ?EdNote. }
OPTIONAL { ?Resource sm:normativeReference ?NormRef. }
OPTIONAL { ?Resource fibo-fnd-utl-av:usageNote ?UseNote. }
OPTIONAL { ?Resource fibo-fnd-utl-av:explanatoryNote ?ExpNote. }
#FILTER# FILTER(STRSTARTS(STR(?Resource), # use this to get URIs in the loan loansHMDA namespace
# "http") )
#FILTER(!# FILTER(STRSTARTS(STR(?Resource), # use this to avoidget URIs in prefixedthe withloans fibo-namespace
# "http") ))
# FILTERFILTER(STRSTARTS(STR(?Resource), # use this to get URIs prefixed with lnufibo-ln-ln-lgn:
"http") )
# FILTER(!(STRSTARTS(STR(?Resource), # use this to get things not in loans namespace
# "")) )
FILTER(!(STRSTARTS(STR(?Resource), # ignore things in owl namespace
"") ))
ORDER BY ?Type ?Resource


  1. AllFibo: uncomment out the last two filter statements
    NEXT: remove the import statement so only stuff in loans ontology is left 
  2. UsedFromFibo: Run same query as for AllFibo (the definitions will be missing)
  3. AddToFibo: use only the 3rd filter filter for LoanUpperTemp
  4. Loans: use only the first two filters