Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inconsistent ontology parsing when generating specification #140

Closed
DougalW opened this issue Oct 19, 2020 · 11 comments
Closed

inconsistent ontology parsing when generating specification #140

DougalW opened this issue Oct 19, 2020 · 11 comments
Assignees
Labels
bug Something isn't working high priority
Milestone

Comments

@DougalW
Copy link

DougalW commented Oct 19, 2020

Hi

Using OBA version 3.5.1, I noticed inconsistent parsing behaviour when I use a moderately complex ontology. This means I cannot generate a server from the spec. E.g. using a test ontology with different modifications as follows:

  • first run: I called OBA with ontology1.owl, OBA failed on the Person class

  • second run: I added a new class, AccountCategory, to the ontology (ontology2.owl), OBA failed on Person, CustomerCategory classes

  • third run: I added a label to AccountCategory (ontology 3.owl), OBA now fails on ExternalID, ID, InternalID, Person classes but NOT on CustomerCategory

Attached is a zip of ontologies and console outputs (please don't upload the ontology file into the OBA repo of examples).

Archive.zip

@dgarijo dgarijo added the bug Something isn't working label Oct 19, 2020
@dgarijo
Copy link
Contributor

dgarijo commented Oct 19, 2020

Thanks @DougalW,
I will have to have a closer look to see what is going on. I may have to create tests based on your use cases. I will NOT use the ontologies you provided, only inspired ones. I hope that's ok.

As for the third run, I think the word id is reserved by the OpenAPI spec and we cannot use it. But this is a hypothesis, I will check this during this week and let you know.

@DougalW
Copy link
Author

DougalW commented Oct 19, 2020

Sounds fine. I'll check the use of ID now to see if that's what caused the problem.

@DougalW
Copy link
Author

DougalW commented Oct 19, 2020

I changed ID to Identifier and modified the config.yaml and it still caused severe warnings.

@DougalW
Copy link
Author

DougalW commented Oct 19, 2020

Forgot to attach the config file I used:
config_bo.yaml.zip

@DougalW
Copy link
Author

DougalW commented Oct 23, 2020

Hi Daniel did you get time to take a look at this issue?

@dgarijo
Copy link
Contributor

dgarijo commented Oct 23, 2020

@DougalW,
no, sorry. I have other commitments this week. We plan to have a look at some issues next week (we have been reviewing and opening new issues), I hope I can push this one forward with them.

@dgarijo dgarijo added this to the OBA 3.6.0 milestone Oct 24, 2020
@dgarijo
Copy link
Contributor

dgarijo commented Oct 24, 2020

I have been having a look. The newest release of OBA seems to have introduced some errors, I see that some of the specs produced are no valid because some schemas are missing. I will fix this next week.

@DougalW
Copy link
Author

DougalW commented Oct 25, 2020

Hi, I found the source of the generated errors. It looks like the ontology has some complex class expressions where there are several union and intersection restrictions, which OBA fails to process (it generates SEVERE warnings).

E.g.

  1. Account
[2020-10-25 22:42:45] [SEVERE ] Could not parse class https://businessontology.com/ontology/Account 
[2020-10-25 22:42:45] [SEVERE ] Could not parse class https://businessontology.com/ontology/Account 

and the OWL for Account is:

  <!-- https://businessontology.com/ontology/Account -->

    <owl:Class rdf:about="https://businessontology.com/ontology/Account">
        <owl:equivalentClass>
            <owl:Class>
                <owl:intersectionOf rdf:parseType="Collection">
                    <rdf:Description rdf:about="https://businessontology.com/ontology/Agreement"/>
                    <owl:Restriction>
                        <owl:onProperty rdf:resource="https://businessontology.com/ontology/hasMagnitude"/>
                        <owl:someValuesFrom rdf:resource="https://businessontology.com/ontology/Balance"/>
                    </owl:Restriction>
                </owl:intersectionOf>
            </owl:Class>
        </owl:equivalentClass>
        <rdfs:subClassOf rdf:resource="https://businessontology.com/ontology/Agreement"/>
        <rdfs:subClassOf>
            <owl:Restriction>
                <owl:onProperty rdf:resource="https://businessontology.com/ontology/categorizedBy"/>
                <owl:someValuesFrom>
                    <owl:Class>
                        <owl:unionOf rdf:parseType="Collection">
                            <rdf:Description rdf:about="https://businessontology.com/ontology/AccountCategory"/>
                            <rdf:Description rdf:about="https://businessontology.com/ontology/AccountStatus"/>
                            <rdf:Description rdf:about="https://businessontology.com/ontology/AccountType"/>
                            <rdf:Description rdf:about="https://businessontology.com/ontology/Industry"/>
                        </owl:unionOf>
                    </owl:Class>
                </owl:someValuesFrom>
            </owl:Restriction>
        </rdfs:subClassOf>
        <rdfs:subClassOf>
            <owl:Restriction>
                <owl:onProperty rdf:resource="https://businessontology.com/ontology/description"/>
                <owl:someValuesFrom rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
            </owl:Restriction>
        </rdfs:subClassOf>
        <rdfs:subClassOf>
            <owl:Restriction>
                <owl:onProperty rdf:resource="https://businessontology.com/ontology/name"/>
                <owl:someValuesFrom rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
            </owl:Restriction>
        </rdfs:subClassOf>
        <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">An agreement having a balance, as in a bank account, or credit card account, or Accounts Receivable account.</rdfs:comment>
        <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Account</rdfs:label>
    </owl:Class>
  1. CustomerCategory:
[2020-10-25 22:42:45] [SEVERE ] Could not parse class https://businessontology.com/ontology/CustomerCategory 
[2020-10-25 22:42:45] [SEVERE ] Could not parse class https://businessontology.com/ontology/CustomerCategory 

which is a subclass of Category:

    <!-- https://businessontology.com/ontology/Category -->

    <owl:Class rdf:about="https://businessontology.com/ontology/Category">
        <rdfs:subClassOf>
            <owl:Restriction>
                <owl:onProperty rdf:resource="https://businessontology.com/ontology/allocatedBy"/>
                <owl:someValuesFrom>
                    <owl:Class>
                        <owl:unionOf rdf:parseType="Collection">
                            <rdf:Description rdf:about="https://businessontology.com/ontology/IntellectualProperty"/>
                            <rdf:Description rdf:about="https://businessontology.com/ontology/Organization"/>
                            <rdf:Description rdf:about="https://businessontology.com/ontology/Person"/>
                            <rdf:Description rdf:about="https://businessontology.com/ontology/System"/>
                        </owl:unionOf>
                    </owl:Class>
                </owl:someValuesFrom>
            </owl:Restriction>
        </rdfs:subClassOf>
        <rdfs:subClassOf>
            <owl:Restriction>
                <owl:onProperty rdf:resource="https://businessontology.com/ontology/createdOn"/>
                <owl:qualifiedCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">1</owl:qualifiedCardinality>
                <owl:onDataRange rdf:resource="http://www.w3.org/2001/XMLSchema#dateTime"/>
            </owl:Restriction>
        </rdfs:subClassOf>
        <rdfs:subClassOf>
            <owl:Restriction>
                <owl:onProperty rdf:resource="https://businessontology.com/ontology/uniqueText"/>
                <owl:qualifiedCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">1</owl:qualifiedCardinality>
                <owl:onDataRange rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
            </owl:Restriction>
        </rdfs:subClassOf>
        <rdfs:subClassOf>
            <owl:Restriction>
                <owl:onProperty rdf:resource="https://businessontology.com/ontology/updatedOn"/>
                <owl:qualifiedCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">1</owl:qualifiedCardinality>
                <owl:onDataRange rdf:resource="http://www.w3.org/2001/XMLSchema#dateTime"/>
            </owl:Restriction>
        </rdfs:subClassOf>
        <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">A concept or label used to categorize other instances informally. Things that can be thought of as types are usually Categories.</rdfs:comment>
        <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">EXAMPLE: Tags used in folksonomies; formal definitions from other systems.</rdfs:comment>
        <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">NOTE: Often a &apos;bucket&apos; can be modeled either as an owl:Class or as a gist:Category. Use the latter if you don&apos;t care much about the formal structure of the different types, or if there is a whole hierarchy of types that are going to be managed by a group separate from the ontology developers. The formal structure may be defined elsewhere and linked to, if necessary.</rdfs:comment>
        <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Category</rdfs:label>
    </owl:Class>
    
  1. LivingThing:
[2020-10-25 22:42:45] [SEVERE ] Could not parse class https://businessontology.com/ontology/LivingThing 
[2020-10-25 22:42:45] [SEVERE ] Could not parse class https://businessontology.com/ontology/LivingThing 
  1. Person and PhysicalSubstance
[2020-10-25 22:42:45] [SEVERE ] Could not parse class https://businessontology.com/ontology/Person 
[2020-10-25 22:42:45] [SEVERE ] Could not parse class https://businessontology.com/ontology/Person 
[2020-10-25 22:42:45] [INFO   ] Analyzing restrictions of Class: <https://businessontology.com/ontology/PhysicalSubstance> with axiom: ObjectIntersectionOf(ObjectSomeValuesFrom(<https://businessontology.com/ontology/hasMagnitude> <https://businessontology.com/ontology/Mass>) ObjectSomeValuesFrom(<https://businessontology.com/ontology/hasMagnitude> <https://businessontology.com/ontology/Volume>)) 
[2020-10-25 22:42:45] [INFO   ] Analyzing restrictions of Class: <https://businessontology.com/ontology/PhysicalSubstance> with axiom: ObjectIntersectionOf(ObjectSomeValuesFrom(<https://businessontology.com/ontology/hasMagnitude> <https://businessontology.com/ontology/Mass>) ObjectSomeValuesFrom(<https://businessontology.com/ontology/hasMagnitude> <https://businessontology.com/ontology/Volume>)) 
[2020-10-25 22:42:45] [WARNING] Ignoring complex range restriction of property  
[2020-10-25 22:42:45] [WARNING] Ignoring complex range restriction of property  
[2020-10-25 22:42:45] [WARNING] Ignoring complex range restriction of property  
[2020-10-25 22:42:45] [WARNING] Ignoring complex range restriction of property  

Here are the files:

Archive.zip

Once I deleted the complex expressions it worked fine.

Here's the simplified version of the OWL:

ontology-v0.5.owl.zip

@dgarijo
Copy link
Contributor

dgarijo commented Oct 25, 2020

Thanks! It looks like for some reason some classes are still not listed (See #145 ). I have saved some time next week to look into this and fix it

@DougalW
Copy link
Author

DougalW commented Oct 25, 2020

Also I noticed odd behaviour when mapping object property restrictions into the spec.

When I parse through the openapi.yaml file it isn't generating a complete schema from object properties correctly. E.g. allocatedBy has a range restriction ''Intellectual Property' or Organization or Person or System' but only Organization comes through in the openapi spec, even though it should conform to the mapping spec.

@dgarijo
Copy link
Contributor

dgarijo commented Feb 18, 2021

This seems to overlap with #151, which has been addressed. Since I have been testing with the same ontology, I will close it up. Let me know if there are issues!.

@dgarijo dgarijo closed this as completed Feb 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working high priority
Projects
None yet
Development

No branches or pull requests

2 participants