You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 14 Next »

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 whose namespace does not match the current ontology.
# The definition should be in an imported ontology.
SELECT ?s ?p ?o
BIND ("" as ?ontStr)
BIND (uri(?ontology) as ?ontURI)
?ontology 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)))

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. 

# Returns every resource of one or more specified types in the loan namespace along with their selected annotations. 
SELECT ?Resource ?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: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 loans namespace
# "") )
#FILTER(!(STRSTARTS(STR(?Resource), # use this to avoid URIs prefixed with fibo-
# "") ))
# FILTER(STRSTARTS(STR(?Resource), # use this to get URIs prefixed with lnu:
# "") )
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

Usage instructions:

  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
  4. 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
"") ))
FILTER(!(STRSTARTS(STR(?Resource), # ignore things in skos namespace
"") ))
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: 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: 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.

  • No labels