forked from pwin/owlready2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
__init__.py
142 lines (122 loc) · 6.16 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# -*- coding: utf-8 -*-
# Owlready2
# Copyright (C) 2013-2019 Jean-Baptiste LAMY
# LIMICS (Laboratoire d'informatique médicale et d'ingénierie des connaissances en santé), UMR_S 1142
# University Paris 13, Sorbonne paris-Cité, Bobigny, France
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
VERSION = "0.25"
JAVA_EXE = "java"
from owlready2.base import *
#_render_func = default_render_func
from owlready2.namespace import *
from owlready2.entity import *
from owlready2.prop import *
from owlready2.prop import _FUNCTIONAL_FOR_CACHE
from owlready2.individual import *
from owlready2.class_construct import *
from owlready2.disjoint import *
from owlready2.annotation import *
from owlready2.reasoning import *
from owlready2.reasoning import _keep_most_specific
from owlready2.close import *
import owlready2.namespace, owlready2.entity, owlready2.prop, owlready2.class_construct, owlready2.triplelite
owlready2.triplelite.Or = Or
owlready2.namespace.EntityClass = EntityClass
owlready2.namespace.ThingClass = ThingClass
owlready2.namespace.PropertyClass = PropertyClass
owlready2.namespace.AnnotationPropertyClass = AnnotationPropertyClass
owlready2.namespace.ObjectPropertyClass = ObjectPropertyClass
owlready2.namespace.DataPropertyClass = DataPropertyClass
owlready2.namespace.ObjectProperty = ObjectProperty
owlready2.namespace.DataProperty = DataProperty
owlready2.namespace.AnnotationProperty = AnnotationProperty
owlready2.namespace.Thing = Thing
owlready2.namespace.Property = Property
owlready2.namespace.Or = Or
owlready2.namespace.And = And
owlready2.namespace.Not = Not
owlready2.namespace.Restriction = Restriction
owlready2.namespace.OneOf = OneOf
owlready2.namespace.FusionClass = FusionClass
owlready2.namespace.AllDisjoint = AllDisjoint
owlready2.namespace.ConstrainedDatatype = ConstrainedDatatype
owlready2.namespace.Inverse = Inverse
owlready2.namespace.IndividualValueList = IndividualValueList
owlready2.entity.Thing = Thing
owlready2.entity.Nothing = Nothing
owlready2.entity.Construct = Construct
owlready2.entity.And = And
owlready2.entity.Or = Or
owlready2.entity.Not = Not
owlready2.entity.OneOf = OneOf
owlready2.entity.Restriction = Restriction
owlready2.entity.ObjectPropertyClass= ObjectPropertyClass
owlready2.entity.ObjectProperty = ObjectProperty
owlready2.entity.DataProperty = DataProperty
owlready2.entity.AnnotationProperty = AnnotationProperty
owlready2.entity.ReasoningPropertyClass = ReasoningPropertyClass
owlready2.entity.FunctionalProperty = FunctionalProperty
#owlready2.entity.ValueList = ValueList
owlready2.entity.AllDisjoint = AllDisjoint
owlready2.entity.Inverse = Inverse
owlready2.entity._FUNCTIONAL_FOR_CACHE = _FUNCTIONAL_FOR_CACHE
owlready2.entity._property_value_restrictions = owlready2.prop._property_value_restrictions
owlready2.entity._inherited_properties_value_restrictions = owlready2.prop._inherited_properties_value_restrictions
owlready2.disjoint.Or = Or
owlready2.prop.Restriction = Restriction
owlready2.prop.ConstrainedDatatype = ConstrainedDatatype
owlready2.prop.Construct = Construct
owlready2.prop.AnnotationProperty = AnnotationProperty
owlready2.prop.Thing = Thing
owlready2.prop.PropertyChain = PropertyChain
owlready2.prop._check_superclasses = True
owlready2.prop.ThingClass = ThingClass
owlready2.prop.And = And
owlready2.prop.Or = Or
owlready2.prop.OneOf = OneOf
owlready2.annotation.Construct = Construct
owlready2.individual._keep_most_specific = _keep_most_specific
owlready2.individual.Construct = Construct
owlready2.individual.TransitiveProperty = TransitiveProperty
owlready2.individual.SymmetricProperty = SymmetricProperty
owlready2.individual.ReflexiveProperty = ReflexiveProperty
owlready2.individual.InverseFunctionalProperty = InverseFunctionalProperty
owlready2.individual.AnnotationPropertyClass = AnnotationPropertyClass
owlready2.class_construct.Thing = Thing
owlready2.class_construct.ThingClass = ThingClass
owlready2.class_construct.EntityClass = EntityClass
#owlready2.reasoning.Construct = Construct
del owlready2
from owlready2.rule import *
LOADING.__exit__()
# Not real property
del owl_world._props["Property"]
del owl_world._props["ObjectProperty"]
del owl_world._props["DatatypeProperty"]
del owl_world._props["FunctionalProperty"]
del owl_world._props["InverseFunctionalProperty"]
del owl_world._props["TransitiveProperty"]
del owl_world._props["SymmetricProperty"]
del owl_world._props["AsymmetricProperty"]
del owl_world._props["ReflexiveProperty"]
del owl_world._props["IrreflexiveProperty"]
del owl_world._props["AnnotationProperty"]
default_world = IRIS = World()
get_ontology = default_world.get_ontology
get_namespace = default_world.get_namespace
def default_render_func(entity):
if isinstance(entity.storid, int) and (entity.storid < 0): return "_:%s" % (-entity.storid)
return "%s.%s" % (entity.namespace.name, entity.name)
def set_render_func(func):
type.__setattr__(EntityClass, "__repr__", func)
type.__setattr__(Thing , "__repr__", func)
set_render_func(default_render_func)