Versions Compared

Key

  • 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
WHERE {
# BIND ("https://spec.edmcouncil.org/fibo/LOAN/LoanContracts/LoanUpperTemp/" as ?ontStr)
BIND ("https://spec.edmcouncil.org/fibo/LOAN/LoanContracts/LoanCore/" as ?ontStr)
# BIND ("https://spec.edmcouncil.org/fibo/LOAN/LoanContracts/LoanHMDA/" 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)))
}
ORDER BY ?o



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
WHERE {
# BIND ("https://spec.edmcouncil.org/fibo/LOAN/LoanContracts/LoanUpperTemp/" as ?ontStr)
# BIND ("https://spec.edmcouncil.org/fibo/LOAN/LoanContracts/LoanCore/" as ?ontStr)
BIND ("https://spec.edmcouncil.org/fibo/LOAN/LoanContracts/LoanHMDA/" 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), "http://www.w3.org/2002/07/owl#")))
FILTER (!(strstarts(str(?x), "http://www.w3.org/1999/02/22-rdf-syntax-ns#")))
FILTER (!(strstarts(str(?x), "http://www.w3.org/2000/01/rdf-schema#")))
FILTER (!(strstarts(str(?x), "http://www.w3.org/2001/XMLSchema#")))
 FILTER (!(strstarts(str(?x), "http://www.w3.org/2004/02/skos/core")))
}
ORDER BY ?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
# "httphttps://spec.edmcouncil.org/fibo/LOAN/LoanContracts/LoanCoreLoanHMDA/") )
#FILTER(!# FILTER(STRSTARTS(STR(?Resource), # use this to avoidget URIs in prefixedthe withloans fibo-namespace
# "httphttps://spec.edmcouncil.org/fibo/LOAN/LoanContracts/LoanCore/fibo-") ))
# FILTERFILTER(STRSTARTS(STR(?Resource), # use this to get URIs prefixed with lnufibo-ln-ln-lgn:
"httphttps://spec.edmcouncil.org/fibo/LOAN/LoanContracts/LoanUpperTempLoanGeneric/") )
# FILTER(!(STRSTARTS(STR(?Resource), # use this to get things not in loans namespace
# "http://spec.edmcouncil.org/fibo/LOAN/LoanContracts/LoanCore/")) )
FILTER(!(STRSTARTS(STR(?Resource), # ignore things in owl namespace
"http://www.w3.org/2002/07/owl#") ))
}
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

...