Preparing For Submission
Ensure that there are no definitions in the wrong ontology
This uses a 'magic property' called 'definesStatements' that is only available in TopBraid Composer. 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(?ontStr) as ?ont)
?ont 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
Run the following SPARQL query and export it as a spreadsheet. With a bit of manual reformatting, it is in a convenient form for reviewing definitions and other annotations. It also is helpful to spot missing definitions. For example, the following file is such a spreadsheet reflecting the loan ontology as of 2016-01-4:
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(STRSTARTS(STR(?Resource), # use this to get URIs in the loan HMDA namespace
# "https://spec.edmcouncil.org/fibo/LOAN/LoanContracts/LoanHMDA/") )
# FILTER(STRSTARTS(STR(?Resource), # use this to get URIs in the loans namespace
# "https://spec.edmcouncil.org/fibo/LOAN/LoanContracts/LoanCore/") )
FILTER(STRSTARTS(STR(?Resource), # use this to get URIs prefixed with fibo-ln-ln-lgn:
"https://spec.edmcouncil.org/fibo/LOAN/LoanContracts/LoanGeneric/") )
# 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
Usage instructions:
- AllFibo: uncomment out the last two filter statements
NEXT: remove the import statement so only stuff in loans ontology is left - UsedFromFibo: Run same query as for AllFibo (the definitions will be missing)
- AddToFibo: use only the filter for LoanUpperTemp
- Loans: use only the first two filters
Then take a prior version of a loansannotations spreadsheet, remove the existing contents and bring in the new content from the new .txt files exported by TBC.
Find uses of rdfs:comment, it should not be used at all. Probably have it be an ASK query.
SELECT ?Resource ?Type ?Comment
WHERE { ?Resource rdf:type ?Type .
?Resource rdfs:comment ?Comment.
FILTER(?Type in (owl:Class, owl:DatatypeProperty,owl:ObjectProperty ))
FILTER(!(STRSTARTS(STR(?Resource), # ignore things in owl namespace
"http://www.w3.org/2002/07/owl#") ))
FILTER(!(STRSTARTS(STR(?Resource), # ignore things in skos namespace
"http://www.w3.org/2004/02/skos/core#") ))
}
ORDER BY ?Type ?Resource
Concepts that are not specific to loans.
I did a thorough look through the loans ontology and considered which things are not loan-specific, and thus eventually should be somewhere else in FIBO.
The convention I am using is to prefix the URI of all non- loan-specific concepts with: “fibo-“. I grouped some of them by topic (using skoc:editorialNote), to give an idea where they should go. In some cases, I was pretty sure where they would go, so I gave a more specific prefix like: “fibo-alx” which means the concept belongs in the ontology: http://spec.edmcouncil.org/fibo/FND/Utilities/Analytics/ or fibo-fnd-utl-alx, which is the standard prefix for this.
For example:
- loan:fibo-InsuranceContract Topic: Insurance
- loan:fibo-MetroDivision Topic: Regions
- loan:fibo-ScheduledPayment Topic: Payments
- loan:fibo-ContactInfo Topic: BE
- loan:fibo-alx-Measurement Ontology: http://spec.edmcouncil.org/fibo/FND/Utilities/Analytics/ or fibo-fnd-utl-alx
This spreadsheet below was generated from SPARQL, and has all the annotations for all the classes and properties in the ontology, but for convenience, I have a filter on the leftmost column so only the ones prefixed with “fibo-“ show up. All of this will be updated in due course.