Package RDFClosure :: Module OWLRLExtras
[hide private]
[frames] | no frames]

Module OWLRLExtras

source code

Extension to OWL 2 RL, ie, some additional rules added to the system from OWL 2 Full. It is implemented through the OWLRL_Extension class, whose reference has to be passed to the relevant semantic class (ie, either the OWL 2 RL or the combined closure class) as an 'extension'.

The added rules and features are:

In more details, the rules that are added:

  1. self restriction 1: ?z owl:hasSelf ?x. ?x owl:onProperty ?p. ?y rdf:type ?z. => ?y ?p ?y.
  2. self restriction 2: ?z owl:hasSelf ?x. ?x owl:onProperty ?p. ?y ?p ?y. => ?y rdf:type ?z.

Requires: RDFLib, 4.0.0 and higher

License: This software is available for use under the W3C Software License

Organization: World Wide Web Consortium

Author: Ivan Herman

Contact: Ivan Herman, ivan@w3.org

Classes [hide private]
  OWLRL_Extension
Additional rules to OWL 2 RL.
  OWLRL_Extension_Trimming
This Class adds only one feature to OWLRL_Extension: to initialize with a trimming flag set to True by default.
Functions [hide private]
Rational
_strToRational(v)
Converting a string to a rational.
source code
Variables [hide private]
  AllDifferent = rdflib.term.URIRef(u'http://www.w3.org/2002/07/...
  AllDisjointClasses = rdflib.term.URIRef(u'http://www.w3.org/20...
  AllDisjointProperties = rdflib.term.URIRef(u'http://www.w3.org...
  AltXSDToPYTHON = {rdflib.term.URIRef(u'http://www.w3.org/1999/...
  Annotation = rdflib.term.URIRef(u'http://www.w3.org/2002/07/ow...
  AnnotationProperty = rdflib.term.URIRef(u'http://www.w3.org/20...
  AsymmetricProperty = rdflib.term.URIRef(u'http://www.w3.org/20...
  Axiom = rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#Axi...
  BottomDataProperty = rdflib.term.URIRef(u'http://www.w3.org/20...
  BottomObjectProperty = rdflib.term.URIRef(u'http://www.w3.org/...
  Class = rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-sch...
  DataRange = rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl...
  Datatype = rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-...
  DatatypeProperty = rdflib.term.URIRef(u'http://www.w3.org/2002...
  DeprecatedClass = rdflib.term.URIRef(u'http://www.w3.org/2002/...
  DeprecatedProperty = rdflib.term.URIRef(u'http://www.w3.org/20...
  FunctionalProperty = rdflib.term.URIRef(u'http://www.w3.org/20...
  InverseFunctionalProperty = rdflib.term.URIRef(u'http://www.w3...
  IrreflexiveProperty = rdflib.term.URIRef(u'http://www.w3.org/2...
  NamedIndividual = rdflib.term.URIRef(u'http://www.w3.org/2002/...
  NegativePropertyAssertion = rdflib.term.URIRef(u'http://www.w3...
  Nothing = rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#N...
  OWLClass = rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#...
  OWLNS = Namespace(u'http://www.w3.org/2002/07/owl#')
  OWLRL_Annotation_properties = [rdflib.term.URIRef(u'http://www...
  OWL_Datatype_Subsumptions = {rdflib.term.URIRef(u'http://www.w...
  OWL_RL_Datatypes = [rdflib.term.URIRef(u'http://www.w3.org/200...
  OWLpredicate = rdflib.term.URIRef(u'http://www.w3.org/2002/07/...
  OWLsubject = rdflib.term.URIRef(u'http://www.w3.org/2002/07/ow...
  ObjectProperty = rdflib.term.URIRef(u'http://www.w3.org/2002/0...
  Ontology = rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#...
  OntologyProperty = rdflib.term.URIRef(u'http://www.w3.org/2002...
  Property = rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-r...
  ReflexiveProperty = rdflib.term.URIRef(u'http://www.w3.org/200...
  Resource = rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-...
  Restriction = rdflib.term.URIRef(u'http://www.w3.org/2002/07/o...
  SelfRestriction = rdflib.term.URIRef(u'http://www.w3.org/2002/...
  SymmetricProperty = rdflib.term.URIRef(u'http://www.w3.org/200...
  Thing = rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#Thi...
  TopDataProperty = rdflib.term.URIRef(u'http://www.w3.org/2002/...
  TopObjectProperty = rdflib.term.URIRef(u'http://www.w3.org/200...
  TransitiveProperty = rdflib.term.URIRef(u'http://www.w3.org/20...
  __author__ = 'Ivan Herman'
  __license__ = u'W3C® SOFTWARE NOTICE AND LICENSE, http://www.w...
  __package__ = 'RDFClosure'
  allValuesFrom = rdflib.term.URIRef(u'http://www.w3.org/2002/07...
  annotatedProperty = rdflib.term.URIRef(u'http://www.w3.org/200...
  annotatedSource = rdflib.term.URIRef(u'http://www.w3.org/2002/...
  annotatedTarget = rdflib.term.URIRef(u'http://www.w3.org/2002/...
  assertionProperty = rdflib.term.URIRef(u'http://www.w3.org/200...
  backwardCompatibleWith = rdflib.term.URIRef(u'http://www.w3.or...
  cardinality = rdflib.term.URIRef(u'http://www.w3.org/2002/07/o...
  complementOf = rdflib.term.URIRef(u'http://www.w3.org/2002/07/...
  datatypeComplementOf = rdflib.term.URIRef(u'http://www.w3.org/...
  deprecated = rdflib.term.URIRef(u'http://www.w3.org/2002/07/ow...
  differentFrom = rdflib.term.URIRef(u'http://www.w3.org/2002/07...
  disjointClasses = rdflib.term.URIRef(u'http://www.w3.org/2002/...
  disjointUnionOf = rdflib.term.URIRef(u'http://www.w3.org/2002/...
  disjointWith = rdflib.term.URIRef(u'http://www.w3.org/2002/07/...
  distinctMembers = rdflib.term.URIRef(u'http://www.w3.org/2002/...
  domain = rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-sc...
  equivalentClass = rdflib.term.URIRef(u'http://www.w3.org/2002/...
  equivalentProperty = rdflib.term.URIRef(u'http://www.w3.org/20...
  hasKey = rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#ha...
  hasSelf = rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#h...
  hasValue = rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#...
  imports = rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#i...
  incompatibleWith = rdflib.term.URIRef(u'http://www.w3.org/2002...
  intersectionOf = rdflib.term.URIRef(u'http://www.w3.org/2002/0...
  inverseOf = rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl...
  maxCardinality = rdflib.term.URIRef(u'http://www.w3.org/2002/0...
  maxQualifiedCardinality = rdflib.term.URIRef(u'http://www.w3.o...
  members = rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#m...
  minCardinality = rdflib.term.URIRef(u'http://www.w3.org/2002/0...
  minQualifiedCardinality = rdflib.term.URIRef(u'http://www.w3.o...
  ns_owl = Namespace(u'http://www.w3.org/2002/07/owl#')
  ns_xsd = Namespace(u'http://www.w3.org/2001/XMLSchema#')
  onClass = rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#o...
  onDataRange = rdflib.term.URIRef(u'http://www.w3.org/2002/07/o...
  onDatatype = rdflib.term.URIRef(u'http://www.w3.org/2002/07/ow...
  onProperties = rdflib.term.URIRef(u'http://www.w3.org/2002/07/...
  onProperty = rdflib.term.URIRef(u'http://www.w3.org/2002/07/ow...
  oneOf = rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#one...
  priorVersion = rdflib.term.URIRef(u'http://www.w3.org/2002/07/...
  propertyChainAxiom = rdflib.term.URIRef(u'http://www.w3.org/20...
  propertyDisjointWith = rdflib.term.URIRef(u'http://www.w3.org/...
  qualifiedCardinality = rdflib.term.URIRef(u'http://www.w3.org/...
  rdfType = rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rd...
  sameAs = rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#sa...
  someValuesFrom = rdflib.term.URIRef(u'http://www.w3.org/2002/0...
  sourceIndividual = rdflib.term.URIRef(u'http://www.w3.org/2002...
  subClassOf = rdflib.term.URIRef(u'http://www.w3.org/2000/01/rd...
  subPropertyOf = rdflib.term.URIRef(u'http://www.w3.org/2000/01...
  targetIndividual = rdflib.term.URIRef(u'http://www.w3.org/2002...
  targetValue = rdflib.term.URIRef(u'http://www.w3.org/2002/07/o...
  unionOf = rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#u...
  versionIRI = rdflib.term.URIRef(u'http://www.w3.org/2002/07/ow...
  versionInfo = rdflib.term.URIRef(u'http://www.w3.org/2002/07/o...
  withRestrictions = rdflib.term.URIRef(u'http://www.w3.org/2002...

Imports: Namespace, RDFS_OWLRL_Semantics, Rational, extract_faceted_datatypes, rdflib


Function Details [hide private]

_strToRational(v)

source code 

Converting a string to a rational.

According to the OWL spec: numerator must be an integer, denominator a positive integer (ie, xsd['integer'] type), and the denominator should not have a '+' sign.

Parameters:
  • v - the literal string defined as boolean @return corresponding Rational value
Returns: Rational
Raises:
  • ValueError - invalid rational string literal

Variables Details [hide private]

AllDifferent

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#AllDifferent')

AllDisjointClasses

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#AllDisjointClasses'\
)

AllDisjointProperties

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#AllDisjointProperti\
es')

AltXSDToPYTHON

Value:
{ns_xsd ["language"]: lambda v: _strToVal_Regexp(v, _re_language), ns_\
xsd ["NMTOKEN"]: lambda v: _strToVal_Regexp(v, _re_NMTOKEN, re.U), ns_\
xsd ["Name"]: lambda v: _strToVal_Regexp(v, _re_NMTOKEN, re.U, _re_Nam\
e_ex), ns_xsd ["NCName"]: lambda v: _strToVal_Regexp(v, _re_NCName, re\
.U, _re_NCName_ex), ns_xsd ["token"]: _strToToken, ns_rdf ["PlainLiter\
al"]: _strToPlainLiteral, ns_xsd ["boolean"]: _strToBool, ns_xsd ["dec\
imal"]: _strToDecimal, ns_xsd ["anyURI"]: _strToAnyURI, ns_xsd ["base6\
4Binary"]: _strToBase64Binary, ns_xsd ["double"]: _strToDouble, ns_xsd\
...

Annotation

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#Annotation')

AnnotationProperty

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#AnnotationProperty'\
)

AsymmetricProperty

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#AsymmetricProperty'\
)

Axiom

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#Axiom')

BottomDataProperty

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#BottomDataProperty'\
)

BottomObjectProperty

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#BottomObjectPropert\
y')

Class

Value:
rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#Class')

DataRange

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#DataRange')

Datatype

Value:
rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#Datatype')

DatatypeProperty

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#DatatypeProperty')

DeprecatedClass

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#DeprecatedClass')

DeprecatedProperty

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#DeprecatedProperty'\
)

FunctionalProperty

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#FunctionalProperty'\
)

InverseFunctionalProperty

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#InverseFunctionalPr\
operty')

IrreflexiveProperty

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#IrreflexiveProperty\
')

NamedIndividual

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#NamedIndividual')

NegativePropertyAssertion

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#NegativePropertyAss\
ertion')

Nothing

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#Nothing')

OWLClass

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#Class')

OWLRL_Annotation_properties

Value:
[rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#label'),
 rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#comment'),
 rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#seeAlso'),
 rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#isDefinedBy\
'),
 rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#deprecated'),
 rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#versionInfo'),
 rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#priorVersion'),
...

OWL_Datatype_Subsumptions

Value:
{rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#NCName'): [rdfl\
ib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#Name'),
                                                                  rdfl\
ib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#token'),
                                                                  rdfl\
ib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#normalizedString'),
                                                                  rdfl\
ib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#string')],
...

OWL_RL_Datatypes

Value:
[rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#integer'),
 rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#decimal'),
 rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#nonNegativeInte\
ger'),
 rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#nonPositiveInte\
ger'),
 rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#negativeInteger\
'),
...

OWLpredicate

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#predicate')

OWLsubject

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#subject')

ObjectProperty

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#ObjectProperty')

Ontology

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#Ontology')

OntologyProperty

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#OntologyProperty')

Property

Value:
rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#Proper\
ty')

ReflexiveProperty

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#ReflexiveProperty')

Resource

Value:
rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#Resource')

Restriction

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#Restriction')

SelfRestriction

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#SelfRestriction')

SymmetricProperty

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#SymmetricProperty')

Thing

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#Thing')

TopDataProperty

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#TopDataProperty')

TopObjectProperty

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#TopObjectProperty')

TransitiveProperty

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#TransitiveProperty'\
)

__license__

Value:
u'W3C® SOFTWARE NOTICE AND LICENSE, http://www.w3.org/Consortium/Legal\
/2002/copyright-software-20021231'

allValuesFrom

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#allValuesFrom')

annotatedProperty

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#annotatedProperty')

annotatedSource

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#annotatedSource')

annotatedTarget

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#annotatedTarget')

assertionProperty

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#assertionProperty')

backwardCompatibleWith

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#backwardCompatibleW\
ith')

cardinality

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#cardinality')

complementOf

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#complementOf')

datatypeComplementOf

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#datatypeComplementO\
f')

deprecated

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#deprecated')

differentFrom

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#differentFrom')

disjointClasses

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#disjointClasses')

disjointUnionOf

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#disjointUnionOf')

disjointWith

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#disjointWith')

distinctMembers

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#distinctMembers')

domain

Value:
rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#domain')

equivalentClass

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#equivalentClass')

equivalentProperty

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#equivalentProperty'\
)

hasKey

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#hasKey')

hasSelf

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#hasSelf')

hasValue

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#hasValue')

imports

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#imports')

incompatibleWith

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#incompatibleWith')

intersectionOf

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#intersectionOf')

inverseOf

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#inverseOf')

maxCardinality

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#maxCardinality')

maxQualifiedCardinality

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#maxQualifiedCardina\
lity')

members

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#members')

minCardinality

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#minCardinality')

minQualifiedCardinality

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#minQualifiedCardina\
lity')

onClass

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#onClass')

onDataRange

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#onDataRange')

onDatatype

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#onDatatype')

onProperties

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#onProperties')

onProperty

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#onProperty')

oneOf

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#oneOf')

priorVersion

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#priorVersion')

propertyChainAxiom

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#propertyChainAxiom'\
)

propertyDisjointWith

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#propertyDisjointWit\
h')

qualifiedCardinality

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#qualifiedCardinalit\
y')

rdfType

Value:
rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#type')

sameAs

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#sameAs')

someValuesFrom

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#someValuesFrom')

sourceIndividual

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#sourceIndividual')

subClassOf

Value:
rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#subClassOf')

subPropertyOf

Value:
rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#subPropertyO\
f')

targetIndividual

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#targetIndividual')

targetValue

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#targetValue')

unionOf

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#unionOf')

versionIRI

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#versionIRI')

versionInfo

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#versionInfo')

withRestrictions

Value:
rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#withRestrictions')