ontocast.onto.property_sides¶
A property's domain and range, read from every predicate that states one.
Two kinds of statement give a side:
rdfs:domain/rdfs:rangeentail: every subject of the property is an instance of the domain, every object of the range;schema:domainIncludes/schema:rangeIncludeslist expected classes. They entail nothing, and they add up: each document that uses the property for a new kind of subject may add its class.
Readers take a property's sides from here, so both kinds are read the same
way everywhere. A reader that infers a type from a side reads the rdfs
sides only (or a listed side that names one class); a reader that checks fit,
ranks candidates or shows the sides reads both.
Attributes¶
DOMAIN_INCLUDES = URIRef('https://schema.org/domainIncludes')
module-attribute
¶
DOMAIN_PREDICATES = frozenset(side_predicates('domain'))
module-attribute
¶
RANGE_INCLUDES = URIRef('https://schema.org/rangeIncludes')
module-attribute
¶
RANGE_PREDICATES = frozenset(side_predicates('range'))
module-attribute
¶
SCHEMA_NAMESPACES = ('https://schema.org/', 'http://schema.org/')
module-attribute
¶
SIDE_PREDICATES = DOMAIN_PREDICATES | RANGE_PREDICATES
module-attribute
¶
Side = Literal['domain', 'range']
module-attribute
¶
SideSource = Literal['rdfs', 'includes']
module-attribute
¶
__all__ = ['DOMAIN_INCLUDES', 'DOMAIN_PREDICATES', 'RANGE_INCLUDES', 'RANGE_PREDICATES', 'SCHEMA_NAMESPACES', 'SIDE_PREDICATES', 'Side', 'SideSource', 'includes_predicates', 'is_datatype_value', 'properties_with_side', 'property_sides', 'side_classes', 'side_of', 'side_predicates', 'sides_by_property', 'source_of']
module-attribute
¶
Functions:¶
includes_predicates(side)
¶
schema:<side>Includes in both spellings of the schema.org namespace.
is_datatype_value(value, graph=None)
¶
An XSD datatype, a literal type, or a class graph declares a datatype.
Source code in ontocast/onto/property_sides.py
properties_with_side(graph, value, side=None)
¶
The properties whose side (either when None) names value.
Source code in ontocast/onto/property_sides.py
property_sides(prop, graphs, side)
¶
The named classes (or datatypes) of prop's side, with their source.
A class stated both ways counts as rdfs.
Source code in ontocast/onto/property_sides.py
side_classes(prop, graphs, side)
¶
The named values of prop's side, from either source.
side_of(predicate)
¶
The side predicate states, or None for any other predicate.
side_predicates(side)
¶
sides_by_property(graph, side, *, source=None)
¶
Property -> the named values of its side in graph.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
Graph
|
Where the sides are read. |
required |
side
|
Side
|
|
required |
source
|
SideSource | None
|
Only the |
None
|
Source code in ontocast/onto/property_sides.py
source_of(predicate)
¶
rdfs or includes for a side predicate, else None.