patch¶
This module injects some additional methods into owlready2 classes.
_dir(self)
¶
Extend in dir() listing of ontology classes.
Source code in ontopy/patch.py
66 67 68 69 70 71 |
|
disjoint_with(self, reduce=False)
¶
Returns a generator with all classes that are disjoint with self
.
If reduce
is True
, all classes that are a descendant of another class
will be excluded.
Source code in ontopy/patch.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
|
get_annotations(self, all=False, imported=True)
¶
Returns a dict with non-empty annotations.
If all
is True
, also annotations with no value are included.
If imported
is True
, also include annotations defined in imported
ontologies.
Source code in ontopy/patch.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
|
get_indirect_is_a(self, skip_classes=True)
¶
Returns the set of all isSubclassOf relations of self and its ancestors.
If skip_classes
is True
, indirect classes are not included in the
returned set.
Source code in ontopy/patch.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
|
get_parents(self, strict=False)
¶
Returns a list of all parents.
If strict
is True
, parents that are parents of other parents are
excluded.
Source code in ontopy/patch.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
|
get_preferred_label(self)
¶
Returns the preferred label as a string (not list).
The following heuristics is used
- if prefLabel annotation property exists, returns the first prefLabel
- if label annotation property exists, returns the first label
- otherwise return the name
Source code in ontopy/patch.py
29 30 31 32 33 34 35 36 37 38 39 40 41 |
|
get_typename(self)
¶
Get restriction type label/name.
Source code in ontopy/patch.py
164 165 166 |
|
has(self, name)
¶
Returns true if name
Source code in ontopy/patch.py
213 214 215 |
|
items(self)
¶
Return a generator over annotation property (name, value_list) pairs associates with this ontology.
Source code in ontopy/patch.py
202 203 204 205 206 207 208 209 210 |
|
keys(self)
¶
Return a generator over annotation property names associates with this ontology.
Source code in ontopy/patch.py
191 192 193 194 195 196 197 198 199 |
|
namespace_init(self, world_or_ontology, base_iri, name=None)
¶
init function for the Namespace
class.
Source code in ontopy/patch.py
178 179 180 181 182 |
|
render_func(entity)
¶
Improve default rendering of entities.
Source code in ontopy/patch.py
10 11 12 13 14 15 16 17 18 19 20 |
|