incomplete accepted predicates?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

incomplete accepted predicates?

Nicolai
Dear Jean-Babtiste,

we are still using Owlready2 Version 0.10 for quite a while now, and today came across the following question:

Why, in the below code excerpt, in the 'accepted_predicates', we do not find "min" / "max" / "exactly"?
And does this have to do with the storids with ‘_’ (underscore), with respect to which you explained me a while ago, that they are used for blank nodes in version 0.10?

def _get_general_axioms_storid(self, id_) -> set:
        """
        Get the storids for the general axioms for which the class with the given storid can be found on the Righthand Side of the axiom.
        :param id_: the id (storid) of the axiom
        :return: set of axioms
        """
        accepted_predicates = {
            owlready2.rdf_first,
            owlready2.rdf_rest,
            owlready2.owl_onclass,
            owlready2.SOME,
            owlready2.owl_unionof,
            owlready2.owl_intersectionof,
            owlready2.owl_equivalentclass}
        axioms = set()
        stack = [(triple, []) for triple in self.raw.get_triples(None, None, id_)]
        while len(stack) > 0:
            (subject, predicate, object_), chain = stack.pop(0)
            chain.append((subject, predicate, object_))
            if predicate == owlready2.rdfs_subclassof and \
                    (
                            (isinstance(subject, str) and (subject.startswith("_") or object_.startswith("_"))) or
                            (isinstance(subject, int) and (subject < 0 or object_ < 0))
                    ):
                axioms.add(Axiom(subject, object_))
            elif predicate in accepted_predicates:
                stack.extend((triple, chain[:]) for triple in self.raw.get_triples(None, None, subject))
        return axioms

Thanks again in advance for any help!

Best
Nicolai
Reply | Threaded
Open this post in threaded view
|

Re: incomplete accepted predicates?

Jiba
Administrator
Hi,

I'm not sure I understand your question well.
Your code excerpt is not from Owlready2 sources I think, so I have little idea about the content of this code... ?

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: incomplete accepted predicates?

Nicolai
Dear Jiba,

you are right, the code is not from owlready2 sources.
I will think about how to reformulate or specify the question.

Thanks!

Nicolai