Skip to content

RDFS

Theory corresponding to RDF-Schema (RDFS)

OWLClass dataclass

Bases: FactMixin

True if node is an OWL Class

Note that even though OWL predicates are typically defined in owlfull.py, owl:Class is considered part of RDFS.

Source code in src/typedlogic/integrations/frameworks/rdflib/rdfs.py
18
19
20
21
22
23
24
25
26
27
@dataclass
class OWLClass(FactMixin):
    """
    True if node is an OWL Class

    Note that even though OWL predicates are typically defined in owlfull.py,
    owl:Class is considered part of RDFS.
    """

    node: Node

RDFProperty dataclass

Bases: FactMixin

RDF.Property axiom

Source code in src/typedlogic/integrations/frameworks/rdflib/rdfs.py
30
31
32
33
34
35
36
@dataclass
class RDFProperty(FactMixin):
    """
    RDF.Property axiom
    """

    node: Node

SubClassOf dataclass

Bases: FactMixin

SubClassOf axiom

Source code in src/typedlogic/integrations/frameworks/rdflib/rdfs.py
39
40
41
42
43
44
45
46
@dataclass
class SubClassOf(FactMixin):
    """
    SubClassOf axiom
    """

    subject: Node
    object: Node

SubPropertyOf dataclass

Bases: FactMixin

SubPropertyOf axiom

Source code in src/typedlogic/integrations/frameworks/rdflib/rdfs.py
49
50
51
52
53
54
55
56
@dataclass
class SubPropertyOf(FactMixin):
    """
    SubPropertyOf axiom
    """

    subject: Node
    object: Node

Type dataclass

Bases: FactMixin

rdf.Type axiom

Source code in src/typedlogic/integrations/frameworks/rdflib/rdfs.py
59
60
61
62
63
64
65
66
@dataclass
class Type(FactMixin):
    """
    rdf.Type axiom
    """

    subject: Node
    object: Node

Domain dataclass

Bases: FactMixin

property domain axiom

Source code in src/typedlogic/integrations/frameworks/rdflib/rdfs.py
69
70
71
72
73
74
75
76
@dataclass
class Domain(FactMixin):
    """
    property domain axiom
    """

    subject: Node
    object: Node

Range dataclass

Bases: FactMixin

property range axiom

Source code in src/typedlogic/integrations/frameworks/rdflib/rdfs.py
79
80
81
82
83
84
85
86
@dataclass
class Range(FactMixin):
    """
    property range axiom
    """

    subject: Node
    object: Node

transitivity_and_reflexivity(s, z, o)

Axioms for transitivity and reflexivity.

Parameters:

Name Type Description Default
s Node

subject

required
z Node

intermediate

required
o Node

object

required

Returns:

Type Description
Source code in src/typedlogic/integrations/frameworks/rdflib/rdfs.py
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
@axiom
def transitivity_and_reflexivity(s: Node, z: Node, o: Node):
    """
    Axioms for transitivity and reflexivity.

    :param s: subject
    :param z: intermediate
    :param o: object
    :return:
    """
    if SubClassOf(s, z) and SubClassOf(z, o):
        assert SubClassOf(s, o)
    if OWLClass(s):
        assert SubClassOf(s, s)
    if RDFProperty(s):
        assert SubPropertyOf(s, s)
    if SubPropertyOf(s, z) and SubPropertyOf(z, o):
        assert SubPropertyOf(s, o)

type_propagation(s, c, d)

Propagation of rdf:type up class hierarchy

Parameters:

Name Type Description Default
s Node

subject

required
c Node

asserted class

required
d Node

inferred class

required

Returns:

Type Description
Source code in src/typedlogic/integrations/frameworks/rdflib/rdfs.py
109
110
111
112
113
114
115
116
117
118
119
120
@axiom
def type_propagation(s: Node, c: Node, d: Node):
    """
    Propagation of rdf:type up class hierarchy

    :param s: subject
    :param c: asserted class
    :param d: inferred class
    :return:
    """
    if Type(s, c) and SubClassOf(c, d):
        assert Type(s, d)