Esempio n. 1
0
    def doNodeIdentification(self, node):
        """
        Perform node identification.
        :type node: AbstractNode
        """
        if Identity.Neutral in node.identities():

            func = lambda x: Identity.Neutral in x.identities()
            collection = bfs(source=node, filter_on_visit=func)
            generators = partition(func, collection)
            excluded = set()
            strong = set(generators[1])
            weak = set(generators[0])

            for node in weak:
                identification = node.identify()
                if identification:
                    strong = set.union(strong, identification[0])
                    strong = set.difference(strong, identification[1])
                    excluded = set.union(excluded, identification[2])

            computed = Identity.Neutral
            identities = set(x.identity() for x in strong)
            if identities:
                computed = first(identities)
                if len(identities) > 1:
                    computed = Identity.Unknown

            for node in weak - strong - excluded:
                node.setIdentity(computed)
Esempio n. 2
0
    def doNodeIdentification(self, node):
        """
        Perform node identification.
        :type node: AbstractNode
        """
        if Identity.Neutral in node.identities():

            func = lambda x: Identity.Neutral in x.identities()
            collection = bfs(source=node, filter_on_visit=func)
            generators = partition(func, collection)
            excluded = set()
            strong = set(generators[1])
            weak = set(generators[0])

            for node in weak:
                identification = node.identify()
                if identification:
                    strong = set.union(strong, identification[0])
                    strong = set.difference(strong, identification[1])
                    excluded = set.union(excluded, identification[2])

            computed = Identity.Neutral
            identities = set(x.identity() for x in strong)
            if identities:
                computed = first(identities)
                if len(identities) > 1:
                    computed = Identity.Unknown

            for node in weak - strong - excluded:
                node.setIdentity(computed)
Esempio n. 3
0
 def __call__(self, source, edge, target):
     if edge.type() is Item.InputEdge:
         if target.type() is Item.IntersectionNode:
             if source.identity() is Identity.ValueDomain:
                 f1 = lambda x: x.type() in {Item.InputEdge, Item.InclusionEdge, Item.EquivalenceEdge}
                 f2 = lambda x: Identity.Neutral in x.identities()
                 for node in bfs(source=target, filter_on_edges=f1, filter_on_nodes=f2):
                     if node.type() is Item.ComplementNode:
                         # We found a complement node along the path, so any input to this intersection node,
                         # would cause the complement node to identify itself as a value-domain, but in OWL 2 QL
                         # it is not possible to construct complement of value domain expressions.
                         raise ProfileError('Complement of a value-domain expression is forbidden in OWL 2 QL')
Esempio n. 4
0
 def __call__(self, source, edge, target):
     if edge.type() is Item.InputEdge:
         if target.type() is Item.IntersectionNode:
             if source.identity() is Identity.ValueDomain:
                 f1 = lambda x: x.type() in {Item.InputEdge, Item.InclusionEdge, Item.EquivalenceEdge}
                 f2 = lambda x: Identity.Neutral in x.identities()
                 for node in bfs(source=target, filter_on_edges=f1, filter_on_nodes=f2):
                     if node.type() is Item.ComplementNode:
                         # We found a complement node along the path, so any input to this intersection node,
                         # would cause the complement node to identify itself as a value-domain, but in OWL 2 QL
                         # it is not possible to construct complement of value domain expressions.
                         raise ProfileError('Complement of a value-domain expression is forbidden in OWL 2 QL')