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

inherit ontology and python class #18

Open
c-mellueh opened this issue Jan 26, 2022 · 0 comments
Open

inherit ontology and python class #18

c-mellueh opened this issue Jan 26, 2022 · 0 comments

Comments

@c-mellueh
Copy link

Hi, i'm trying to let a ontology class inherit from a standard python class and also the Thing class. I want this to work, because the python class stores some function i use in a lot of other classes and i dont want to copy them all the time. If i transform my python class into an ontology class, almost every class is connected with them (which doesnt make sems imo).

I'm trying something like this:

class MvdXml(Thing, IdentityObject):

    namespace = onto

    def __init__(self, file: str = None, doc: str = None, validation=None) -> etree._Element:
        super().__init__()

where Thing is the ontology class and IdentityObject is the python class.

My errormessage is

line 162, in _add_is_a_triple
    Class.namespace.ontology._add_obj_triple_spo(Class.storid, Class._rdfs_is_a, base.storid)
AttributeError: type object 'IdentityObject' has no attribute 'storid'

so i guess owlready2 wants the pythonclass to also be an ontologyclass.
Is there a workaround?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant