pax_global_header00006660000000000000000000000064150420116610014506gustar00rootroot0000000000000052 comment=8e1bdbb322c656fcb7f6745447d740eec40fc18e OWL-RL-7.1.4/000077500000000000000000000000001504201166100124735ustar00rootroot00000000000000OWL-RL-7.1.4/.gitignore000066400000000000000000000002471504201166100144660ustar00rootroot00000000000000# Jetbrains editors .idea/ * Python *.pyc .pytest_cache/ # 2to3 *.bak /venv/ docs/build/ build/ dist/ deb_dist/ sdist/ *.egg-info/ owlrl*.tar.gz # Mac .DS_Store OWL-RL-7.1.4/CHANGELOG.rst000066400000000000000000000307261504201166100145240ustar00rootroot00000000000000Changelog --------- v.7.1.4 - July, 2025 ~~~~~~~~~~~~~~~~~~~~~~~ Changes: * dependencies updates to meet RDFLib 7.1.4 * Python 3.9+ only, to match RDFLib 7.1.4 * background dependencies updated and tested to work v.7.1.3 - January, 2025 ~~~~~~~~~~~~~~~~~~~~~~~ Changes: * dependencies updates only to meet RDFLib 7.1.3 * ensured development dependencies allow for Python 3.8.1+ * updated README with contact info and installation instructions v.7.1.2 - October, 2024 ~~~~~~~~~~~~~~~~~~~~~~~ Changes: * Python dependency changed to > 3.8 (not > 3.10) to be compatible with other RDFLib packaged v.7.1.1 - October, 2024 ~~~~~~~~~~~~~~~~~~~~~~~ Changes: * works with rdflib >= 7.1.1 This version of OWL-RL has been released now to update the RDFLib dependency version only, to further reduce upstream dependencies. Additionally there are several major functional updates included: * [Better handling of detecting identical literals for RDFS sameAs rules](https://github.com/RDFLib/OWL-RL/pull/68) * [Allow OWL-RL Closures to be run on rdflib Dataset instances](https://github.com/RDFLib/OWL-RL/pull/69) * [Add inferred triples to a separate named graph](https://github.com/RDFLib/OWL-RL/pull/70) The main result of the changes above is to allow OWLRL to be run on a Graph within a Dataset and to store the inferred triples in a separate Graph which allows asserted and inferred data to be kept cleanly, side-by-side, and used together but managed independently. This update is of particular importance to tools such as [pySHACL](https://github.com/RDFLib/pySHACL)... 6.0.2 - October, 2021 ~~~~~~~~~~~~~~~~~~~~~~~ Changes: * works with rdflib >= 6.2.0 * replaces owl namespace element lists with those of rdflib (OWL, RDF, RDFS, XSD) v5.2.3 ~~~~~~ Changes: * fix README image display * fix version acquisition in setup.py v5.2.2 ~~~~~~ Changes: * Depend on RDFLib v5.0+ * Removed rdflib_jsonld as a requirement. It is included in rdflib 6.0 * Detect if rdflib 6.0 is in use, and do not import the jsonld module v5.2.1 ~~~~~~ Changes: * Added stdeb.cfg file, and notes in requirements-dev.txt for building a debian package * Removed the .py extension from the files in the scripts directory * Same change as above but for the RDFConvertService script * Fix Qualified Max Cardinality 0 Bug * Fix output printing of owlrl commandline script v5.2.0 ~~~~~~ Changes: * Dropped LiteralProxies finally. Processing of literals is no longer done through a LiteralProxy class (thanks :code:`@wrobell`) * As a consequence: * The change improves performance of the library by about 14%. * Related blocks of code, which swallow exceptions are removed. * Unit tests for the following OWL 2 RL rules are implemented cax-dw, cls-avf, cls-maxc1, cls-maxc2, cls-maxqc1, cls-maxqc2, cls-maxqc3, cls-maxqc4 * Unit tests for RDFS closure implemented adding datatype axioms, one time rules * Unit tests for OWL 2 RL extras closure implemented one time rules v5.1.1 ~~~~~~ Changes: * Renamed script: :code:`closure.py` to :code:`owlrl.py` * Fixed a deployment bug which caused the shebang to be rewritten incorrectly in the owlrl.py script. v5.1.0 ~~~~~~ Changes: * Rename module from RDFClosure to owlrl * Published on PyPI! * Fixed bugs caused by python3 automatic conversion (like :code:`range` being a variabe, not a function) * Added some basic tests (more tests coming!) * Started foundational work to remove :code:`LiteralProxies` in the future (thanks :code:`@wrobell`) * Simplified some sections of the code (thanks :code:`@wrobell`) Version 5.0.0 ~~~~~~~~~~~~~ Changes: * Port to Python3. Minimum recommended version is now Python v3.5. * Fixed a bug where the inferencing process would crash if the engine encountered a literal node that has a datatype for which it does not have a hardcoded converter. Version 4/5 ~~~~~~~~~~~ This is a major release: the package has been updated to Python 2.7 and RDFLib 4 (and to Python 3.5 in v5.0.0). Some important changes: * The local parser and serializer implementations have been removed; the package relies fully on RDFLib. * If the extra JSON-LD parser and serializer is available, that format may also be used both for input and output. * RDFa as a possible input format has been added. * The datatype part has been reworked to adapt itself to the way RDFLib handles datatypes. * The :code:`Literal` class has been adapted to the latest versions of RDFLib's :code:`Literal` (there is no :code:`cmp_value` any more, only value) * Python 2.7 includes an implementation for rational numbers (under the name :code:`Fraction`), so the separate module became moot. * The :code:`script` directory has been moved to the top level of the distribution. * The RDF1.1 specific datatypes (:code:`LangString` and :code:`HTML`) have been added, although the :code:`HTML` is simply treated as a text (a reliance on the HTML5 Library may be too much for what this is worth…) * The :code:`closure` script has now an extra flag (:code:`-m`) to use the "maximal" entailment, i.e., extended OWLRL+RDF with extra trimmings. Version 4.2.1 ~~~~~~~~~~~~~ Changes: * Per error report of Michael Schneider: if a class name is a blank node, the XML serialization went wrong. In case of exception, the fall back is to use the pure xml rather than the pretty xml; that works. There was also a 'trimming' argument missing in case of a pure format conversion that led to an exception, that is handled, too. Version 4.2 ~~~~~~~~~~~ Changes: * I exchanged rdflib Graph usage to rdflib ConjunctiveGraph. It avoids issues around deprecation and is also a possible entry point for named graphs. * Added an extra check in the allValuesFrom handling for datatype restrictions. This does not affect pure OWLRL but is used by the extras that implement facets. * The RestrictedDatatype class has now a 'Core' superclass; this can be used by other restricted datatypes that are not necessarily defined in OWL 2 Version 4.1 ~~~~~~~~~~~ Changes: * On advise from Dominique, the error message in the CGI script uses cgi.escape on the text input before displaying it. * 'Trimming' has been added to the command line options * Adaptation to rdflib 2.4.2 (or even 2.4.1?): the :code:`Literal._PythonToXSD` changed its structure from a dictionary to a list of tuples; :code:`DatatypeHandling.use_Alt_lexical_conversions()` had to change. Version 4.0 ~~~~~~~~~~~ Changes: * The top level :code:`__init__` file has been reorganized, so that the package can be used as a module for applications in RDFLib. There is a top level class (:code:`DeductiveClosure`) that can be invoked from an RDFLib application and the old entry point (:code:`convert_graph`) relies on that. * New class have been added to cover a combined RDFS + OWL 2 RL closure (Michael Schneider's idea). * An extension mechanism has been built in from bottom up; user can define his/her own rules via an extension class that is given as a parameter to the core closure class. * Using the extension mechanism a separate OWLRLExtras module has been added to implement, eg, self restriction, rational datatype. * In the closure class the array of temporarily stored tuples has been exchanged against a set; in other words, checking whether the tuple is to be stored already is now done by the built-in set operation. It became much faster... * The input argument has changed from 'source' to 'sources'; ie, several input files can be given to the service at the same time (eg, a separate URI for the data and the ontology, respectively). * Added the implementation of owl:imports. * Added an implemenatation for the datatype restrictions. * Bugs: * there was an optimization in the datatype handling of OWLRL that excluded subsumptions for 'implicit' literals, ie, literals that are given datatypes via the ^^ formalism (and not via sameAs and explicit datatype definitions). But this excluded proper inferences for existential restrictions...:-( * handler for the :code:`xsd:normalizedString` datatype was missing. Version 3.2 ~~~~~~~~~~~ Note: this version passes the full batch of official OWL Full/RL tests uploaded by Michael Schneider to the OWL Working Group site. The difference, in this respect, between this version and version 3.1 is the handling of datatypes (which was only rudimentary in 3.1) * Bugs: * the rules on dt-diff/dt-eq were missing in the implementation. (My mistake: I did not realize that ( owl:sameAs "adfa") was a possible setups whereby those rules do come in even in practice, so I did not implement them thinking that the results would not appear in the final code anyway due to a literal appearing in a subject position. Clearly an error in judgement.) * :code:`PlainLiteral` was in a wrong namespace in the OWLRL file:-( * Added an explicit handling for virtually all data types, to check the lexical values. (This is, in fact, a RDFLib deficiency for most cases, except those that came in via OWL, like PlainLiteral...) * Added a note referring to a Turtle parser bug... Version 3.1 ~~~~~~~~~~~ Note: this version passes the first, basic batch of official OWL Full/RL tests uploaded by Michael Schneider to the OWL Working Group site. * Bugs: * if the URI of a predicate did not correspond to a defined namespace, the extra namespace declaration did not appear in the pretty xml output. Typical situation: the user defines a namespace without trailing '#' or '/', but uses the prefix nevertheless; this ends up in a URI for, say, a predicate or a type that cannot be represented in XML. The proper approach is then to add a new prefix with 'http://' and use that in the output. The original XML serialization of RDFLib does that; the PrettyXMLSerialization did not. The pretty XML serialization is based on the one of RDFLib, and has therefore inherited this bug. * the axiomatic expression for (byte subclass short) was misspelled to (byte subclass byte) * the axiomatic triples added automatically should say (Thing type :code:`owl:Class`) (and not :code:`rdfs:Class` as before). Also, (Nothing type :code:`owl:Class`) was missing there. * :code:`rdf:text` changed to :code:`rdf:PlainLiteral` (in the axiomatic triples), as a result of the OWL WG on changing the name. * missing subclass relationship for dateTimeStamp vs dateTime. * there was an optimization that added Datatype triples only for those datatypes that appeared as part of a literal in the input graph. However, the rule set requires those triples to be added no matter what. At the moment, this is pending (there are discussions in the group on this). * the set of triples declaring annotation properties were missing * error message for asymmetric properties was bogus (has :code:`%p` instead of :code:`%s` in the text). * there was a leftover error message via exceptions for :code:`owl:Nothing` check. * rule :code:`scm-eqc2` was missing :-( * New Features: * added some support to booleans; essentially introducing a stronger check (according to XSD the :code:`"111"^xsd:boolean` is not a valid boolean values, though RDFLib accepts it as such...). * triples with a bnode predicate were systematically filtered out when added to a graph. However, incoming ontologies may include statements like '[ owl:inverseOf P]', and processing those through the rule set requires to allow such triples during deduction. Lucklily RDFLib is relaxed on that. So such 'generalized' triples are now allowed during the forward chaining and are filtered out only once, right before serialization. * some improvements on the datatype handling: * adding type relationships to super(data)types. For example, if the original graph includes (:code:` rdf:type xsd:short`), then the triple (:code:` rdf:type xsd:integer`), etc, is also added. As an optimization the (:code:`xsd:short rdfs:subClassOf xsd:integer`) triples are not added, but the direct datatyping is done instead. * adding disjointness information on datatypes on top of the hierarchy. This means that inconsistencies of the sort :code:` ex:prop 123 . ex:prop "1"^^xsd:boolean`. will be detected (integers and booleans must be disjoing per XSD; the explicit type relationships and the disjointness of some data types will trigger the necessary rules). Note that, mainly the first rule, is really useful when generic nodes are used as datatypes, as opposed to explicit literals. * added the possibility to set the input format explicitly, and changed the RDFConvert script accordingly (the service is not yet changed...). * added the possibility to consume standard input. OWL-RL-7.1.4/Doc_OLD/000077500000000000000000000000001504201166100136765ustar00rootroot00000000000000OWL-RL-7.1.4/Doc_OLD/RDFClosure-module.html000066400000000000000000001365221504201166100200300ustar00rootroot00000000000000 RDFClosure
Package RDFClosure
[hide private]
[frames] | no frames]

Package RDFClosure

source code

This module is brute force implementation of the 'finite' version of RDFS semantics and of OWL 2 RL on the top of RDFLib (with some caveats, see below). Some extensions to these are also implemented. Brute force means that, in all cases, simple forward chaining rules are used to extend (recursively) the incoming graph with all triples that the rule sets permit (ie, the "deductive closure" of the graph is computed). There is an extra options whether the axiomatic triples are added to the graph (prior to the forward chaining step). These, typically set the domain and range for properties or define some core classes. In the case of RDFS, the implementation uses a 'finite' version of the axiomatic triples only (as proposed, for example, by Herman ter Horst). This means that it adds only those rdf:_i type predicates that do appear in the original graph, thereby keeping this step finite. For OWL 2 RL, OWL 2 does not define axiomatic triples formally; but they can be deduced from the OWL 2 RDF Based Semantics document and are listed in Appendix 6 (though informally). Note, however, that this implementation adds only those triples that refer to OWL terms that are meaningful for the OWL 2 RL case.

Package Entry Points

The main entry point to the package is via the DeductiveClosure class. This class should be initialized to control the parameters of the deductive closure; the forward chaining is done via the expand method. The simplest way to use the package from an RDFLib application is as follows:

       graph = Graph()                                 # creation of an RDFLib graph
       ...
       ...                                             # normal RDFLib application, eg, parsing RDF data
       ...
       DeductiveClosure(OWLRL_Semantics).expand(graph) # calculate an OWL 2 RL deductive closure of graph
                                                       # without axiomatic triples

The first argument of the DeductiveClosure initialization can be replaced by other classes, providing different types of deductive closure; other arguments are also possible. For example:

DeductiveClosure(OWLRL_Extension, rdfs_closure = True, axiomatic_triples = True, datatype_axioms = True).expand(graph)

will calculate the deductive closure including RDFS and some extensions to OWL 2 RL, and with all possible axiomatic triples added to the graph (this is about the maximum the package can do…)

The same instance of DeductiveClosure can be used for several graph expansions. In other words, the expand function does not change any state.

For convenience, a second entry point to the package is provided in the form of a function called convert_graph, that expects a directory with various options, including a file name. The function parses the file, creates the expanded graph, and serializes the result into RDF/XML or Turtle. This function is particularly useful as an entry point for a CGI call (where the HTML form parameters are in a directory) and is easy to use with a command line interface. The package distribution contains an example for both.

There are major closure type (ie, semantic closure possibilities); these can be controlled through the appropriate parameters of the DeductiveClosure class:

In all three cases there are other dimensions that can control the exact closure being generated:

  • for convenience, the so called axiomatic triples (see, eg, the axiomatic triples in RDFS) are, by default, not added to the graph closure to reduce the number of generated triples. These can be controlled through a separate initialization argument
  • similarly, the axiomatic triples for D-entailment are separated

Some Technical/implementation aspects

The core processing is done in the in the Core class, which is subclassed by the RDFS and the OWL 2 RL classes (these two are then, on their turn, subclassed by the RDFS + OWL 2 RL Semantics) class). The core implements the core functionality of cycling through the rules, whereas the rules themselves are defined and implemented in the subclasses. There are also methods that are executed only once either at the beginning or at the end of the full processing cycle. Adding axiomatic triples is handled separately, which allows a finer user control over these features.

Literals must be handled separately. Indeed, the functionality relies on 'extended' RDF graphs, that allows literals to be in a subject position, too. Because RDFLib does not allow that, processing begins by exchanging all literals in the graph for bnodes (identical literals get the same associated bnode). Processing occurs on these bnodes; at the end of the process all these bnodes are replaced by their corresponding literals if possible (if the bnode occurs in a subject position, that triple is removed from the resulting graph). Details of this processing is handled in the separate Literals Proxies class.

The OWL specification includes references to datatypes that are not in the core RDFS specification, consequently not directly implemented by RDFLib. These are added in a separate module of the package.

Problems with Literals with datatypes

The current distribution of RDFLib is fairly poor in handling datatypes, particularly in checking whether a lexical form of a literal is "proper" as for its declared datatype. A typical example is:

 "-1234"^^xsd:nonNegativeInteger

which should not be accepted as valid literal. Because the requirements of OWL 2 RL are much stricter in this respect, an alternative set of datatype handling (essentially, conversions) had to be implemented (see the XsdDatatypes module).

The DeductiveClosure class has an additional instance variable whether the default RDFLib conversion routines should be exchanged against the new ones. If this flag is set to True and instance creation (this is the default), then the conversion routines are set back to the originals once the expansion is complete, thereby avoiding to influence older application that may not work properly with the new set of conversion routines.

If the user wants to use these alternative lexical conversions everywhere in the application, then the use_improved_datatypes_conversions method can be invoked. That method changes the conversion routines and, from that point on, all usage of DeductiveClosure instances will use the improved conversion methods without resetting them. Ie, the code structure can be something like:

 DeductiveClosure().use_improved_datatypes_conversions()
 ... RDFLib application
 DeductiveClosure().expand(graph)
 ...

The default situation can be set back using the use_rdflib_datatypes_conversions call.

It is, however, not required to use these methods at all. Ie, the user can use:

 DeductiveClosure(improved_datatypes=False).expand(graph)

which will result in a proper graph expansion except for the datatype specific comparisons which will be incomplete.

Problems with Literals with datatypes

The current distribution of RDFLib is fairly poor in handling datatypes, particularly in checking whether a lexical form of a literal is "proper" as for its declared datatype. A typical example is:

 "-1234"^^xsd:nonNegativeInteger

which should not be accepted as valid literal. Because the requirements of OWL 2 RL are much stricter in this respect, an alternative set of datatype handling (essentially, conversions) had to be implemented (see the XsdDatatypes module).

The DeductiveClosure class has an additional instance variable whether the default RDFLib conversion routines should be exchanged against the new ones. If this flag is set to True and instance creation (this is the default), then the conversion routines are set back to the originals once the expansion is complete, thereby avoiding to influence older application that may not work properly with the new set of conversion routines.

If the user wants to use these alternative lexical conversions everywhere in the application, then the use_improved_datatypes_conversions method can be invoked. That method changes the conversion routines and, from that point on, all usage of DeductiveClosure instances will use the improved conversion methods without resetting them. Ie, the code structure can be something like:

 DeductiveClosure().use_improved_datatypes_conversions()
 ... RDFLib application
 DeductiveClosure().expand(graph)
 ...

The default situation can be set back using the use_rdflib_datatypes_conversions call.

It is, however, not required to use these methods at all. Ie, the user can use:

 DeductiveClosure(improved_datatypes=False).expand(graph)

which will result in a proper graph expansion except for the datatype specific comparisons which will be incomplete.


Requires:

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

Organization: World Wide Web Consortium

Author: Ivan Herman

Version: 5.0

Contact: Ivan Herman, ivan@w3.org

Submodules [hide private]

Classes [hide private]
  DeductiveClosure
Entry point to generate the deductive closure of a graph.
Functions [hide private]
 
__parse_input(iformat, inp, graph)
Parse the input into the graph, possibly checking the suffix for the format.
source code
 
interpret_owl_imports(iformat, graph)
Interpret the owl import statements.
source code
Class type
return_closure_class(owl_closure, rdfs_closure, owl_extras, trimming=False)
Return the right semantic extension class based on three possible choices (this method is here to help potential users, the result can be fed into a DeductiveClosure instance at initialization)
source code
 
convert_graph(options, closureClass=None)
Entry point for external scripts (CGI or command line) to parse an RDF file(s), possibly execute OWL and/or RDFS closures, and serialize back the result in some format.
source code
Variables [hide private]
  __author__ = 'Ivan Herman'
  __license__ = u'W3C® SOFTWARE NOTICE AND LICENSE, http://www.w...
  RDFXML = 'xml'
  TURTLE = 'turtle'
  JSON = 'json'
  AUTO = 'auto'
  RDFA = 'rdfa'
  NONE = 'none'
  RDF = 'rdf'
  RDFS = 'rdfs'
  OWL = 'owl'
  FULL = 'full'
  json_ld_available = True
  __package__ = 'RDFClosure'

Imports: StringIO, IntType, TypeType, BooleanType, CodeType, UnboundMethodType, StringType, BuiltinMethodType, FloatType, DictionaryType, NotImplementedType, BuiltinFunctionType, DictProxyType, GeneratorType, InstanceType, ObjectType, DictType, GetSetDescriptorType, FileType, EllipsisType, StringTypes, ListType, MethodType, TupleType, ModuleType, FrameType, LongType, BufferType, TracebackType, ClassType, MemberDescriptorType, UnicodeType, SliceType, ComplexType, LambdaType, FunctionType, XRangeType, NoneType, rdflib, rdflibLiteral, Graph, DatatypeHandling, Closure, OWLRL_Extension, OWLRL_Extension_Trimming, OWLRL_Semantics, RDFS_Semantics, RDFS_OWLRL_Semantics, imports, JsonLDParser, JsonLDSerializer, register, Serializer, Parser, AxiomaticTriples, CombinedClosure, Literals, OWLRL, OWLRLExtras, RDFSClosure, RestrictedDatatype, XsdDatatypes


Function Details [hide private]

__parse_input(iformat, inp, graph)

source code 

Parse the input into the graph, possibly checking the suffix for the format.

Parameters:
  • iformat - input format; can be one of AUTO, TURTLE, or RDFXML. AUTO means that the suffix of the file name or URI will decide: '.ttl' means Turtle, RDF/XML otherwise.
  • inp - input file; anything that RDFLib accepts in that position (URI, file name, file object). If '-', standard input is used.
  • graph - the RDFLib Graph instance to parse into.

interpret_owl_imports(iformat, graph)

source code 

Interpret the owl import statements. Essentially, recursively merge with all the objects in the owl import statement, and remove the corresponding triples from the graph.

This method can be used by an application prior to expansion. It is not done by the the DeductiveClosure class.

Parameters:
  • iformat - input format; can be one of AUTO, TURTLE, or RDFXML. AUTO means that the suffix of the file name or URI will decide: '.ttl' means Turtle, RDF/XML otherwise.
  • graph - the RDFLib Graph instance to parse into.

return_closure_class(owl_closure, rdfs_closure, owl_extras, trimming=False)

source code 

Return the right semantic extension class based on three possible choices (this method is here to help potential users, the result can be fed into a DeductiveClosure instance at initialization)

Parameters:
  • owl_closure (boolean) - whether OWL 2 RL deductive closure should be calculated
  • rdfs_closure (boolean) - whether RDFS deductive closure should be calculated. In case owl_closure==True, this parameter should also be used in the initialization of DeductiveClosure
  • owl_extras - whether the extra possibilities (rational datatype, etc) should be added to an OWL 2 RL deductive closure. This parameter has no effect in case owl_closure==False.
  • trimming - whether extra trimming is done on the OWL RL + Extension output
Returns: Class type
deductive class reference or None

convert_graph(options, closureClass=None)

source code 

Entry point for external scripts (CGI or command line) to parse an RDF file(s), possibly execute OWL and/or RDFS closures, and serialize back the result in some format. Note that this entry point can be used requiring no entailment at all; because both the input and the output format for the package can be RDF/XML or Turtle, such usage would simply mean a format conversion.

If OWL 2 RL processing is required, that also means that the owl:imports statements are interpreted. Ie, ontologies can be spread over several files. Note, however, that the output of the process would then include all imported ontologies, too.

Parameters:
  • options - object with specific attributes, namely:
    • options.sources: list of uris or file names for the source data; for each one if the name ends with 'ttl', it is considered to be turtle, RDF/XML otherwise (this can be overwritten by the options.iformat, though)
    • options.text: direct Turtle encoding of a graph as a text string (useful, eg, for a CGI call using a text field)
    • options.owlClosure: can be yes or no
    • options.rdfsClosure: can be yes or no
    • options.owlExtras: can be yes or no; whether the extra rules beyond OWL 2 RL are used or not.
    • options.axioms: whether relevant axiomatic triples are added before chaining (can be a boolean, or the strings "yes" or "no")
    • options.daxioms: further datatype axiomatic triples are added to the output (can be a boolean, or the strings "yes" or "no")
    • options.format: output format, can be "turtle" or "rdfxml"
    • options.iformat: input format, can be "turtle", "rdfa", "json", "rdfxml", or "auto". "auto" means that the suffix of the file is considered: '.ttl'. '.html', 'json' or '.jsonld' respectively with 'xml' as a fallback
    • options.trimming: whether the extension to OWLRL should also include trimming
  • closureClass - explicit class reference. If set, this overrides the various different other options to be used as an extension.

Variables Details [hide private]

__license__

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

OWL-RL-7.1.4/Doc_OLD/RDFClosure-pysrc.html000066400000000000000000003546031504201166100177050ustar00rootroot00000000000000 RDFClosure
Package RDFClosure
[hide private]
[frames] | no frames]

Source Code for Package RDFClosure

  1  # -*- coding: utf-8 -*- 
  2  # 
  3  """ 
  4  This module is brute force implementation of the 'finite' version of U{RDFS semantics<http://www.w3.org/TR/rdf-mt/>} 
  5  and of U{OWL 2 RL<http://www.w3.org/TR/owl2-profiles/#Reasoning_in_OWL_2_RL_and_RDF_Graphs_using_Rules>} 
  6  on the top of RDFLib (with some caveats, see below). Some extensions to these are also implemented. 
  7  Brute force means that, in all cases, simple forward chaining rules are used to extend (recursively) the incoming graph with all triples 
  8  that the rule sets permit (ie, the "deductive closure" of the graph is computed). 
  9  There is an extra options whether the axiomatic triples are added to the graph (prior to the forward chaining step). 
 10  These, typically set the domain and range for properties or define some core classes. 
 11  In the case of RDFS, the implementation uses a 'finite' version of the axiomatic triples only (as proposed, for example, 
 12  by Herman ter Horst). This means that it adds only those C{rdf:_i} type predicates that do appear in the original graph, 
 13  thereby keeping this step finite. For OWL 2 RL, OWL 2 does not define axiomatic triples formally; but they can be deduced from the 
 14  U{OWL 2 RDF Based Semantics<http://www.w3.org/TR/owl2-rdf-based-semantics/>} document and are listed in Appendix 6 (though informally). 
 15  Note, however, that this implementation adds only those triples that refer to OWL terms that are meaningful for the OWL 2 RL case. 
 16   
 17   
 18  Package Entry Points 
 19  ==================== 
 20   
 21  The main entry point to the package is via the L{DeductiveClosure<DeductiveClosure>} class. This class should be initialized to control 
 22  the parameters of the deductive closure; the forward chaining is done via the L{expand<DeductiveClosure.expand>} method. 
 23  The simplest way to use the package from an RDFLib application is as follows:: 
 24   
 25          graph = Graph()                                 # creation of an RDFLib graph 
 26          ... 
 27          ...                                             # normal RDFLib application, eg, parsing RDF data 
 28          ... 
 29          DeductiveClosure(OWLRL_Semantics).expand(graph) # calculate an OWL 2 RL deductive closure of graph 
 30                                                          # without axiomatic triples 
 31   
 32  The first argument of the C{DeductiveClosure} initialization can be replaced by other classes, providing different 
 33  types of deductive closure; other arguments are also possible. For example:: 
 34   
 35   DeductiveClosure(OWLRL_Extension, rdfs_closure = True, axiomatic_triples = True, datatype_axioms = True).expand(graph) 
 36   
 37  will calculate the deductive closure including RDFS and some extensions to OWL 2 RL, and with all possible axiomatic 
 38  triples added to the graph (this is about the maximum the package can do…) 
 39   
 40  The same instance of L{DeductiveClosure<DeductiveClosure>} can be used for several graph expansions. In other words, the expand function does not change any state. 
 41   
 42  For convenience, a second entry point to the package is provided in the form of a function called L{convert_graph<convert_graph>}, 
 43  that expects a directory with various options, including a file name. The function parses the file, creates the expanded graph, and serializes the result into RDF/XML or 
 44  Turtle. This function is particularly useful as an entry point for a CGI call (where the HTML form parameters are in a directory) and 
 45  is easy to use with a command line interface. The package distribution contains an example for both. 
 46   
 47  There are major closure type (ie, semantic closure possibilities); these can be controlled through the appropriate 
 48  parameters of the L{DeductiveClosure<DeductiveClosure>} class: 
 49   
 50          - using the L{RDFS_Semantics<RDFSClosure.RDFS_Semantics>} class, implementing the U{RDFS semantics<http://www.w3.org/TR/rdf-mt/>} 
 51          - using the L{OWLRL_Semantics<OWLRL.OWLRL_Semantics>} class, implementing the U{OWL 2 RL<http://www.w3.org/TR/owl2-profiles/#Reasoning_in_OWL_2_RL_and_RDF_Graphs_using_Rules>} 
 52          - using L{RDFS_OWLRL_Semantics<CombinedClosure.RDFS_OWLRL_Semantics>} class, implementing a combined semantics of U{RDFS semantics<http://www.w3.org/TR/rdf-mt/>} and U{OWL 2 RL<http://www.w3.org/TR/owl2-profiles/#Reasoning_in_OWL_2_RL_and_RDF_Graphs_using_Rules>} 
 53   
 54  In all three cases there are other dimensions that can control the exact closure being generated: 
 55   
 56   - for convenience, the so called axiomatic triples (see, eg, the U{axiomatic triples in RDFS<http://www.w3.org/TR/rdf-mt/#rdfs_interp>}) are, by default, I{not} added to the graph closure to reduce the number of generated triples. These can be controlled through a separate initialization argument 
 57   - similarly, the axiomatic triples for D-entailment are separated 
 58   
 59  Some Technical/implementation aspects 
 60  ===================================== 
 61   
 62  The core processing is done in the in the L{Core<Closure.Core>} class, which is subclassed by the L{RDFS<RDFS_Semantics>} and 
 63  the L{OWL 2 RL<OWLRL_Semantics>} classes (these two are then, on their turn, subclassed by the 
 64  L{RDFS + OWL 2 RL Semantics<CombinedClosure.RDFS_OWLRL_Semantics>}) class). The core implements the core functionality of cycling 
 65  through the rules, whereas the rules themselves are defined and implemented in the subclasses. There are also methods that are executed only once either 
 66  at the beginning or at the end of the full processing cycle. Adding axiomatic triples is handled separately, which allows a finer user control over 
 67  these features. 
 68   
 69  Literals must be handled separately. Indeed, the functionality relies on 'extended' RDF graphs, that allows literals 
 70  to be in a subject position, too. Because RDFLib does not allow that, processing begins by exchanging all literals in the 
 71  graph for bnodes (identical literals get the same associated bnode). Processing occurs on these bnodes; at the end of the process 
 72  all these bnodes are replaced by their corresponding literals if possible (if the bnode occurs in a subject position, that triple 
 73  is removed from the resulting graph). Details of this processing is handled in the separate L{Literals Proxies<RDFClosure.Literals.LiteralProxies>} 
 74  class. 
 75   
 76  The OWL specification includes references to datatypes that are not in the core RDFS specification, consequently not 
 77  directly implemented by RDFLib. These are added in a separate module of the package. 
 78   
 79   
 80  Problems with Literals with datatypes 
 81  ------------------------------------- 
 82   
 83  The current distribution of RDFLib is fairly poor in handling datatypes, particularly in checking whether a lexical form 
 84  of a literal is "proper" as for its declared datatype. A typical example is:: 
 85    "-1234"^^xsd:nonNegativeInteger 
 86  which should not be accepted as valid literal. Because the requirements of OWL 2 RL are much stricter in this respect, an alternative set of datatype handling (essentially, conversions) had to be implemented (see the L{XsdDatatypes} module). 
 87   
 88  The L{DeductiveClosure<DeductiveClosure>} class has an additional instance variable whether 
 89  the default RDFLib conversion routines should be exchanged against the new ones. If this flag is set to True and instance creation (this is 
 90  the default), then the conversion routines are set back 
 91  to the originals once the expansion is complete, thereby avoiding to influence older application that may not work properly with the 
 92  new set of conversion routines. 
 93   
 94  If the user wants to use these alternative lexical conversions everywhere in the application, then 
 95  the L{use_improved_datatypes_conversions<DeductiveClosure.use_improved_datatypes_conversions>} method can be invoked. That method changes 
 96  the conversion routines and, from that point on, all usage of L{DeductiveClosure<DeductiveClosure>} instances will use the 
 97  improved conversion methods without resetting them. Ie, the code structure can be something like:: 
 98    DeductiveClosure().use_improved_datatypes_conversions() 
 99    ... RDFLib application 
100    DeductiveClosure().expand(graph) 
101    ... 
102  The default situation can be set back using the L{use_rdflib_datatypes_conversions<DeductiveClosure.use_improved_datatypes_conversions>} call. 
103   
104  It is, however, not I{required} to use these methods at all. Ie, the user can use:: 
105    DeductiveClosure(improved_datatypes=False).expand(graph) 
106  which will result in a proper graph expansion except for the datatype specific comparisons which will be incomplete. 
107   
108   
109   
110  Problems with Literals with datatypes 
111  ------------------------------------- 
112   
113  The current distribution of RDFLib is fairly poor in handling datatypes, particularly in checking whether a lexical form 
114  of a literal is "proper" as for its declared datatype. A typical example is:: 
115    "-1234"^^xsd:nonNegativeInteger 
116  which should not be accepted as valid literal. Because the requirements of OWL 2 RL are much stricter in this respect, an alternative set of datatype handling (essentially, conversions) had to be implemented (see the L{XsdDatatypes} module). 
117   
118  The L{DeductiveClosure<DeductiveClosure>} class has an additional instance variable whether 
119  the default RDFLib conversion routines should be exchanged against the new ones. If this flag is set to True and instance creation (this is 
120  the default), then the conversion routines are set back 
121  to the originals once the expansion is complete, thereby avoiding to influence older application that may not work properly with the 
122  new set of conversion routines. 
123   
124  If the user wants to use these alternative lexical conversions everywhere in the application, then 
125  the L{use_improved_datatypes_conversions<DeductiveClosure.use_improved_datatypes_conversions>} method can be invoked. That method changes 
126  the conversion routines and, from that point on, all usage of L{DeductiveClosure<DeductiveClosure>} instances will use the 
127  improved conversion methods without resetting them. Ie, the code structure can be something like:: 
128    DeductiveClosure().use_improved_datatypes_conversions() 
129    ... RDFLib application 
130    DeductiveClosure().expand(graph) 
131    ... 
132  The default situation can be set back using the L{use_rdflib_datatypes_conversions<DeductiveClosure.use_improved_datatypes_conversions>} call. 
133   
134  It is, however, not I{required} to use these methods at all. Ie, the user can use:: 
135    DeductiveClosure(improved_datatypes=False).expand(graph) 
136  which will result in a proper graph expansion except for the datatype specific comparisons which will be incomplete. 
137   
138   
139  @requires: U{RDFLib<https://github.com/RDFLib/rdflib>}, 4.0.0 and higher 
140  @requires: U{rdflib_jsonld<https://github.com/RDFLib/rdflib-jsonld>} 
141  @license: This software is available for use under the U{W3C Software License<http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231>} 
142  @organization: U{World Wide Web Consortium<http://www.w3.org>} 
143  @author: U{Ivan Herman<a href="http://www.w3.org/People/Ivan/">} 
144   
145  """ 
146   
147   
148  # Examples: LangString is disjoint from String 
149  __version__ = "5.0" 
150  __author__ = 'Ivan Herman' 
151  __contact__ = 'Ivan Herman, ivan@w3.org' 
152  __license__ = u'W3C® SOFTWARE NOTICE AND LICENSE, http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231' 
153   
154  import StringIO 
155  from types import * 
156   
157  # noinspection PyPackageRequirements,PyPackageRequirements,PyPackageRequirements 
158  import rdflib 
159   
160  from rdflib import Literal as rdflibLiteral 
161  # noinspection PyPep8Naming 
162  from rdflib import Graph 
163   
164  import DatatypeHandling, Closure 
165  from OWLRLExtras import OWLRL_Extension, OWLRL_Extension_Trimming 
166  from OWLRL import OWLRL_Semantics 
167  from RDFSClosure import RDFS_Semantics 
168  from CombinedClosure import RDFS_OWLRL_Semantics 
169  from OWL import imports 
170   
171  ################################################################################################################ 
172  RDFXML = "xml" 
173  TURTLE = "turtle" 
174  JSON   = "json" 
175  AUTO   = "auto" 
176  RDFA   = "rdfa" 
177   
178  NONE = "none" 
179  RDF  = "rdf" 
180  RDFS = "rdfs" 
181  OWL  = "owl" 
182  FULL = "full" 
183   
184  try: 
185          from rdflib_jsonld.parser import JsonLDParser 
186          from rdflib_jsonld.serializer import JsonLDSerializer 
187          from rdflib.plugin import register, Serializer, Parser 
188          register('json-ld', Parser, 'rdflib_jsonld.parser', 'JsonLDParser') 
189          register('json-ld', Serializer, 'rdflib_jsonld.serializer', 'JsonLDSerializer') 
190          json_ld_available = True 
191  except: 
192          json_ld_available = False 
193 194 195 ################################################################################################################ 196 197 # noinspection PyShadowingBuiltins 198 -def __parse_input(iformat, inp, graph):
199 """Parse the input into the graph, possibly checking the suffix for the format. 200 201 @param iformat: input format; can be one of L{AUTO}, L{TURTLE}, or L{RDFXML}. L{AUTO} means that the suffix of the file name or URI will decide: '.ttl' means Turtle, RDF/XML otherwise. 202 @param inp: input file; anything that RDFLib accepts in that position (URI, file name, file object). If '-', standard input is used. 203 @param graph: the RDFLib Graph instance to parse into. 204 """ 205 if iformat == AUTO: 206 if inp == "-": 207 format = "turtle" 208 else: 209 if inp.endswith('.ttl') or inp.endswith('.n3'): 210 format = "turtle" 211 elif json_ld_available and (inp.endswith('.json') or inp.endswith('.jsonld')): 212 format = "json-ld" 213 elif inp.endswith('.html'): 214 format = "rdfa1.1" 215 else: 216 format = "xml" 217 elif iformat == TURTLE: 218 format = "n3" 219 elif iformat == RDFA: 220 format = "rdfa1.1" 221 elif iformat == RDFXML: 222 format = "xml" 223 elif iformat == JSON: 224 if json_ld_available: 225 format="json-ld" 226 else: 227 raise Exception("JSON-LD parser is not available") 228 else : 229 raise Exception("Unknown input syntax") 230 231 if inp == "-": 232 # standard input is used 233 import sys 234 source = sys.stdin 235 else : 236 source = inp 237 graph.parse(source, format=format)
238
239 240 -def interpret_owl_imports(iformat, graph):
241 """Interpret the owl import statements. Essentially, recursively merge with all the objects in the owl import statement, and remove the corresponding 242 triples from the graph. 243 244 This method can be used by an application prior to expansion. It is I{not} done by the the L{DeductiveClosure} class. 245 246 @param iformat: input format; can be one of L{AUTO}, L{TURTLE}, or L{RDFXML}. L{AUTO} means that the suffix of the file name or URI will decide: '.ttl' means Turtle, RDF/XML otherwise. 247 @param graph: the RDFLib Graph instance to parse into. 248 """ 249 while True: 250 #1. collect the import statements: 251 all_imports = [t for t in graph.triples((None, imports, None))] 252 if len(all_imports) == 0 : 253 # no import statement whatsoever, we can go on... 254 return 255 #2. remove all the import statements from the graph 256 for t in all_imports : graph.remove(t) 257 #3. get all the imported vocabularies and import them 258 for (s, p, uri) in all_imports : 259 # this is not 100% kosher. The expected object for an import statement is a URI. However, 260 # on local usage, a string would also make sense, so I do that one, too 261 if isinstance(uri, rdflibLiteral): 262 __parse_input(iformat, str(uri), graph) 263 else : 264 __parse_input(iformat, uri, graph)
265 #4. start all over again to see if import statements have been imported
266 267 268 -def return_closure_class(owl_closure, rdfs_closure, owl_extras, trimming=False):
269 """ 270 Return the right semantic extension class based on three possible choices (this method is here to help potential users, the result can be 271 fed into a L{DeductiveClosure} instance at initialization) 272 @param owl_closure: whether OWL 2 RL deductive closure should be calculated 273 @type owl_closure: boolean 274 @param rdfs_closure: whether RDFS deductive closure should be calculated. In case C{owl_closure==True}, this parameter should also be used in the initialization of L{DeductiveClosure} 275 @type rdfs_closure: boolean 276 @param owl_extras: whether the extra possibilities (rational datatype, etc) should be added to an OWL 2 RL deductive closure. This parameter has no effect in case C{owl_closure==False}. 277 @param trimming : whether extra trimming is done on the OWL RL + Extension output 278 @return: deductive class reference or None 279 @rtype: Class type 280 """ 281 if owl_closure: 282 if owl_extras: 283 if trimming: 284 return OWLRL_Extension_Trimming 285 else : 286 return OWLRL_Extension 287 else : 288 if rdfs_closure: 289 return RDFS_OWLRL_Semantics 290 else : 291 return OWLRL_Semantics 292 elif rdfs_closure: 293 return RDFS_Semantics 294 else : 295 return None
296
297 298 # noinspection PyCallingNonCallable 299 -class DeductiveClosure:
300 """ 301 Entry point to generate the deductive closure of a graph. The exact choice deductive 302 closure is controlled by a class reference. The important initialization parameter is the C{closure_class}: a Class object referring to a 303 subclass of L{Closure.Core}. Although this package includes a number of 304 such subclasses (L{OWLRL_Semantics}, L{RDFS_Semantics}, L{RDFS_OWLRL_Semantics}, and L{OWLRL_Extension}), the user can use his/her own if additional rules are 305 implemented. 306 307 Note that owl:imports statements are I{not} interpreted in this class, that has to be done beforehand on the graph that is to be expanded. 308 309 @ivar rdfs_closure: Whether the RDFS closure should also be executed. Default: False. 310 @type rdfs_closure: boolean 311 @ivar axiomatic_triples: Whether relevant axiomatic triples are added before chaining, except for datatype axiomatic triples. Default: False. 312 @type axiomatic_triples: boolean 313 @ivar datatype_axioms: Whether further datatype axiomatic triples are added to the output. Default: false. 314 @type datatype_axioms: boolean 315 @ivar closure_class: the class instance used to expand the graph 316 @type closure_class: L{Closure.Core} 317 @cvar improved_datatype_generic: Whether the improved set of lexical-to-Python conversions should be used for datatype handling I{in general}, ie, not only for a particular instance and not only for inference purposes. Default: False. 318 @type improved_datatype_generic: boolean 319 """ 320 improved_datatype_generic = False 321
322 - def __init__(self, closure_class, improved_datatypes=True, rdfs_closure=False, axiomatic_triples=False, datatype_axioms=False) :
323 """ 324 @param closure_class: a closure class reference. 325 @type closure_class: subclass of L{Closure.Core} 326 @param rdfs_closure: whether RDFS rules are executed or not 327 @type rdfs_closure: boolean 328 @param axiomatic_triples: Whether relevant axiomatic triples are added before chaining, except for datatype axiomatic triples. Default: False. 329 @type axiomatic_triples: boolean 330 @param datatype_axioms: Whether further datatype axiomatic triples are added to the output. Default: false. 331 @type datatype_axioms: boolean 332 @param improved_datatypes: Whether the improved set of lexical-to-Python conversions should be used for datatype handling. See the introduction for more details. Default: True. 333 @type improved_datatypes: boolean 334 """ 335 if closure_class is None : 336 self.closure_class = None 337 else : 338 if not isinstance(closure_class, ClassType): 339 raise ValueError("The closure type argument must be a class reference") 340 else : 341 self.closure_class = closure_class 342 self.axiomatic_triples = axiomatic_triples 343 self.datatype_axioms = datatype_axioms 344 self.rdfs_closure = rdfs_closure 345 self.improved_datatypes = improved_datatypes
346
347 - def expand(self, graph) :
348 """ 349 Expand the graph using forward chaining, and with the relevant closure type. 350 @param graph: the RDF graph 351 @type graph: rdflib.Graph 352 """ 353 if (not DeductiveClosure.improved_datatype_generic) and self.improved_datatypes: 354 DatatypeHandling.use_Alt_lexical_conversions() 355 356 if self.closure_class is not None: 357 self.closure_class(graph, self.axiomatic_triples, self.datatype_axioms, self.rdfs_closure).closure() 358 359 if (not DeductiveClosure.improved_datatype_generic) and self.improved_datatypes: 360 DatatypeHandling.use_RDFLib_lexical_conversions()
361 362 @staticmethod
364 """ 365 Switch the system to use the improved datatype conversion routines. 366 """ 367 DeductiveClosure.improved_datatype_generic = True 368 DatatypeHandling.use_Alt_lexical_conversions()
369 370 @staticmethod
372 """ 373 Switch the system to use the generic (RDFLib) datatype conversion routines 374 """ 375 DeductiveClosure.improved_datatype_generic = False 376 DatatypeHandling.use_RDFLib_lexical_conversions()
377
378 ############################################################################################################### 379 380 381 # noinspection PyPep8Naming,PyBroadException,PyBroadException,PyBroadException 382 -def convert_graph(options, closureClass=None) :
383 """ 384 Entry point for external scripts (CGI or command line) to parse an RDF file(s), possibly execute OWL and/or RDFS closures, 385 and serialize back the result in some format. 386 Note that this entry point can be used requiring no entailment at all; 387 because both the input and the output format for the package can be RDF/XML or Turtle, such usage would 388 simply mean a format conversion. 389 390 If OWL 2 RL processing is required, that also means that the owl:imports statements are interpreted. Ie, 391 ontologies can be spread over several files. Note, however, that the output of the process would then include all 392 imported ontologies, too. 393 394 @param options: object with specific attributes, namely: 395 - options.sources: list of uris or file names for the source data; for each one if the name ends with 'ttl', it is considered to be turtle, RDF/XML otherwise (this can be overwritten by the options.iformat, though) 396 - options.text: direct Turtle encoding of a graph as a text string (useful, eg, for a CGI call using a text field) 397 - options.owlClosure: can be yes or no 398 - options.rdfsClosure: can be yes or no 399 - options.owlExtras: can be yes or no; whether the extra rules beyond OWL 2 RL are used or not. 400 - options.axioms: whether relevant axiomatic triples are added before chaining (can be a boolean, or the strings "yes" or "no") 401 - options.daxioms: further datatype axiomatic triples are added to the output (can be a boolean, or the strings "yes" or "no") 402 - options.format: output format, can be "turtle" or "rdfxml" 403 - options.iformat: input format, can be "turtle", "rdfa", "json", "rdfxml", or "auto". "auto" means that the suffix of the file is considered: '.ttl'. '.html', 'json' or '.jsonld' respectively with 'xml' as a fallback 404 - options.trimming: whether the extension to OWLRL should also include trimming 405 @param closureClass: explicit class reference. If set, this overrides the various different other options to be used as an extension. 406 """ 407 408 def __check_yes_or_true(opt) : 409 return opt is True or opt == "yes" or opt == "Yes" or opt == "True" or opt == "true"
410 411 import warnings 412 413 warnings.filterwarnings("ignore") 414 if len(options.sources) == 0 and (options.text is None or len(options.text.strip()) == 0) : 415 raise Exception("No graph specified either via a URI or text") 416 417 graph = Graph() 418 419 # Just to be sure that this attribute does not create issues with older versions of the service... 420 # the try statement should be removed, eventually... 421 iformat = AUTO 422 try : 423 iformat = options.iformat 424 except : 425 # exception can be raised if that attribute is not used at all, true for older versions 426 pass 427 428 # similar measure with the possible usage of the 'source' options 429 try : 430 if options.source is not None: 431 options.sources.append(options.source) 432 except: 433 # exception can be raised if that attribute is not used at all, true for newer versions 434 pass 435 436 # Get the sources first. Note that a possible error is filtered out, namely to process the same file twice. This is done 437 # by turning the input arguments into a set... 438 for inp in set(options.sources): 439 __parse_input(iformat, inp, graph) 440 441 # add the possible extra text (ie, the text input on the HTML page) 442 if options.text is not None: 443 graph.parse(StringIO.StringIO(options.text), format="n3") 444 445 # Get all the options right 446 # noinspection PyPep8Naming 447 owlClosure = __check_yes_or_true(options.owlClosure) 448 # noinspection PyPep8Naming 449 rdfsClosure = __check_yes_or_true(options.rdfsClosure) 450 # noinspection PyPep8Naming 451 owlExtras = __check_yes_or_true(options.owlExtras) 452 try: 453 trimming = __check_yes_or_true(options.trimming) 454 except : 455 trimming = False 456 axioms = __check_yes_or_true(options.axioms) 457 daxioms = __check_yes_or_true(options.daxioms) 458 459 if owlClosure: 460 interpret_owl_imports(iformat, graph) 461 462 # adds to the 'beauty' of the output 463 graph.bind("owl", "http://www.w3.org/2002/07/owl#") 464 graph.bind("xsd", "http://www.w3.org/2001/XMLSchema#") 465 466 #@@@@ some smarter choice should be used later to decide what the closure class is!!! That should 467 # also control the import management. Eg, if the superclass includes OWL... 468 if closureClass is not None : 469 closure_class = closureClass 470 else : 471 closure_class = return_closure_class(owlClosure, rdfsClosure, owlExtras, trimming) 472 473 DeductiveClosure(closure_class, improved_datatypes=True, rdfs_closure=rdfsClosure, axiomatic_triples=axioms, datatype_axioms=daxioms).expand(graph) 474 475 if options.format == TURTLE: 476 return graph.serialize(format="turtle") 477 elif options.format == JSON: 478 if json_ld_available : 479 return graph.serialize(format="json-ld") 480 else: 481 raise Exception("JSON-LD serializer is not available") 482 else: 483 return graph.serialize(format="pretty-xml") 484

OWL-RL-7.1.4/Doc_OLD/RDFClosure.AxiomaticTriples-module.html000066400000000000000000003427721504201166100233160ustar00rootroot00000000000000 RDFClosure.AxiomaticTriples
Package RDFClosure :: Module AxiomaticTriples
[hide private]
[frames] | no frames]

Module AxiomaticTriples

source code

Axiomatic triples to be (possibly) added to the final graph.


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

Variables [hide private]
  __author__ = 'Ivan Herman'
  __license__ = u'W3C® SOFTWARE NOTICE AND LICENSE, http://www.w...
  _Simple_RDF_axiomatic_triples = [(rdflib.term.URIRef(u'http://...
  _RDFS_axiomatic_triples = [(rdflib.term.URIRef(u'http://www.w3...
  RDFS_Axiomatic_Triples = [(rdflib.term.URIRef(u'http://www.w3....
  RDFS_D_Axiomatic_Triples_subclasses = [(rdflib.term.URIRef(u'h...
  RDFS_D_Axiomatic_Triples_types = [(rdflib.term.URIRef(u'http:/...
  RDFS_D_Axiomatic_Triples = [(rdflib.term.URIRef(u'http://www.w...
  _OWL_axiomatic_triples_Classes = [(rdflib.term.URIRef(u'http:/...
  _OWL_axiomatic_triples_Properties = [(rdflib.term.URIRef(u'htt...
  OWLRL_Axiomatic_Triples = [(rdflib.term.URIRef(u'http://www.w3...
  _OWL_axiomatic_triples_Facets = [(rdflib.term.URIRef(u'http://...
  _OWL_D_Axiomatic_Triples_types = [(rdflib.term.URIRef(u'http:/...
  OWL_D_Axiomatic_Triples_subclasses = [(rdflib.term.URIRef(u'ht...
  OWLRL_Datatypes_Disjointness = [(rdflib.term.URIRef(u'http://w...
  OWLRL_D_Axiomatic_Triples = [(rdflib.term.URIRef(u'http://www....
  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...
  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/...
  DataRange = rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl...
  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#')
  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...
  ReflexiveProperty = rdflib.term.URIRef(u'http://www.w3.org/200...
  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...
  __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/...
  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...
  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/...
  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...
  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: rdflib, Seq, Bag, Alt, Statement, Property, XMLLiteral, List, ns_rdf, subject, predicate, object, type, value, first, rest, nil, Resource, Class, subClassOf, subPropertyOf, comment, label, domain, range, seeAlso, isDefinedBy, Literal, Container, ContainerMembershipProperty, member, Datatype, ns_xsd, Namespace


Variables Details [hide private]

__license__

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

_Simple_RDF_axiomatic_triples

Value:
[(rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#type\
'),
  rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#type\
'),
  rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#Prop\
erty')),
 (rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#subj\
ect'),
...

_RDFS_axiomatic_triples

Value:
[(rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#type\
'),
  rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#domain'),
  rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#Resource')\
),
 (rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#domain'),
  rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#domain'),
  rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#Prop\
...

RDFS_Axiomatic_Triples

Value:
[(rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#type\
'),
  rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#type\
'),
  rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#Prop\
erty')),
 (rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#subj\
ect'),
...

RDFS_D_Axiomatic_Triples_subclasses

Value:
[(rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#decimal'),
  rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#subClassOf\
'),
  rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#Literal'))\
,
 (rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#integer'),
  rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#subClassOf\
'),
...

RDFS_D_Axiomatic_Triples_types

Value:
[(rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#integer'),
  rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#type\
'),
  rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#Datatype')\
),
 (rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#decimal'),
  rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#type\
'),
...

RDFS_D_Axiomatic_Triples

Value:
[(rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#integer'),
  rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#type\
'),
  rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#Datatype')\
),
 (rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#decimal'),
  rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#type\
'),
...

_OWL_axiomatic_triples_Classes

Value:
[(rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#AllDifferent'),
  rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#type\
'),
  rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#Class')),
 (rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#AllDifferent'),
  rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#subClassOf\
'),
  rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#Resource')\
...

_OWL_axiomatic_triples_Properties

Value:
[(rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#allValuesFrom'),
  rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#type\
'),
  rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#Prop\
erty')),
 (rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#allValuesFrom'),
  rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#domain'),
  rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#Restriction')),
...

OWLRL_Axiomatic_Triples

Value:
[(rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#AllDifferent'),
  rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#type\
'),
  rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#Class')),
 (rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#AllDifferent'),
  rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#subClassOf\
'),
  rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#Resource')\
...

_OWL_axiomatic_triples_Facets

Value:
[(rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#length'),
  rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#type\
'),
  rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#Prop\
erty')),
 (rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#maxExclusive')\
,
  rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#type\
...

_OWL_D_Axiomatic_Triples_types

Value:
[(rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#Plai\
nLiteral'),
  rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#type\
'),
  rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#Datatype')\
)]

OWL_D_Axiomatic_Triples_subclasses

Value:
[(rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#string'),
  rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#subClassOf\
'),
  rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#Plai\
nLiteral')),
 (rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#normalizedStri\
ng'),
  rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#subClassOf\
...

OWLRL_Datatypes_Disjointness

Value:
[(rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#anyURI'),
  rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#disjointWith'),
  rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#base64Binary')\
),
 (rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#anyURI'),
  rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#disjointWith'),
  rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#boolean')),
 (rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#anyURI'), rdfl\
...

OWLRL_D_Axiomatic_Triples

Value:
[(rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#integer'),
  rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#type\
'),
  rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#Datatype')\
),
 (rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#decimal'),
  rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#type\
'),
...

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')

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')

DataRange

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

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')

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')

ReflexiveProperty

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

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'\
)

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')

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')

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')

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')

OWL-RL-7.1.4/Doc_OLD/RDFClosure.AxiomaticTriples-pysrc.html000066400000000000000000016174101504201166100231640ustar00rootroot00000000000000 RDFClosure.AxiomaticTriples
Package RDFClosure :: Module AxiomaticTriples
[hide private]
[frames] | no frames]

Source Code for Module RDFClosure.AxiomaticTriples

  1  #!/d/Bin/Python/python.exe 
  2  # -*- coding: utf-8 -*- 
  3  # 
  4  """ 
  5  Axiomatic triples to be (possibly) added to the final graph. 
  6   
  7  @requires: U{RDFLib<https://github.com/RDFLib/rdflib>}, 4.0.0 and higher 
  8  @license: This software is available for use under the U{W3C Software License<http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231>} 
  9  @organization: U{World Wide Web Consortium<http://www.w3.org>} 
 10  @author: U{Ivan Herman<a href="http://www.w3.org/People/Ivan/">} 
 11   
 12  """ 
 13   
 14  __author__  = 'Ivan Herman' 
 15  __contact__ = 'Ivan Herman, ivan@w3.org' 
 16  __license__ = u'W3C® SOFTWARE NOTICE AND LICENSE, http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231' 
 17   
 18  import rdflib 
 19  from RDFClosure.RDFS import Seq, Bag, Alt, Statement, Property, XMLLiteral, List 
 20  from RDFClosure.RDFS import RDFNS as ns_rdf 
 21  from RDFClosure.RDFS import subject, predicate, object, type, value, first, rest, nil 
 22  from RDFClosure.RDFS import Resource, Class, subClassOf, subPropertyOf, comment, label, domain, range 
 23  from RDFClosure.RDFS import seeAlso, isDefinedBy, Literal, Container, ContainerMembershipProperty, member, Datatype 
 24   
 25  from rdflib.namespace   import XSD as ns_xsd 
 26  from OWL import * 
 27   
 28  #: Simple RDF axiomatic triples (typing of subject, predicate, first, rest, etc) 
 29  _Simple_RDF_axiomatic_triples = [ 
 30          (type, type, Property), 
 31          (subject, type, Property), 
 32          (predicate, type, Property), 
 33          (object, type, Property), 
 34          (first, type, Property), 
 35          (rest, type, Property), 
 36          (value, type, Property), 
 37          (nil, type, List), 
 38  ] 
 39   
 40  #: RDFS axiomatic triples (domain and range, as well as class setting for a number of RDFS symbols) 
 41  _RDFS_axiomatic_triples = [ 
 42          (type, domain, Resource), 
 43          (domain, domain, Property), 
 44          (range, domain, Property), 
 45          (subPropertyOf, domain, Property), 
 46          (subClassOf, domain, Class), 
 47          (subject, domain, Statement), 
 48          (predicate, domain, Statement), 
 49          (object, domain, Statement), 
 50          (member, domain, Resource), 
 51          (first, domain, List), 
 52          (rest, domain, List), 
 53          (seeAlso, domain, Resource), 
 54          (isDefinedBy, domain, Resource), 
 55          (comment, domain, Resource), 
 56          (label, domain, Resource), 
 57          (value, domain, Resource), 
 58          (Property, type, Class), 
 59   
 60          (type, range, Class), 
 61          (domain, range, Class), 
 62          (range, range, Class), 
 63          (subPropertyOf, range, Property), 
 64          (subClassOf, range, Class), 
 65          (subject, range, Resource), 
 66          (predicate, range, Resource), 
 67          (object, range, Resource), 
 68          (member, range, Resource), 
 69          (first, range, Resource), 
 70          (rest, range, List), 
 71          (seeAlso, range, Resource), 
 72          (isDefinedBy, range, Resource), 
 73          (comment, range, Literal), 
 74          (label, range, Literal), 
 75          (value, range, Resource), 
 76   
 77          (Alt, subClassOf, Container), 
 78          (Bag, subClassOf, Container), 
 79          (Seq, subClassOf, Container), 
 80          (ContainerMembershipProperty, subClassOf, Property), 
 81   
 82          (isDefinedBy, subPropertyOf, seeAlso), 
 83   
 84          (XMLLiteral, type, Datatype), 
 85          (XMLLiteral, subClassOf, Literal), 
 86          (Datatype, subClassOf, Class), 
 87   
 88          # rdfs valid triples; these would be inferred by the RDFS expansion, but it may make things 
 89          # a bit faster to add these upfront 
 90          (Resource, type, Class), 
 91          (Class, type, Class), 
 92          (Literal, type, Class), 
 93          (XMLLiteral, type, Class), 
 94          (Datatype, type, Class), 
 95          (Seq, type, Class), 
 96          (Bag, type, Class), 
 97          (Alt, type, Class), 
 98          (Container, type, Class), 
 99          (List, type, Class), 
100          (ContainerMembershipProperty, type, Class), 
101          (Property, type, Class), 
102          (Statement, type, Class), 
103   
104          (domain, type, Property), 
105          (range, type, Property), 
106          (subPropertyOf, type, Property), 
107          (subClassOf, type, Property), 
108          (member, type, Property), 
109          (seeAlso, type, Property), 
110          (isDefinedBy, type, Property), 
111          (comment, type, Property), 
112          (label, type, Property) 
113  ] 
114   
115  #: RDFS Axiomatic Triples all together 
116  RDFS_Axiomatic_Triples    = _Simple_RDF_axiomatic_triples + _RDFS_axiomatic_triples 
117   
118  #: RDFS D-entailement triples, ie, possible subclassing of various datatypes 
119  RDFS_D_Axiomatic_Triples_subclasses = [ 
120          # See http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#built-in-datatypes 
121          (ns_xsd['decimal'], subClassOf, Literal), 
122   
123          (ns_xsd['integer'], subClassOf, ns_xsd['decimal']), 
124   
125          (ns_xsd['long'], subClassOf, ns_xsd['integer']), 
126          (ns_xsd['int'], subClassOf, ns_xsd['long']), 
127          (ns_xsd['short'], subClassOf, ns_xsd['int']), 
128          (ns_xsd['byte'], subClassOf, ns_xsd['short']), 
129   
130          (ns_xsd['nonNegativeInteger'], subClassOf, ns_xsd['integer']), 
131          (ns_xsd['positiveInteger'], subClassOf, ns_xsd['nonNegativeInteger']), 
132          (ns_xsd['unsignedLong'], subClassOf, ns_xsd['nonNegativeInteger']), 
133          (ns_xsd['unsignedInt'], subClassOf, ns_xsd['unsignedLong']), 
134          (ns_xsd['unsignedShort'], subClassOf, ns_xsd['unsignedInt']), 
135          (ns_xsd['unsignedByte'], subClassOf, ns_xsd['unsignedShort']), 
136   
137          (ns_xsd['nonPositiveInteger'], subClassOf, ns_xsd['integer']), 
138          (ns_xsd['negativeInteger'], subClassOf, ns_xsd['nonPositiveInteger']), 
139   
140          (ns_xsd['normalizedString'], subClassOf, ns_xsd['string']), 
141          (ns_xsd['token'], subClassOf, ns_xsd['normalizedString']), 
142          (ns_xsd['language'], subClassOf, ns_xsd['token']), 
143          (ns_xsd['Name'], subClassOf, ns_xsd['token']), 
144          (ns_xsd['NMTOKEN'], subClassOf, ns_xsd['token']), 
145   
146          (ns_xsd['NCName'], subClassOf, ns_xsd['Name']), 
147   
148          (ns_xsd['dateTimeStamp'], subClassOf, ns_xsd['dateTime']), 
149  ] 
150   
151  RDFS_D_Axiomatic_Triples_types = [ 
152          (ns_xsd['integer'], type, Datatype), 
153          (ns_xsd['decimal'], type, Datatype), 
154          (ns_xsd['nonPositiveInteger'], type, Datatype), 
155          (ns_xsd['nonPositiveInteger'], type, Datatype), 
156          (ns_xsd['positiveInteger'], type, Datatype), 
157          (ns_xsd['positiveInteger'], type, Datatype), 
158          (ns_xsd['long'], type, Datatype), 
159          (ns_xsd['int'], type, Datatype), 
160          (ns_xsd['short'], type, Datatype), 
161          (ns_xsd['byte'], type, Datatype), 
162          (ns_xsd['unsignedLong'], type, Datatype), 
163          (ns_xsd['unsignedInt'], type, Datatype), 
164          (ns_xsd['unsignedShort'], type, Datatype), 
165          (ns_xsd['unsignedByte'], type, Datatype), 
166          (ns_xsd['float'], type, Datatype), 
167          (ns_xsd['double'], type, Datatype), 
168          (ns_xsd['string'], type, Datatype), 
169          (ns_xsd['normalizedString'], type, Datatype), 
170          (ns_xsd['token'], type, Datatype), 
171          (ns_xsd['language'], type, Datatype), 
172          (ns_xsd['Name'], type, Datatype), 
173          (ns_xsd['NCName'], type, Datatype), 
174          (ns_xsd['NMTOKEN'], type, Datatype), 
175          (ns_xsd['boolean'], type, Datatype), 
176          (ns_xsd['hexBinary'], type, Datatype), 
177          (ns_xsd['base64Binary'], type, Datatype), 
178          (ns_xsd['anyURI'], type, Datatype), 
179          (ns_xsd['dateTimeStamp'], type, Datatype), 
180          (ns_xsd['dateTime'], type, Datatype), 
181          (Literal, type, Datatype), 
182          (XMLLiteral, type, Datatype), 
183  ] 
184   
185  RDFS_D_Axiomatic_Triples = RDFS_D_Axiomatic_Triples_types + RDFS_D_Axiomatic_Triples_subclasses 
186   
187  #: OWL Class axiomatic triples: definition of special classes 
188  _OWL_axiomatic_triples_Classes = [ 
189          (AllDifferent, type, Class), 
190          (AllDifferent, subClassOf, Resource), 
191   
192          (AllDisjointClasses, type, Class), 
193          (AllDisjointClasses, subClassOf, Resource), 
194   
195          (AllDisjointProperties, type, Class), 
196          (AllDisjointProperties, subClassOf, Resource), 
197   
198          (Annotation, type, Class), 
199          (Annotation, subClassOf, Resource), 
200   
201          (AnnotationProperty, type, Class), 
202          (AnnotationProperty, subClassOf, Property), 
203   
204          (AsymmetricProperty, type, Class), 
205          (AsymmetricProperty, subClassOf, Property), 
206   
207          (OWLClass, type, Class), 
208          (OWLClass, equivalentClass, Class), 
209   
210  #       (DataRange, type, Class), 
211  #       (DataRange, equivalentClass, Datatype), 
212   
213          (Datatype, type, Class), 
214   
215          (DatatypeProperty, type, Class), 
216          (DatatypeProperty, subClassOf, Property), 
217   
218          (DeprecatedClass, type, Class), 
219          (DeprecatedClass, subClassOf, Class), 
220   
221          (DeprecatedProperty, type, Class), 
222          (DeprecatedProperty, subClassOf, Property), 
223   
224          (FunctionalProperty, type, Class), 
225          (FunctionalProperty, subClassOf, Property), 
226   
227          (InverseFunctionalProperty, type, Class), 
228          (InverseFunctionalProperty, subClassOf, Property), 
229   
230          (IrreflexiveProperty, type, Class), 
231          (IrreflexiveProperty, subClassOf, Property), 
232   
233          (Literal, type, Datatype), 
234   
235  #       (NamedIndividual, type, Class), 
236  #       (NamedIndividual, equivalentClass, Resource), 
237   
238          (NegativePropertyAssertion, type, Class), 
239          (NegativePropertyAssertion, subClassOf, Resource), 
240   
241          (Nothing, type, Class), 
242          (Nothing, subClassOf, Thing ), 
243   
244          (ObjectProperty, type, Class), 
245          (ObjectProperty, equivalentClass, Property), 
246   
247          (Ontology, type, Class), 
248          (Ontology, subClassOf, Resource), 
249   
250          (OntologyProperty, type, Class), 
251          (OntologyProperty, subClassOf, Property), 
252   
253          (Property, type, Class), 
254   
255          (ReflexiveProperty, type, Class), 
256          (ReflexiveProperty, subClassOf, Property), 
257   
258          (Restriction, type, Class), 
259          (Restriction, subClassOf, Class), 
260   
261   
262          (SymmetricProperty, type, Class), 
263          (SymmetricProperty, subClassOf, Property), 
264   
265          (Thing, type, Class), 
266          (Thing, subClassOf, Resource), 
267   
268          (TransitiveProperty, type, Class), 
269          (TransitiveProperty, subClassOf, Property), 
270   
271          # OWL valid triples; some of these would be inferred by the OWL RL expansion, but it may make things 
272          # a bit faster to add these upfront 
273          (AllDisjointProperties, type, OWLClass), 
274          (AllDisjointClasses, type, OWLClass), 
275          (AllDisjointProperties, type, OWLClass), 
276          (Annotation, type, OWLClass), 
277          (AsymmetricProperty, type, OWLClass), 
278          (Axiom, type, OWLClass), 
279          (DataRange, type, OWLClass), 
280          (Datatype, type, OWLClass), 
281          (DatatypeProperty, type, OWLClass), 
282          (DeprecatedClass, type, OWLClass), 
283          (DeprecatedClass, subClassOf, OWLClass), 
284          (DeprecatedProperty, type, OWLClass), 
285          (FunctionalProperty, type, OWLClass), 
286          (InverseFunctionalProperty, type, OWLClass), 
287          (IrreflexiveProperty, type, OWLClass), 
288          (NamedIndividual, type, OWLClass), 
289          (NegativePropertyAssertion, type, OWLClass), 
290          (Nothing, type, OWLClass), 
291          (ObjectProperty, type, OWLClass), 
292          (Ontology, type, OWLClass), 
293          (OntologyProperty, type, OWLClass), 
294          (Property, type, OWLClass), 
295          (ReflexiveProperty, type, OWLClass), 
296          (Restriction, type, OWLClass), 
297          (Restriction, subClassOf, OWLClass), 
298  #       (SelfRestriction, type, OWLClass), 
299          (SymmetricProperty, type, OWLClass), 
300          (Thing, type, OWLClass), 
301          (TransitiveProperty, type, OWLClass), 
302  ] 
303   
304  #: OWL Property axiomatic triples: definition of domains and ranges 
305  _OWL_axiomatic_triples_Properties = [ 
306          (allValuesFrom, type, Property), 
307          (allValuesFrom, domain, Restriction), 
308          (allValuesFrom, range, Class), 
309   
310          (assertionProperty, type, Property), 
311          (assertionProperty, domain, NegativePropertyAssertion), 
312          (assertionProperty, range, Property), 
313   
314          (backwardCompatibleWith, type, OntologyProperty), 
315          (backwardCompatibleWith, type, AnnotationProperty), 
316          (backwardCompatibleWith, domain, Ontology), 
317          (backwardCompatibleWith, range, Ontology), 
318   
319  #       (bottomDataProperty, type, DatatypeProperty), 
320  # 
321  #       (bottomObjectProperty, type, ObjectProperty), 
322   
323  #       (cardinality, type, Property), 
324  #       (cardinality, domain, Restriction), 
325  #       (cardinality, range, ns_xsd["nonNegativeInteger"]), 
326   
327          (comment, type, AnnotationProperty), 
328          (comment, domain, Resource), 
329          (comment, range, Literal), 
330   
331          (complementOf, type, Property), 
332          (complementOf, domain, Class), 
333          (complementOf, range, Class), 
334   
335  # 
336  #       (datatypeComplementOf, type, Property), 
337  #       (datatypeComplementOf, domain, Datatype), 
338  #       (datatypeComplementOf, range, Datatype), 
339   
340          (deprecated, type, AnnotationProperty), 
341          (deprecated, domain, Resource), 
342          (deprecated, range, Resource), 
343   
344          (differentFrom, type, Property), 
345          (differentFrom, domain, Resource), 
346          (differentFrom, range, Resource), 
347   
348  #       (disjointUnionOf, type, Property), 
349  #       (disjointUnionOf, domain, Class), 
350  #       (disjointUnionOf, range, List), 
351   
352          (disjointWith, type, Property), 
353          (disjointWith, domain, Class), 
354          (disjointWith, range, Class), 
355   
356          (distinctMembers, type, Property), 
357          (distinctMembers, domain, AllDifferent), 
358          (distinctMembers, range, List), 
359   
360          (equivalentClass, type, Property), 
361          (equivalentClass, domain, Class), 
362          (equivalentClass, range, Class), 
363   
364          (equivalentProperty, type, Property), 
365          (equivalentProperty, domain, Property), 
366          (equivalentProperty, range, Property), 
367   
368          (hasKey, type, Property), 
369          (hasKey, domain, Class), 
370          (hasKey, range, List), 
371   
372          (hasValue, type, Property), 
373          (hasValue, domain, Restriction), 
374          (hasValue, range, Resource), 
375   
376          (imports, type, OntologyProperty), 
377          (imports, domain, Ontology), 
378          (imports, range, Ontology), 
379   
380          (incompatibleWith, type, OntologyProperty), 
381          (incompatibleWith, type, AnnotationProperty), 
382          (incompatibleWith, domain, Ontology), 
383          (incompatibleWith, range, Ontology), 
384   
385          (intersectionOf, type, Property), 
386          (intersectionOf, domain, Class), 
387          (intersectionOf, range, List), 
388   
389          (inverseOf, type, Property), 
390          (inverseOf, domain, Property), 
391          (inverseOf, range, Property), 
392   
393          (isDefinedBy, type, AnnotationProperty), 
394          (isDefinedBy, domain, Resource), 
395          (isDefinedBy, range, Resource), 
396   
397          (label, type, AnnotationProperty), 
398          (label, domain, Resource), 
399          (label, range, Literal), 
400   
401          (maxCardinality, type, Property), 
402          (maxCardinality, domain, Restriction), 
403          (maxCardinality, range, ns_xsd["nonNegativeInteger"]), 
404   
405          (maxQualifiedCardinality, type, Property), 
406          (maxQualifiedCardinality, domain, Restriction), 
407          (maxQualifiedCardinality, range, ns_xsd["nonNegativeInteger"]), 
408   
409          (members, type, Property), 
410          (members, domain, Resource), 
411          (members, range, List), 
412   
413  #       (minCardinality, type, Property), 
414  #       (minCardinality, domain, Restriction), 
415  #       (minCardinality, range, ns_xsd["nonNegativeInteger"]), 
416   
417  #       (minQualifiedCardinality, type, Property), 
418  #       (minQualifiedCardinality, domain, Restriction), 
419  #       (minQualifiedCardinality, range, ns_xsd["nonNegativeInteger"]), 
420   
421  #       (annotatedTarget, type, Property), 
422  #       (annotatedTarget, domain, Resource), 
423  #       (annotatedTarget, range, Resource), 
424   
425          (onClass, type, Property), 
426          (onClass, domain, Restriction), 
427          (onClass, range, Class), 
428   
429  #       (onDataRange, type, Property), 
430  #       (onDataRange, domain, Restriction), 
431  #       (onDataRange, range, Datatype), 
432   
433          (onDatatype, type, Property), 
434          (onDatatype, domain, Datatype), 
435          (onDatatype, range, Datatype), 
436   
437          (oneOf, type, Property), 
438          (oneOf, domain, Class), 
439          (oneOf, range, List), 
440   
441          (onProperty, type, Property), 
442          (onProperty, domain, Restriction), 
443          (onProperty, range, Property), 
444   
445  #       (onProperties, type, Property), 
446  #       (onProperties, domain, Restriction), 
447  #       (onProperties, range, List), 
448   
449  #       (annotatedProperty, type, Property), 
450  #       (annotatedProperty, domain, Resource), 
451  #       (annotatedProperty, range, Property), 
452   
453          (priorVersion, type, OntologyProperty), 
454          (priorVersion, type, AnnotationProperty), 
455          (priorVersion, domain, Ontology), 
456          (priorVersion, range, Ontology), 
457   
458          (propertyChainAxiom, type, Property), 
459          (propertyChainAxiom, domain, Property), 
460          (propertyChainAxiom, range, List), 
461   
462  #       (propertyDisjointWith, type, Property), 
463  #       (propertyDisjointWith, domain, Property), 
464  #       (propertyDisjointWith, range, Property), 
465  # 
466  #       (qualifiedCardinality, type, Property), 
467  #       (qualifiedCardinality, domain, Restriction), 
468  #       (qualifiedCardinality, range, ns_xsd["nonNegativeInteger"]), 
469   
470          (sameAs, type, Property), 
471          (sameAs, domain, Resource), 
472          (sameAs, range, Resource), 
473   
474          (seeAlso, type, AnnotationProperty), 
475          (seeAlso, domain, Resource), 
476          (seeAlso, range, Resource), 
477   
478          (someValuesFrom, type, Property), 
479          (someValuesFrom, domain, Restriction), 
480          (someValuesFrom, range, Class), 
481   
482          (sourceIndividual, type, Property), 
483          (sourceIndividual, domain, NegativePropertyAssertion), 
484          (sourceIndividual, range, Resource), 
485  # 
486  #       (annotatedSource, type, Property), 
487  #       (annotatedSource, domain, Resource), 
488  #       (annotatedSource, range, Resource), 
489  # 
490          (targetIndividual, type, Property), 
491          (targetIndividual, domain, NegativePropertyAssertion), 
492          (targetIndividual, range, Resource), 
493   
494          (targetValue, type, Property), 
495          (targetValue, domain, NegativePropertyAssertion), 
496          (targetValue, range, Literal), 
497   
498  #       (topDataProperty, type, DatatypeProperty), 
499  #       (topDataProperty, domain, Resource), 
500  #       (topDataProperty, range, Literal), 
501  # 
502  #       (topObjectProperty, type, ObjectProperty), 
503  #       (topObjectProperty, domain, Resource), 
504  #       (topObjectProperty, range, Resource), 
505   
506          (unionOf, type, Property), 
507          (unionOf, domain, Class), 
508          (unionOf, range, List), 
509   
510          (versionInfo, type, AnnotationProperty), 
511          (versionInfo, domain, Resource), 
512          (versionInfo, range, Resource), 
513   
514          (versionIRI, type, AnnotationProperty), 
515          (versionIRI, domain, Resource), 
516          (versionIRI, range, Resource), 
517   
518          (withRestrictions, type, Property), 
519          (withRestrictions, domain, Datatype), 
520          (withRestrictions, range, List), 
521   
522          # some OWL valid triples; these would be inferred by the OWL RL expansion, but it may make things 
523          # a bit faster to add these upfront 
524          (allValuesFrom, range, OWLClass), 
525          (complementOf, domain, OWLClass), 
526          (complementOf, range, OWLClass), 
527   
528  #       (datatypeComplementOf, domain, DataRange), 
529  #       (datatypeComplementOf, range, DataRange), 
530          (disjointUnionOf, domain, OWLClass), 
531          (disjointWith, domain, OWLClass), 
532          (disjointWith, range, OWLClass), 
533          (equivalentClass, domain, OWLClass), 
534          (equivalentClass, range, OWLClass), 
535          (hasKey, domain, OWLClass), 
536          (intersectionOf, domain, OWLClass), 
537          (onClass, range, OWLClass), 
538  #       (onDataRange, range, DataRange), 
539          (onDatatype, domain, DataRange), 
540          (onDatatype, range, DataRange), 
541          (oneOf, domain, OWLClass), 
542          (someValuesFrom, range, OWLClass), 
543          (unionOf, range, OWLClass), 
544  #       (withRestrictions, domain, DataRange) 
545  ] 
546   
547  #: OWL RL axiomatic triples: combination of the RDFS triples plus the OWL specific ones 
548  OWLRL_Axiomatic_Triples   = _OWL_axiomatic_triples_Classes   + _OWL_axiomatic_triples_Properties 
549   
550  # Note that this is not used anywhere. But I encoded it once and I did not want to remove it...:-) 
551  _OWL_axiomatic_triples_Facets = [ 
552          # langPattern 
553          (ns_xsd['length'],type,Property), 
554          (ns_xsd['maxExclusive'],type,Property), 
555          (ns_xsd['maxInclusive'],type,Property), 
556          (ns_xsd['maxLength'],type,Property), 
557          (ns_xsd['minExclusive'],type,Property), 
558          (ns_xsd['minInclusive'],type,Property), 
559          (ns_xsd['minLength'],type,Property), 
560          (ns_xsd['pattern'],type,Property), 
561   
562          (ns_xsd['length'],domain,Resource), 
563          (ns_xsd['maxExclusive'],domain,Resource), 
564          (ns_xsd['maxInclusive'],domain,Resource), 
565          (ns_xsd['maxLength'],domain,Resource), 
566          (ns_xsd['minExclusive'],domain,Resource), 
567          (ns_xsd['minInclusive'],domain,Resource), 
568          (ns_xsd['minLength'],domain,Resource), 
569          (ns_xsd['pattern'],domain,Resource), 
570          (ns_xsd['length'],domain,Resource), 
571   
572          (ns_xsd['maxExclusive'],range,Literal), 
573          (ns_xsd['maxInclusive'],range,Literal), 
574          (ns_xsd['maxLength'],range,Literal), 
575          (ns_xsd['minExclusive'],range,Literal), 
576          (ns_xsd['minInclusive'],range,Literal), 
577          (ns_xsd['minLength'],range,Literal), 
578          (ns_xsd['pattern'],range,Literal), 
579  ] 
580   
581  #: OWL D-entailment triples (additionally to the RDFS ones), ie, possible subclassing of various extra datatypes 
582  _OWL_D_Axiomatic_Triples_types = [ 
583          (ns_rdf['PlainLiteral'], type, Datatype) 
584  ] 
585   
586  OWL_D_Axiomatic_Triples_subclasses = [ 
587          (ns_xsd['string'], subClassOf, ns_rdf['PlainLiteral']), 
588          (ns_xsd['normalizedString'], subClassOf, ns_rdf['PlainLiteral']), 
589          (ns_xsd['token'], subClassOf, ns_rdf['PlainLiteral']), 
590          (ns_xsd['Name'], subClassOf, ns_rdf['PlainLiteral']), 
591          (ns_xsd['NCName'], subClassOf, ns_rdf['PlainLiteral']), 
592          (ns_xsd['NMTOKEN'], subClassOf, ns_rdf['PlainLiteral']) 
593  ] 
594   
595  OWLRL_Datatypes_Disjointness = [ 
596          (ns_xsd["anyURI"], disjointWith, ns_xsd['base64Binary']), 
597          (ns_xsd["anyURI"], disjointWith, ns_xsd['boolean']), 
598          (ns_xsd["anyURI"], disjointWith, ns_xsd['dateTime']), 
599          (ns_xsd["anyURI"], disjointWith, ns_xsd['decimal']), 
600          (ns_xsd["anyURI"], disjointWith, ns_xsd['double']), 
601          (ns_xsd["anyURI"], disjointWith, ns_xsd['float']), 
602          (ns_xsd["anyURI"], disjointWith, ns_xsd['hexBinary']), 
603          (ns_xsd["anyURI"], disjointWith, ns_xsd['string']), 
604          (ns_xsd["anyURI"], disjointWith, ns_rdf['PlainLiteral']), 
605          (ns_xsd["anyURI"], disjointWith, XMLLiteral), 
606   
607          (ns_xsd["base64Binary"], disjointWith, ns_xsd['boolean']), 
608          (ns_xsd["base64Binary"], disjointWith, ns_xsd['dateTime']), 
609          (ns_xsd["base64Binary"], disjointWith, ns_xsd['decimal']), 
610          (ns_xsd["base64Binary"], disjointWith, ns_xsd['double']), 
611          (ns_xsd["base64Binary"], disjointWith, ns_xsd['float']), 
612          (ns_xsd["base64Binary"], disjointWith, ns_xsd['hexBinary']), 
613          (ns_xsd["base64Binary"], disjointWith, ns_xsd['string']), 
614          (ns_xsd["base64Binary"], disjointWith, ns_rdf['PlainLiteral']), 
615          (ns_xsd["base64Binary"], disjointWith, XMLLiteral), 
616   
617          (ns_xsd["boolean"], disjointWith, ns_xsd['dateTime']), 
618          (ns_xsd["boolean"], disjointWith, ns_xsd['decimal']), 
619          (ns_xsd["boolean"], disjointWith, ns_xsd['double']), 
620          (ns_xsd["boolean"], disjointWith, ns_xsd['float']), 
621          (ns_xsd["boolean"], disjointWith, ns_xsd['hexBinary']), 
622          (ns_xsd["boolean"], disjointWith, ns_xsd['string']), 
623          (ns_xsd["boolean"], disjointWith, ns_rdf['PlainLiteral']), 
624          (ns_xsd["boolean"], disjointWith, XMLLiteral), 
625   
626          (ns_xsd["dateTime"], disjointWith, ns_xsd['decimal']), 
627          (ns_xsd["dateTime"], disjointWith, ns_xsd['double']), 
628          (ns_xsd["dateTime"], disjointWith, ns_xsd['float']), 
629          (ns_xsd["dateTime"], disjointWith, ns_xsd['hexBinary']), 
630          (ns_xsd["dateTime"], disjointWith, ns_xsd['string']), 
631          (ns_xsd["dateTime"], disjointWith, ns_rdf['PlainLiteral']), 
632          (ns_xsd["dateTime"], disjointWith, XMLLiteral), 
633   
634          (ns_xsd["decimal"], disjointWith, ns_xsd['double']), 
635          (ns_xsd["decimal"], disjointWith, ns_xsd['float']), 
636          (ns_xsd["decimal"], disjointWith, ns_xsd['hexBinary']), 
637          (ns_xsd["decimal"], disjointWith, ns_xsd['string']), 
638          (ns_xsd["decimal"], disjointWith, ns_rdf['PlainLiteral']), 
639          (ns_xsd["decimal"], disjointWith, XMLLiteral), 
640   
641          (ns_xsd["double"], disjointWith, ns_xsd['float']), 
642          (ns_xsd["double"], disjointWith, ns_xsd['hexBinary']), 
643          (ns_xsd["double"], disjointWith, ns_xsd['string']), 
644          (ns_xsd["double"], disjointWith, ns_rdf['PlainLiteral']), 
645          (ns_xsd["double"], disjointWith, XMLLiteral), 
646   
647          (ns_xsd["float"], disjointWith, ns_xsd['hexBinary']), 
648          (ns_xsd["float"], disjointWith, ns_xsd['string']), 
649          (ns_xsd["float"], disjointWith, ns_rdf['PlainLiteral']), 
650          (ns_xsd["float"], disjointWith, XMLLiteral), 
651   
652          (ns_xsd["hexBinary"], disjointWith, ns_xsd['string']), 
653          (ns_xsd["hexBinary"], disjointWith, ns_rdf['PlainLiteral']), 
654          (ns_xsd["hexBinary"], disjointWith, XMLLiteral), 
655   
656          (ns_xsd["string"], disjointWith, XMLLiteral), 
657  ] 
658   
659  #: OWL RL D Axiomatic triples: combination of the RDFS ones, plus some extra statements on ranges and domains, plus some OWL specific datatypes 
660  OWLRL_D_Axiomatic_Triples = RDFS_D_Axiomatic_Triples + _OWL_D_Axiomatic_Triples_types + OWL_D_Axiomatic_Triples_subclasses + OWLRL_Datatypes_Disjointness 
661   

OWL-RL-7.1.4/Doc_OLD/RDFClosure.Closure-module.html000066400000000000000000000235521504201166100214410ustar00rootroot00000000000000 RDFClosure.Closure
Package RDFClosure :: Module Closure
[hide private]
[frames] | no frames]

Module Closure

source code

The generic superclasses for various rule based semantics and the possible extensions.


Requires: RDFLib, 6.2.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]
  Core
Core of the semantics management, dealing with the RDFS and other Semantic triples.
Variables [hide private]
  __author__ = 'Ivan Herman'
  __license__ = u'W3C® SOFTWARE NOTICE AND LICENSE, http://www.w...
  debugGlobal = False
  offlineGeneration = False
  __package__ = 'RDFClosure'

Imports: rdflib, BNode, rdflibLiteral, Namespace, ns_rdf, type, LiteralProxies


Variables Details [hide private]

__license__

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

OWL-RL-7.1.4/Doc_OLD/RDFClosure.Closure-pysrc.html000066400000000000000000002211411504201166100213060ustar00rootroot00000000000000 RDFClosure.Closure
Package RDFClosure :: Module Closure
[hide private]
[frames] | no frames]

Source Code for Module RDFClosure.Closure

  1  #!/d/Bin/Python/python.exe 
  2  # -*- coding: utf-8 -*- 
  3  # 
  4  """ 
  5  The generic superclasses for various rule based semantics and the possible extensions. 
  6   
  7  @requires: U{RDFLib<https://github.com/RDFLib/rdflib>}, 4.0.0 and higher 
  8  @license: This software is available for use under the U{W3C Software License<http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231>} 
  9  @organization: U{World Wide Web Consortium<http://www.w3.org>} 
 10  @author: U{Ivan Herman<a href="http://www.w3.org/People/Ivan/">} 
 11   
 12  """ 
 13   
 14  __author__  = 'Ivan Herman' 
 15  __contact__ = 'Ivan Herman, ivan@w3.org' 
 16  __license__ = u'W3C® SOFTWARE NOTICE AND LICENSE, http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231' 
 17   
 18  import rdflib 
 19  from rdflib import BNode 
 20  from rdflib import Literal as rdflibLiteral 
 21  from rdflib import Namespace 
 22   
 23  # noinspection PyPep8Naming 
 24  from RDFClosure.RDFS import RDFNS as ns_rdf 
 25  from RDFClosure.RDFS import type 
 26   
 27  from RDFClosure.Literals import LiteralProxies 
 28   
 29  debugGlobal       = False 
 30  offlineGeneration = False 
 31   
 32   
 33  ###################################################################################################### 
 34  # noinspection PyMethodMayBeStatic,PyPep8Naming,PyPep8Naming 
35 -class Core :
36 """Core of the semantics management, dealing with the RDFS and other Semantic triples. The only 37 reason to have it in a separate class is for an easier maintainability. 38 39 This is a common superclass only. In the present module, it is subclassed by 40 a L{RDFS Closure<RDFClosure.RDFSClosure.RDFS_Semantics>} class and a L{OWL RL Closure<RDFClosure.OWLRL.OWLRL_Semantics>} classes. 41 There are some methods that are implemented in the subclasses only, ie, this class cannot be used by itself! 42 43 @ivar IMaxNum: maximal index of C{rdf:_i} occurrence in the graph 44 @ivar literal_proxies: L{Literal Proxies with BNodes<RDFClosure.Literals.LiteralProxies>} for the graph 45 @type literal_proxies: L{LiteralProxies<RDFClosure.Literals.LiteralProxies>} 46 @ivar graph: the real graph 47 @type graph: rdflib.Graph 48 @ivar axioms: whether axioms should be added or not 49 @type axioms: boolean 50 @ivar daxioms: whether datatype axioms should be added or not 51 @type daxioms: boolean 52 @ivar added_triples: triples added to the graph, conceptually, during one processing cycle 53 @type added_triples: set of triples 54 @ivar error_messages: error messages (typically inconsistency messages in OWL RL) found during processing. These are added to the final graph at the very end as separate BNodes with error messages 55 @type error_messages: array of strings 56 @ivar rdfs: whether RDFS inference is also done (used in subclassed only) 57 @type rdfs: boolean 58 """ 59 # noinspection PyUnusedLocal
60 - def __init__(self, graph, axioms, daxioms, rdfs=False):
61 """ 62 @param graph: the RDF graph to be extended 63 @type graph: rdflib.Graph 64 @param axioms: whether axioms should be added or not 65 @type axioms: boolean 66 @param daxioms: whether datatype axioms should be added or not 67 @type daxioms: boolean 68 @param rdfs: whether RDFS inference is also done (used in subclassed only) 69 @type rdfs: boolean 70 """ 71 self._debug = debugGlobal 72 73 # Calculate the maximum 'n' value for the '_i' type predicates (see Horst's paper) 74 n = 1 75 maxnum = 0 76 cont = True 77 while cont: 78 cont = False 79 predicate = ns_rdf[("_%d" % n)] 80 for (s, p, o) in graph.triples((None, predicate, None)): 81 # there is at least one if we got here 82 maxnum = n 83 n += 1 84 cont = True 85 self.IMaxNum = maxnum 86 87 self.graph = graph 88 self.axioms = axioms 89 self.daxioms = daxioms 90 91 self.rdfs = rdfs 92 93 self.error_messages = [] 94 self.empty_stored_triples()
95
96 - def add_error(self, message):
97 """ 98 Add an error message 99 @param message: error message 100 @type message: string 101 """ 102 if message not in self.error_messages: 103 self.error_messages.append(message)
104
105 - def pre_process(self):
106 """ 107 Do some pre-processing step. This method before anything else in the closure. By default, this method is empty, subclasses 108 can add content to it by overriding it. 109 """ 110 pass
111
112 - def post_process(self):
113 """ 114 Do some post-processing step. This method when all processing is done, but before handling possible 115 errors (ie, the method can add its own error messages). By default, this method is empty, subclasses 116 can add content to it by overriding it. 117 """ 118 pass
119
120 - def rules(self,t,cycle_num):
121 """ 122 The core processing cycles through every tuple in the graph and dispatches it to the various methods implementing 123 a specific group of rules. By default, this method raises an exception; indeed, subclasses 124 I{must} add content to by overriding it. 125 @param t: one triple on which to apply the rules 126 @type t: tuple 127 @param cycle_num: which cycle are we in, starting with 1. This value is forwarded to all local rules; it is also used 128 locally to collect the bnodes in the graph. 129 """ 130 raise Exception("This method should not be called directly; subclasses should override it")
131
132 - def add_axioms(self):
133 """ 134 Add axioms. 135 This is only a placeholder and raises an exception by default; subclasses I{must} fill this with real content 136 """ 137 raise Exception("This method should not be called directly; subclasses should override it")
138
139 - def add_d_axioms(self):
140 """ 141 Add d axioms. 142 This is only a placeholder and raises an exception by default; subclasses I{must} fill this with real content 143 """ 144 raise Exception("This method should not be called directly; subclasses should override it")
145
146 - def one_time_rules(self):
147 """ 148 This is only a placeholder; subclasses should fill this with real content. By default, it is just an empty call. 149 This set of rules is invoked only once and not in a cycle. 150 """ 151 pass
152 153 # noinspection PyBroadException
154 - def get_literal_value(self, node):
155 """ 156 Return the literal value corresponding to a Literal node. Used in error messages. 157 @param node: literal node 158 @return: the literal value itself 159 """ 160 try: 161 return self.literal_proxies.bnode_to_lit[node].lex 162 except: 163 return "????"
164 165 # noinspection PyAttributeOutsideInit
166 - def empty_stored_triples(self):
167 """ 168 Empty the internal store for triples 169 """ 170 self.added_triples = set()
171
172 - def flush_stored_triples(self):
173 """ 174 Send the stored triples to the graph, and empty the container 175 """ 176 for t in self.added_triples: 177 self.graph.add(t) 178 self.empty_stored_triples()
179
180 - def store_triple(self, t):
181 """ 182 In contrast to its name, this does not yet add anything to the graph itself, it just stores the tuple in an 183 L{internal set<Core.added_triples>}. (It is important for this to be a set: some of the rules in the various closures may 184 generate the same tuples several times.) Before adding the tuple to the set, the method checks whether 185 the tuple is in the final graph already (if yes, it is not added to the set). 186 187 The set itself is emptied at the start of every processing cycle; the triples are then effectively added to the 188 graph at the end of such a cycle. If the set is 189 actually empty at that point, this means that the cycle has not added any new triple, and the full processing can stop. 190 191 @param t: the triple to be added to the graph, unless it is already there 192 @type t: a 3-element tuple of (s,p,o) 193 """ 194 (s, p, o) = t 195 if not(isinstance(s, rdflibLiteral) or isinstance(p, rdflibLiteral)) and t not in self.graph: 196 if self._debug or offlineGeneration: 197 print t 198 self.added_triples.add(t)
199 200 # noinspection PyAttributeOutsideInit
201 - def closure(self):
202 """ 203 Generate the closure the graph. This is the real 'core'. 204 205 The processing rules store new triples via the L{separate method<store_triple>} which stores 206 them in the L{added_triples<added_triples>} array. If that array is emtpy at the end of a cycle, 207 it means that the whole process can be stopped. 208 209 If required, the relevant axiomatic triples are added to the graph before processing in cycles. Similarly 210 the exchange of literals against bnodes is also done in this step (and restored after all cycles are over). 211 """ 212 self.pre_process() 213 214 # Handling the axiomatic triples. In general, this means adding all tuples in the list that 215 # forwarded, and those include RDF or RDFS. In both cases the relevant parts of the container axioms should also 216 # be added. 217 if self.axioms: 218 self.add_axioms() 219 220 # Create the bnode proxy structure for literals 221 self.literal_proxies = LiteralProxies(self.graph, self) 222 223 # Add the datatype axioms, if needed (note that this makes use of the literal proxies, the order of the call is important! 224 if self.daxioms: 225 self.add_d_axioms() 226 227 self.flush_stored_triples() 228 229 # Get first the 'one-time rules', ie, those that do not need an extra round in cycles down the line 230 self.one_time_rules() 231 self.flush_stored_triples() 232 233 # Go cyclically through all rules until no change happens 234 new_cycle = True 235 cycle_num = 0 236 while new_cycle: 237 # yes, there was a change, let us go again 238 cycle_num += 1 239 240 # DEBUG: print the cycle number out 241 if self._debug: 242 print "----- Cycle #:%d" % cycle_num 243 244 # go through all rules, and collect the replies (to see whether any change has been done) 245 # the new triples to be added are collected separately not to interfere with 246 # the current graph yet 247 self.empty_stored_triples() 248 249 # Execute all the rules; these might fill up the added triples array 250 for t in self.graph: 251 self.rules(t, cycle_num) 252 253 # Add the tuples to the graph (if necessary, that is). If any new triple has been generated, a new cycle 254 # will be necessary... 255 new_cycle = len(self.added_triples) > 0 256 257 for t in self.added_triples: 258 self.graph.add(t) 259 260 # All done, but we should restore the literals from their proxies 261 self.literal_proxies.restore() 262 263 self.post_process() 264 self.flush_stored_triples() 265 266 # Add possible error messages 267 if self.error_messages: 268 # I am not sure this is the right vocabulary to use for this purpose, but I haven't found anything! 269 # I could, of course, come up with my own, but I am not sure that would be kosher... 270 ERRNS = Namespace("http://www.daml.org/2002/03/agents/agent-ont#") 271 self.graph.bind("err","http://www.daml.org/2002/03/agents/agent-ont#") 272 for m in self.error_messages: 273 message = BNode() 274 self.graph.add((message, type, ERRNS['ErrorMessage'])) 275 self.graph.add((message, ERRNS['error'], rdflibLiteral(m)))
276

OWL-RL-7.1.4/Doc_OLD/RDFClosure.Closure.Core-class.html000066400000000000000000000770101504201166100221460ustar00rootroot00000000000000 RDFClosure.Closure.Core
Package RDFClosure :: Module Closure :: Class Core
[hide private]
[frames] | no frames]

Class Core

source code

Known Subclasses:

Core of the semantics management, dealing with the RDFS and other Semantic triples. The only reason to have it in a separate class is for an easier maintainability.

This is a common superclass only. In the present module, it is subclassed by a RDFS Closure class and a OWL RL Closure classes. There are some methods that are implemented in the subclasses only, ie, this class cannot be used by itself!

Instance Methods [hide private]
 
__init__(self, graph, axioms, daxioms, rdfs=False) source code
 
add_error(self, message)
Add an error message
source code
 
pre_process(self)
Do some pre-processing step.
source code
 
post_process(self)
Do some post-processing step.
source code
 
rules(self, t, cycle_num)
The core processing cycles through every tuple in the graph and dispatches it to the various methods implementing a specific group of rules.
source code
 
add_axioms(self)
Add axioms.
source code
 
add_d_axioms(self)
Add d axioms.
source code
 
one_time_rules(self)
This is only a placeholder; subclasses should fill this with real content.
source code
 
get_literal_value(self, node)
Return the literal value corresponding to a Literal node.
source code
 
empty_stored_triples(self)
Empty the internal store for triples
source code
 
flush_stored_triples(self)
Send the stored triples to the graph, and empty the container
source code
 
store_triple(self, t)
In contrast to its name, this does not yet add anything to the graph itself, it just stores the tuple in an internal set.
source code
 
closure(self)
Generate the closure the graph.
source code
Instance Variables [hide private]
  IMaxNum
maximal index of rdf:_i occurrence in the graph
set of triples added_triples
triples added to the graph, conceptually, during one processing cycle
boolean axioms
whether axioms should be added or not
boolean daxioms
whether datatype axioms should be added or not
array of strings error_messages
error messages (typically inconsistency messages in OWL RL) found during processing.
rdflib.Graph graph
the real graph
LiteralProxies literal_proxies
Literal Proxies with BNodes for the graph
boolean rdfs
whether RDFS inference is also done (used in subclassed only)
Method Details [hide private]

__init__(self, graph, axioms, daxioms, rdfs=False)
(Constructor)

source code 
Parameters:
  • graph (rdflib.Graph) - the RDF graph to be extended
  • axioms (boolean) - whether axioms should be added or not
  • daxioms (boolean) - whether datatype axioms should be added or not
  • rdfs (boolean) - whether RDFS inference is also done (used in subclassed only)

add_error(self, message)

source code 

Add an error message

Parameters:
  • message (string) - error message

pre_process(self)

source code 

Do some pre-processing step. This method before anything else in the closure. By default, this method is empty, subclasses can add content to it by overriding it.

post_process(self)

source code 

Do some post-processing step. This method when all processing is done, but before handling possible errors (ie, the method can add its own error messages). By default, this method is empty, subclasses can add content to it by overriding it.

rules(self, t, cycle_num)

source code 

The core processing cycles through every tuple in the graph and dispatches it to the various methods implementing a specific group of rules. By default, this method raises an exception; indeed, subclasses must add content to by overriding it.

Parameters:
  • t (tuple) - one triple on which to apply the rules
  • cycle_num - which cycle are we in, starting with 1. This value is forwarded to all local rules; it is also used locally to collect the bnodes in the graph.

add_axioms(self)

source code 

Add axioms. This is only a placeholder and raises an exception by default; subclasses must fill this with real content

add_d_axioms(self)

source code 

Add d axioms. This is only a placeholder and raises an exception by default; subclasses must fill this with real content

one_time_rules(self)

source code 

This is only a placeholder; subclasses should fill this with real content. By default, it is just an empty call. This set of rules is invoked only once and not in a cycle.

get_literal_value(self, node)

source code 

Return the literal value corresponding to a Literal node. Used in error messages.

Parameters:
  • node - literal node
Returns:
the literal value itself

store_triple(self, t)

source code 

In contrast to its name, this does not yet add anything to the graph itself, it just stores the tuple in an internal set. (It is important for this to be a set: some of the rules in the various closures may generate the same tuples several times.) Before adding the tuple to the set, the method checks whether the tuple is in the final graph already (if yes, it is not added to the set).

The set itself is emptied at the start of every processing cycle; the triples are then effectively added to the graph at the end of such a cycle. If the set is actually empty at that point, this means that the cycle has not added any new triple, and the full processing can stop.

Parameters:
  • t (a 3-element tuple of (s,p,o)) - the triple to be added to the graph, unless it is already there

closure(self)

source code 

Generate the closure the graph. This is the real 'core'.

The processing rules store new triples via the separate method which stores them in the added_triples array. If that array is emtpy at the end of a cycle, it means that the whole process can be stopped.

If required, the relevant axiomatic triples are added to the graph before processing in cycles. Similarly the exchange of literals against bnodes is also done in this step (and restored after all cycles are over).


Instance Variable Details [hide private]

error_messages

error messages (typically inconsistency messages in OWL RL) found during processing. These are added to the final graph at the very end as separate BNodes with error messages
Type:
array of strings

OWL-RL-7.1.4/Doc_OLD/RDFClosure.CombinedClosure-module.html000066400000000000000000000235131504201166100230770ustar00rootroot00000000000000 RDFClosure.CombinedClosure
Package RDFClosure :: Module CombinedClosure
[hide private]
[frames] | no frames]

Module CombinedClosure

source code

The combined closure: performing both the OWL 2 RL and RDFS closures. The two are very close but there are some rules in RDFS that are not in OWL 2 RL (eg, the axiomatic triples concerning the container membership properties). Using this closure class the OWL 2 RL implementation becomes a full extension of RDFS.


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]
  RDFS_OWLRL_Semantics
Common subclass of the RDFS and OWL 2 RL semantic classes.
Variables [hide private]
  __author__ = 'Ivan Herman'
  __license__ = u'W3C® SOFTWARE NOTICE AND LICENSE, http://www.w...
  __package__ = 'RDFClosure'

Imports: Resource, Class, Datatype, OWLClass, Thing, equivalentClass, DataRange, RDFS_Semantics, OWLRL_Semantics


Variables Details [hide private]

__license__

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

OWL-RL-7.1.4/Doc_OLD/RDFClosure.CombinedClosure-pysrc.html000066400000000000000000001567301504201166100227620ustar00rootroot00000000000000 RDFClosure.CombinedClosure
Package RDFClosure :: Module CombinedClosure
[hide private]
[frames] | no frames]

Source Code for Module RDFClosure.CombinedClosure

  1  #!/d/Bin/Python/python.exe 
  2  # -*- coding: utf-8 -*- 
  3  # 
  4  """ 
  5  The combined closure: performing I{both} the OWL 2 RL and RDFS closures. 
  6  The two are very close but there are some rules in RDFS that are not in OWL 2 RL (eg, the axiomatic 
  7  triples concerning the container membership properties). Using this closure class the 
  8  OWL 2 RL implementation becomes a full extension of RDFS. 
  9   
 10  @requires: U{RDFLib<https://github.com/RDFLib/rdflib>}, 4.0.0 and higher 
 11  @license: This software is available for use under the U{W3C Software License<http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231>} 
 12  @organization: U{World Wide Web Consortium<http://www.w3.org>} 
 13  @author: U{Ivan Herman<a href="http://www.w3.org/People/Ivan/">} 
 14   
 15  """ 
 16   
 17  __author__  = 'Ivan Herman' 
 18  __contact__ = 'Ivan Herman, ivan@w3.org' 
 19  __license__ = u'W3C® SOFTWARE NOTICE AND LICENSE, http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231' 
 20   
 21  from RDFClosure.RDFS import Resource, Class, Datatype 
 22  from RDFClosure.OWL  import OWLClass, Thing, equivalentClass, DataRange 
 23   
 24  from RDFClosure.RDFSClosure import RDFS_Semantics 
 25  from RDFClosure.OWLRL       import OWLRL_Semantics 
26 27 ###################################################################################################### 28 29 30 # noinspection PyPep8Naming 31 -class RDFS_OWLRL_Semantics(RDFS_Semantics, OWLRL_Semantics):
32 """Common subclass of the RDFS and OWL 2 RL semantic classes. All methods simply call back 33 to the functions in the superclasses. This may lead to some unnecessary duplication of terms 34 and rules, but it it not so bad. Also, the additional identification defined for OWL Full, 35 ie, Resource being the same as Thing and OWL and RDFS classes being identical are added to the 36 triple store. 37 38 Note that this class is also a possible user extension point: subclasses can be created that 39 extend the standard functionality by extending this class. This class I{always} performs RDFS inferences. 40 Subclasses have to set the C{self.rdfs} flag explicitly to the requested value if that is to be controlled. 41 42 @ivar full_binding_triples: additional axiom type triples that are added to the combined semantics; these 'bind' the RDFS and the OWL worlds together 43 @ivar rdfs: whether RDFS inference is to be performed or not. In this class instance the value is I{always} C{True}, subclasses may explicitly change it at initialization time. 44 @type rdfs: boolean 45 """ 46 full_binding_triples = [ 47 (Thing, equivalentClass, Resource), 48 (Class, equivalentClass, OWLClass), 49 (DataRange, equivalentClass, Datatype) 50 ] 51
52 - def __init__(self, graph, axioms, daxioms, rdfs=True):
53 """ 54 @param graph: the RDF graph to be extended 55 @type graph: rdflib.Graph 56 @param axioms: whether (non-datatype) axiomatic triples should be added or not 57 @type axioms: bool 58 @param daxioms: whether datatype axiomatic triples should be added or not 59 @type daxioms: bool 60 @param rdfs: placeholder flag (used in subclassed only, it is always defaulted to True in this class) 61 @type rdfs: boolean 62 """ 63 OWLRL_Semantics.__init__(self, graph, axioms, daxioms, rdfs) 64 RDFS_Semantics.__init__(self, graph, axioms, daxioms, rdfs) 65 self.rdfs = True
66 67 # noinspection PyMethodMayBeStatic 68 @staticmethod
69 - def add_new_datatype(uri, conversion_function, datatype_list, subsumption_dict=None, subsumption_key=None, subsumption_list=None):
70 """If an extension wants to add new datatypes, this method should be invoked at initialization time. 71 72 @param uri : URI for the new datatypes, like owl_ns["Rational"] 73 @param conversion_function : a function converting the lexical representation of the datatype to a Python value, 74 possibly raising an exception in case of unsuitable lexical form 75 @param datatype_list : list of datatypes already in use that has to be checked 76 @param subsumption_dict : dictionary of subsumption hierarchies (indexed by the datatype URI-s) 77 @param subsumption_key : key in the dictionary, if None, the uri parameter is used 78 @param subsumption_list : list of subsumptions associated to a subsumption key (ie, all datatypes that are superclasses of the new datatype) 79 """ 80 from DatatypeHandling import AltXSDToPYTHON, use_Alt_lexical_conversions 81 82 if datatype_list: 83 datatype_list.append(uri) 84 85 if subsumption_dict and subsumption_list: 86 if subsumption_key: 87 subsumption_dict[subsumption_key] = subsumption_list 88 else : 89 subsumption_dict[uri] = subsumption_list 90 91 AltXSDToPYTHON[uri] = conversion_function 92 use_Alt_lexical_conversions()
93
94 - def post_process(self):
95 """Do some post-processing step. This method when all processing is done, but before handling possible 96 errors (ie, the method can add its own error messages). By default, this method is empty, subclasses 97 can add content to it by overriding it. 98 """ 99 OWLRL_Semantics.post_process(self)
100
101 - def rules(self, t, cycle_num):
102 """ 103 @param t: a triple (in the form of a tuple) 104 @param cycle_num: which cycle are we in, starting with 1. This value is forwarded to all local rules; it is also used 105 locally to collect the bnodes in the graph. 106 """ 107 OWLRL_Semantics.rules(self, t, cycle_num) 108 if self.rdfs: 109 RDFS_Semantics.rules(self, t, cycle_num)
110
111 - def add_axioms(self):
112 if self.rdfs: 113 RDFS_Semantics.add_axioms(self) 114 OWLRL_Semantics.add_axioms(self)
115
116 - def add_d_axioms(self):
117 if self.rdfs: 118 RDFS_Semantics.add_d_axioms(self) 119 OWLRL_Semantics.add_d_axioms(self)
120
121 - def one_time_rules(self):
122 """Adds some extra axioms and calls for the d_axiom part of the OWL Semantics.""" 123 for t in self.full_binding_triples: 124 self.store_triple(t) 125 126 # Note that the RL one time rules include the management of datatype which is a true superset 127 # of the rules in RDFS. It is therefore unnecessary to add those even self.rdfs is True. 128 OWLRL_Semantics.one_time_rules(self)
129

OWL-RL-7.1.4/Doc_OLD/RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics-class.html000066400000000000000000000745541504201166100264540ustar00rootroot00000000000000 RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics
Package RDFClosure :: Module CombinedClosure :: Class RDFS_OWLRL_Semantics
[hide private]
[frames] | no frames]

Class RDFS_OWLRL_Semantics

source code

          Closure.Core --+    
                         |    
RDFSClosure.RDFS_Semantics --+
                             |
          Closure.Core --+   |
                         |   |
     OWLRL.OWLRL_Semantics --+
                             |
                            RDFS_OWLRL_Semantics
Known Subclasses:

Common subclass of the RDFS and OWL 2 RL semantic classes. All methods simply call back to the functions in the superclasses. This may lead to some unnecessary duplication of terms and rules, but it it not so bad. Also, the additional identification defined for OWL Full, ie, Resource being the same as Thing and OWL and RDFS classes being identical are added to the triple store.

Note that this class is also a possible user extension point: subclasses can be created that extend the standard functionality by extending this class. This class always performs RDFS inferences. Subclasses have to set the self.rdfs flag explicitly to the requested value if that is to be controlled.

Instance Methods [hide private]
 
__init__(self, graph, axioms, daxioms, rdfs=True) source code
 
post_process(self)
Do some post-processing step.
source code
 
rules(self, t, cycle_num)
Go through the RDFS entailment rules rdf1, rdfs4-rdfs12, by extending the graph.
source code
 
add_axioms(self)
Add axioms
source code
 
add_d_axioms(self)
This is not really complete, because it just uses the comparison possibilities that rdflib provides.
source code
 
one_time_rules(self)
Adds some extra axioms and calls for the d_axiom part of the OWL Semantics.
source code

Inherited from Closure.Core: add_error, closure, empty_stored_triples, flush_stored_triples, get_literal_value, pre_process, store_triple

Inherited from OWLRL.OWLRL_Semantics: restriction_typing_check

Static Methods [hide private]
 
add_new_datatype(uri, conversion_function, datatype_list, subsumption_dict=None, subsumption_key=None, subsumption_list=None)
If an extension wants to add new datatypes, this method should be invoked at initialization time.
source code
Instance Variables [hide private]
  full_binding_triples = [(rdflib.term.URIRef(u'http://www.w3.or...
additional axiom type triples that are added to the combined semantics; these 'bind' the RDFS and the OWL worlds together
boolean rdfs
whether RDFS inference is also done (used in subclassed only)

Inherited from Closure.Core: IMaxNum, added_triples, axioms, daxioms, error_messages, graph, literal_proxies

Method Details [hide private]

__init__(self, graph, axioms, daxioms, rdfs=True)
(Constructor)

source code 
Parameters:
  • graph (rdflib.Graph) - the RDF graph to be extended
  • axioms (bool) - whether (non-datatype) axiomatic triples should be added or not
  • daxioms (bool) - whether datatype axiomatic triples should be added or not
  • rdfs (boolean) - placeholder flag (used in subclassed only, it is always defaulted to True in this class)
Overrides: OWLRL.OWLRL_Semantics.__init__

add_new_datatype(uri, conversion_function, datatype_list, subsumption_dict=None, subsumption_key=None, subsumption_list=None)
Static Method

source code 

If an extension wants to add new datatypes, this method should be invoked at initialization time.

Parameters:
  • uri - URI for the new datatypes, like owl_ns["Rational"]
  • conversion_function - a function converting the lexical representation of the datatype to a Python value, possibly raising an exception in case of unsuitable lexical form
  • datatype_list - list of datatypes already in use that has to be checked
  • subsumption_dict - dictionary of subsumption hierarchies (indexed by the datatype URI-s)
  • subsumption_key - key in the dictionary, if None, the uri parameter is used
  • subsumption_list - list of subsumptions associated to a subsumption key (ie, all datatypes that are superclasses of the new datatype)

post_process(self)

source code 

Do some post-processing step. This method when all processing is done, but before handling possible errors (ie, the method can add its own error messages). By default, this method is empty, subclasses can add content to it by overriding it.

Overrides: OWLRL.OWLRL_Semantics.post_process

rules(self, t, cycle_num)

source code 

Go through the RDFS entailment rules rdf1, rdfs4-rdfs12, by extending the graph.

Parameters:
  • t - a triple (in the form of a tuple)
  • cycle_num - which cycle are we in, starting with 1. This value is forwarded to all local rules; it is also used locally to collect the bnodes in the graph.
Overrides: OWLRL.OWLRL_Semantics.rules

add_axioms(self)

source code 

Add axioms

Overrides: OWLRL.OWLRL_Semantics.add_axioms
(inherited documentation)

add_d_axioms(self)

source code 

This is not really complete, because it just uses the comparison possibilities that rdflib provides.

Overrides: OWLRL.OWLRL_Semantics.add_d_axioms
(inherited documentation)

one_time_rules(self)

source code 

Adds some extra axioms and calls for the d_axiom part of the OWL Semantics.

Overrides: OWLRL.OWLRL_Semantics.one_time_rules

Instance Variable Details [hide private]

full_binding_triples

additional axiom type triples that are added to the combined semantics; these 'bind' the RDFS and the OWL worlds together
Value:
[(rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#Thing'),
  rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#equivalentClass')\
,
  rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#Resource')\
),
 (rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#Class'),
  rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#equivalentClass')\
,
...

rdfs

whether RDFS inference is also done (used in subclassed only)
Type:
boolean

OWL-RL-7.1.4/Doc_OLD/RDFClosure.DatatypeHandling-module.html000066400000000000000000002346201504201166100232450ustar00rootroot00000000000000 RDFClosure.DatatypeHandling
Package RDFClosure :: Module DatatypeHandling
[hide private]
[frames] | no frames]

Module DatatypeHandling

source code

Most of the XSD datatypes are handled directly by RDFLib. However, in some cases, that is not good enough. There are two major reasons for this:

  1. Some datatypes are missing from RDFLib and required by OWL 2 RL and/or RDFS
  2. In other cases, though the datatype is present, RDFLib is fairly lax in checking the lexical value of those datatypes. Typical case is boolean.

Some of these deficiencies are handled by this module. All the functions convert the lexical value into a python datatype (or return the original string if this is not possible) which will be used, eg, for comparisons (equalities). If the lexical value constraints are not met, exceptions are raised.


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]
  _namelessTZ
(Nameless) timezone object.
Functions [hide private]
 
_returnTimeZone(incoming_v)
Almost all time/date related methods require the extraction of an optional time zone information.
source code
 
_strToBool(v)
The built-in conversion to boolean is way too lax.
source code
 
_strToDecimal(v)
The built in datatype handling for RDFLib maps a decimal number to float, but the python version 2.4 and upwards also has a Decimal number.
source code
 
_strToAnyURI(v)
Rudimentary test for the AnyURI value.
source code
 
_strToBase64Binary(v)
Rudimentary test for the base64Binary value.
source code
 
_strToBoundNumeral(v, interval, conversion)
Test (and convert) a generic numerical type, with a check against a lower and upper limit.
source code
 
_strToDouble(v)
Test and convert a double value into a Decimal or float.
source code
 
_strToFloat(v)
Test and convert a float value into Decimal or (python) float.
source code
 
_strToHexBinary(v)
Test (and convert) hexa integer values.
source code
datetime.datetime
_strToDateTimeAndStamp(incoming_v, timezone_required=False)
Test (and convert) datetime and date timestamp values.
source code
 
_strToTime(incoming_v)
Test (and convert) time values.
source code
 
_strToDate(incoming_v)
Test (and convert) date values.
source code
 
_strTogYearMonth(v)
Test gYearMonth value
source code
 
_strTogYear(v)
Test gYear value
source code
 
_strTogMonthDay(v)
Test gYearMonth value
source code
 
_strTogDay(v)
Test gYearMonth value
source code
 
_strTogMonth(v)
Test gYearMonth value
source code
 
_strToXMLLiteral(v)
Test (and convert) XML Literal values.
source code
 
_strToVal_Regexp(v, regexp, flag=0, excludeStart=[])
Test (and convert) a generic string type, with a check against a regular expression.
source code
 
_strToToken(v)
Test (and convert) a string to a token.
source code
 
_strToPlainLiteral(v)
Test (and convert) a plain literal
source code
 
use_Alt_lexical_conversions()
Registering the datatypes item for RDFLib, ie, bind the dictionary values.
source code
 
use_RDFLib_lexical_conversions()
Restore the original (ie, RDFLib) set of lexical conversion routines.
source code
Variables [hide private]
  __author__ = 'Ivan Herman'
  __license__ = u'W3C® SOFTWARE NOTICE AND LICENSE, http://www.w...
  _hexc = ['A', 'B', 'C', 'D', 'E', 'F', 'a', 'b', 'c', 'd', 'e'...
  _numb = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0']
  _limits_unsignedByte = [-1, 256]
  _limits_byte = [-129, 128]
  _limits_unsignedInt = [-1, 4294967296]
  _limits_int = [-2147483649, 2147483648]
  _limits_unsignedShort = [-1, 65536]
  _limits_short = [-32769, 32768]
  _limits_unsignedLong = [-1, 18446744073709551616]
  _limits_long = [-9223372036854775809, 9223372036854775808]
  _limits_positiveInteger = [0, None]
  _limits_nonPositiveInteger = [None, 1]
  _limits_nonNegativeInteger = [-1, None]
  _limits_negativeInteger = [None, 0]
  _re_language = '[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*'
  _re_NMTOKEN = '[\\w:_.\\-]+'
  _re_Name_ex = ['.', '-', '1', '2', '3', '4', '5', '6', '7', '8...
  _re_NCName = '[\\w_.\\-]+'
  _re_NCName_ex = ['.', '-', '1', '2', '3', '4', '5', '6', '7', ...
  _re_token = '[^\n\t\r]+'
  AltXSDToPYTHON = {rdflib.term.URIRef(u'http://www.w3.org/1999/...
  __package__ = 'RDFClosure'

Imports: ns_rdf, XSDToPython, Literal, _toPythonMapping, ns_xsd, datetime, time, re, Decimal


Function Details [hide private]

_returnTimeZone(incoming_v)

source code 

Almost all time/date related methods require the extraction of an optional time zone information.

Parameters:
  • incoming_v - the time/date string @return (v,timezone) tuple; 'v' is the input string with the timezone info cut off, 'timezone' is a _namelessTZ instance or None

_strToBool(v)

source code 

The built-in conversion to boolean is way too lax. The xsd specification requires that only true, false, 1 or 0 should be used...

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

_strToDecimal(v)

source code 

The built in datatype handling for RDFLib maps a decimal number to float, but the python version 2.4 and upwards also has a Decimal number. Better make use of that to use very high numbers. However, there is also a big difference between Python's decimal and XSD's decimal, because the latter does not allow for an exponential normal form (why???). This must be filtered out.

Parameters:
  • v - the literal string defined as decimal @return Decimal
Raises:
  • ValueError - invalid decimal value

_strToAnyURI(v)

source code 

Rudimentary test for the AnyURI value. If it is a relative URI, then some tests are done to filter out mistakes. I am not sure this is the full implementation of the RFC, though, may have to be checked at some point later.

Parameters:
  • v - the literal string defined as a URI @return the incoming value
Raises:
  • ValueError - invalid URI value

_strToBase64Binary(v)

source code 

Rudimentary test for the base64Binary value. The problem is that the built-in b64 module functions ignore the fact that only a certain family of characters are allowed to appear in the lexical value, so this is checked first.

Parameters:
  • v - the literal string defined as a base64encoded string @return the decoded (binary) content
Raises:
  • ValueError - invalid base 64 binary value

_strToBoundNumeral(v, interval, conversion)

source code 

Test (and convert) a generic numerical type, with a check against a lower and upper limit.

Parameters:
  • v - the literal string to be converted
  • interval - lower and upper bounds (non inclusive). If the value is None, no comparison should be done
  • conversion - conversion function, ie, int, long, etc
Raises:
  • ValueError - invalid value

_strToDouble(v)

source code 

Test and convert a double value into a Decimal or float. Raises an exception if the number is outside the permitted range, ie, 1.0E+310 and 1.0E-330. To be on the safe side (python does not have double!) Decimals are used if possible. Upper and lower values, as required by xsd, are checked (and these fixed values are the reasons why Decimal is used!)

Parameters:
  • v - the literal string defined as a double @return Decimal
Raises:
  • ValueError - invalid value

_strToFloat(v)

source code 

Test and convert a float value into Decimal or (python) float. Raises an exception if the number is outside the permitted range, ie, 1.0E+40 and 1.0E-50. (And these fixed values are the reasons why Decimal is used!)

Parameters:
  • v - the literal string defined as a float @return Decimal if the local python version is >= 2.4, float otherwise
Raises:
  • ValueError - invalid value

_strToHexBinary(v)

source code 

Test (and convert) hexa integer values. The number of characters should be even.

Parameters:
  • v - the literal string defined as a hexa number @return long value
Raises:
  • ValueError - invalid value

_strToDateTimeAndStamp(incoming_v, timezone_required=False)

source code 

Test (and convert) datetime and date timestamp values.

Parameters:
  • incoming_v - the literal string defined as the date and time
  • timezone_required - whether the timezone is required (ie, for date timestamp) or not @return datetime
Returns: datetime.datetime
Raises:
  • ValueError - invalid datetime or date timestamp

_strToTime(incoming_v)

source code 

Test (and convert) time values.

Parameters:
  • incoming_v - the literal string defined as time value @return time @rtype datetime.time
Raises:
  • ValueError - invalid datetime or date timestamp

_strToDate(incoming_v)

source code 

Test (and convert) date values.

Parameters:
  • incoming_v - the literal string defined as date (in iso format) @return date @return datetime.date
Raises:
  • ValueError - invalid datetime or date timestamp

_strTogYearMonth(v)

source code 

Test gYearMonth value

Parameters:
  • v - the literal string @return v
Raises:
  • ValueError - invalid value

_strTogYear(v)

source code 

Test gYear value

Parameters:
  • v - the literal string @return v
Raises:
  • ValueError - invalid value

_strTogMonthDay(v)

source code 

Test gYearMonth value

Parameters:
  • v - the literal string @return v
Raises:
  • ValueError - invalid value

_strTogDay(v)

source code 

Test gYearMonth value

Parameters:
  • v - the literal string @return v
Raises:
  • ValueError - invalid value

_strTogMonth(v)

source code 

Test gYearMonth value

Parameters:
  • v - the literal string @return v
Raises:
  • ValueError - invalid value

_strToXMLLiteral(v)

source code 

Test (and convert) XML Literal values.

Parameters:
  • v - the literal string defined as an xml literal @return the canonical version of the same xml text
Raises:
  • ValueError - incorrect xml string

_strToVal_Regexp(v, regexp, flag=0, excludeStart=[])

source code 

Test (and convert) a generic string type, with a check against a regular expression.

Parameters:
  • v - the literal string to be converted
  • regexp - the regular expression to check against
  • flag - flags to be used in the regular expression
  • excludeStart - array of characters disallowed in the first position @return original string
Raises:
  • ValueError - invalid value

_strToToken(v)

source code 

Test (and convert) a string to a token.

Parameters:
  • v - the literal string to be converted @return original string
Raises:
  • ValueError - invalid value

_strToPlainLiteral(v)

source code 

Test (and convert) a plain literal

Parameters:
  • v - the literal to be converted @return a new RDFLib Literal with language tag
Raises:
  • ValueError - invalid value

use_Alt_lexical_conversions()

source code 

Registering the datatypes item for RDFLib, ie, bind the dictionary values. The 'bind' method of RDFLib adds extra datatypes to the registered ones in RDFLib, though the table used here (ie, AltXSDToPYTHON) actually overrides all of the default conversion routines. The method also add a Decimal entry to the PythonToXSD array of RDFLib.


Variables Details [hide private]

__license__

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

_hexc

Value:
['A', 'B', 'C', 'D', 'E', 'F', 'a', 'b', 'c', 'd', 'e', 'f']

_re_Name_ex

Value:
['.', '-', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0']

_re_NCName_ex

Value:
['.', '-', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0']

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\
...

OWL-RL-7.1.4/Doc_OLD/RDFClosure.DatatypeHandling-pysrc.html000066400000000000000000005473641504201166100231340ustar00rootroot00000000000000 RDFClosure.DatatypeHandling
Package RDFClosure :: Module DatatypeHandling
[hide private]
[frames] | no frames]

Source Code for Module RDFClosure.DatatypeHandling

  1  #!/d/Bin/Python/python.exe 
  2  # -*- coding: utf-8 -*- 
  3  # 
  4  """ 
  5  Most of the XSD datatypes are handled directly by RDFLib. However, in some cases, that is not good enough. There are two 
  6  major reasons for this: 
  7   
  8   1. Some datatypes are missing from RDFLib and required by OWL 2 RL and/or RDFS 
  9   2. In other cases, though the datatype is present, RDFLib is fairly lax in checking the lexical value of those datatypes. Typical case is boolean. 
 10   
 11  Some of these deficiencies are handled by this module. All the functions convert the lexical value into a 
 12  python datatype (or return the original string if this is not possible) which will be used, eg, 
 13  for comparisons (equalities). If the lexical value constraints are not met, exceptions are raised. 
 14   
 15  @requires: U{RDFLib<https://github.com/RDFLib/rdflib>}, 4.0.0 and higher 
 16  @license: This software is available for use under the U{W3C Software License<http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231>} 
 17  @organization: U{World Wide Web Consortium<http://www.w3.org>} 
 18  @author: U{Ivan Herman<a href="http://www.w3.org/People/Ivan/">} 
 19  """ 
 20   
 21  __author__  = 'Ivan Herman' 
 22  __contact__ = 'Ivan Herman, ivan@w3.org' 
 23  __license__ = u'W3C® SOFTWARE NOTICE AND LICENSE, http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231' 
 24   
 25  # noinspection PyPep8Naming 
 26  from RDFClosure.RDFS import RDFNS as ns_rdf 
 27   
 28  from rdflib.term import XSDToPython, Literal, _toPythonMapping 
 29  # noinspection PyPep8Naming 
 30  from rdflib.namespace import XSD as ns_xsd 
 31   
 32  import datetime, time, re 
 33  from decimal import Decimal 
 34   
 35  # noinspection PyMissingConstructor,PyPep8Naming 
36 -class _namelessTZ(datetime.tzinfo):
37 """(Nameless) timezone object. The python datetime object requires timezones as 38 a specific object added to the conversion, rather than the explicit hour and minute 39 difference used by XSD. This class is used to wrap around the hour/minute values. 40 """
41 - def __init__(self, hours, minutes):
42 """ 43 @param hours: hour offset 44 @param minutes: minute offset 45 """ 46 self.__offset = datetime.timedelta(hours=hours, minutes=minutes) 47 self.__name = "nameless"
48
49 - def utcoffset(self, dt):
50 return self.__offset
51
52 - def tzname(self, dt):
53 return self.__name
54
55 - def dst(self, dt):
56 return datetime.timedelta(0)
57 58 # noinspection PyPep8Naming
59 -def _returnTimeZone(incoming_v):
60 """Almost all time/date related methods require the extraction of an optional time zone information. 61 @param incoming_v: the time/date string 62 @return (v,timezone) tuple; 'v' is the input string with the timezone info cut off, 'timezone' is a L{_namelessTZ} instance or None 63 """ 64 if incoming_v[-1] == 'Z': 65 v = incoming_v[:-1] 66 tzone = _namelessTZ(0,0) 67 else : 68 pattern = ".*(\+|-)([0-9][0-9]):([0-9][0-9])" 69 match = re.match(pattern,incoming_v) 70 if match is None: 71 v = incoming_v 72 tzone = None 73 else : 74 hours = int(match.groups()[1]) 75 if match.groups()[0] == '-': 76 hours = -hours - 1 77 minutes = int(match.groups()[2]) 78 v = incoming_v[:-6] 79 tzone = _namelessTZ(hours,minutes) 80 return v, tzone
81 82 83 #################################### Booleans ################################################## 84 # noinspection PyPep8Naming
85 -def _strToBool(v) :
86 """The built-in conversion to boolean is way too lax. The xsd specification requires that only true, false, 1 or 0 should be used... 87 @param v: the literal string defined as boolean 88 @return corresponding boolean value 89 @raise ValueError: invalid boolean values 90 """ 91 if v.lower() == "true" or v.lower() == "1": 92 return True 93 elif v.lower() == "false" or v.lower() == "0": 94 return False 95 else : 96 raise ValueError("Invalid boolean literal value %s" % v)
97 98 99 #################################### Decimals ################################################## 100 # noinspection PyPep8Naming
101 -def _strToDecimal(v) :
102 """The built in datatype handling for RDFLib maps a decimal number to float, but the python version 2.4 and upwards also 103 has a Decimal number. Better make use of that to use very high numbers. 104 However, there is also a big difference between Python's decimal and XSD's decimal, because the latter does not allow 105 for an exponential normal form (why???). This must be filtered out. 106 @param v: the literal string defined as decimal 107 @return Decimal 108 @raise ValueError: invalid decimal value 109 """ 110 # check whether the lexical form of 'v' is o.k. 111 if v.find('E') != -1 or v.find('e') != -1 : 112 # this is an invalid lexical form, though would be accepted by Python 113 raise ValueError("Invalid decimal literal value %s" % v) 114 else : 115 return Decimal(v)
116 117 #################################### ANY URIS ################################################## 118 #: set of characters allowed in a hexadecimal number 119 _hexc = ['A','B','C','D','E','F','a','b','c','d','e','f'] 120 #: set of numerals 121 _numb = ['1','2','3','4','5','6','7','8','9','0'] 122 # noinspection PyPep8Naming
123 -def _strToAnyURI(v) :
124 """Rudimentary test for the AnyURI value. If it is a relative URI, then some tests are done to filter out 125 mistakes. I am not sure this is the full implementation of the RFC, though, may have to be checked at some point 126 later. 127 @param v: the literal string defined as a URI 128 @return the incoming value 129 @raise ValueError: invalid URI value 130 """ 131 import urlparse 132 if len(v) == 0 : return v 133 if urlparse.urlsplit(v)[0] != "": 134 # this means that there is a proper scheme, the URI should be kosher 135 return v 136 else : 137 # this is meant to be a relative URI. 138 # If I am correct, that cannot begin with one or more "?" or ":" characters 139 # all others are o.k. 140 # if it begins with a % then it should be followed by two hexa characters, 141 # otherwise it is also a bug 142 if v[0] == '%': 143 if len(v) >= 3 and (v[1] in _hexc or v[1] in _numb) and (v[2] in _hexc or v[2] in _numb) : 144 return v 145 else : 146 raise ValueError("Invalid IRI %s" % v) 147 elif v[0] == '?' or v[0] == ':': 148 raise ValueError("Invalid IRI %s" % v) 149 else : 150 return v
151 152 #################################### Base64Binary ################################################## 153 # noinspection PyPep8Naming
154 -def _strToBase64Binary(v) :
155 """Rudimentary test for the base64Binary value. The problem is that the built-in b64 module functions ignore the 156 fact that only a certain family of characters are allowed to appear in the lexical value, so this is checked first. 157 @param v: the literal string defined as a base64encoded string 158 @return the decoded (binary) content 159 @raise ValueError: invalid base 64 binary value 160 """ 161 import base64 162 if v.replace('=', 'x').replace('+', 'y').replace('/', 'z').isalnum() : 163 try : 164 return base64.standard_b64decode(v) 165 except : 166 raise ValueError("Invalid Base64Binary %s" % v) 167 else : 168 raise ValueError("Invalid Base64Binary %s" % v)
169 170 #################################### Numerical types ################################################## 171 #: limits for unsigned bytes 172 _limits_unsignedByte = [-1, 256] 173 174 #: limits for bytes 175 _limits_byte = [-129, 128] 176 177 #: limits for unsigned int 178 _limits_unsignedInt = [-1, 4294967296] 179 180 #: limits for int 181 _limits_int = [-2147483649, 2147483648] 182 183 #: limits for unsigned short 184 _limits_unsignedShort = [-1, 65536] 185 186 #: limits for short 187 _limits_short = [-32769, 32768] 188 189 #: limits for unsigned long 190 _limits_unsignedLong = [-1, 18446744073709551616] 191 192 #: limits for long 193 _limits_long = [-9223372036854775809, 9223372036854775808] 194 195 #: limits for positive integer 196 _limits_positiveInteger = [0, None] 197 198 #: limits for non positive integer 199 _limits_nonPositiveInteger = [None, 1] 200 201 #: limits for non negative integer 202 _limits_nonNegativeInteger = [-1, None] 203 204 #: limits for negative integer 205 _limits_negativeInteger = [None, 0] 206 207 # noinspection PyPep8Naming,PyBroadException
208 -def _strToBoundNumeral(v, interval, conversion) :
209 """Test (and convert) a generic numerical type, with a check against a lower and upper limit. 210 @param v: the literal string to be converted 211 @param interval: lower and upper bounds (non inclusive). If the value is None, no comparison should be done 212 @param conversion: conversion function, ie, int, long, etc 213 @raise ValueError: invalid value 214 """ 215 try: 216 i = conversion(v) 217 if (interval[0] is None or interval[0] < i) and (interval[1] is None or i < interval[1]) : 218 return i 219 except: 220 pass 221 raise ValueError("Invalid numerical value %s" % v)
222 223 #################################### Double and float ################################################## 224 # noinspection PyPep8Naming
225 -def _strToDouble(v):
226 """Test and convert a double value into a Decimal or float. Raises an exception if the number is outside the permitted 227 range, ie, 1.0E+310 and 1.0E-330. To be on the safe side (python does not have double!) Decimals are used 228 if possible. Upper and lower values, as required by xsd, are checked (and these fixed values are the reasons 229 why Decimal is used!) 230 231 @param v: the literal string defined as a double 232 @return Decimal 233 @raise ValueError: invalid value 234 """ 235 try : 236 value = Decimal(v) 237 upper = Decimal("1.0E+310") 238 lower = Decimal("1.0E-330") 239 if lower < abs(value) < upper : 240 # bingo 241 return value 242 else : 243 raise ValueError("Invalid double %s" % v) 244 except : 245 # there was a problem in creating a decimal... 246 raise ValueError("Invalid double %s" % v)
247 248 # noinspection PyPep8Naming
249 -def _strToFloat(v):
250 """Test and convert a float value into Decimal or (python) float. Raises an exception if the number is outside the 251 permitted range, ie, 1.0E+40 and 1.0E-50. (And these fixed values are the reasons why Decimal is used!) 252 253 @param v: the literal string defined as a float 254 @return Decimal if the local python version is >= 2.4, float otherwise 255 @raise ValueError: invalid value 256 """ 257 try : 258 value = Decimal(v) 259 upper = Decimal("1.0E+40") 260 lower = Decimal("1.0E-50") 261 if lower < abs(value) < upper : 262 # bingo 263 return value 264 else : 265 raise ValueError("Invalid float %s" % v) 266 except : 267 # there was a problem in creating a decimal... 268 raise ValueError("Invalid float %s" % v)
269 270 #################################### hexa ################################################## 271 # noinspection PyPep8Naming
272 -def _strToHexBinary(v):
273 """Test (and convert) hexa integer values. The number of characters should be even. 274 @param v: the literal string defined as a hexa number 275 @return long value 276 @raise ValueError: invalid value 277 """ 278 # first of all, the number of characters must be even according to the xsd spec: 279 length = len(v) 280 if (length / 2) * 2 != length : 281 raise ValueError("Invalid hex binary number %s" % v) 282 return long(v, 16)
283 284 #################################### Datetime, date timestamp, etc ################################ 285 286 # noinspection PyPep8Naming
287 -def _strToDateTimeAndStamp(incoming_v, timezone_required=False):
288 """Test (and convert) datetime and date timestamp values. 289 @param incoming_v: the literal string defined as the date and time 290 @param timezone_required: whether the timezone is required (ie, for date timestamp) or not 291 @return datetime 292 @rtype: datetime.datetime 293 @raise ValueError: invalid datetime or date timestamp 294 """ 295 296 # First, handle the timezone portion, if there is any 297 (v, tzone) = _returnTimeZone(incoming_v) 298 299 # Check on the timezone. For time date stamp object it is required 300 if timezone_required and tzone is None : 301 raise ValueError("Invalid datetime %s" % incoming_v) 302 303 # The microseconds should be handled here... 304 final_v = v 305 milliseconds = 0 306 milpattern = "(.*)(\.)([0-9]*)" 307 match = re.match(milpattern, v) 308 if match is not None : 309 # we have a millisecond portion... 310 try : 311 final_v = match.groups()[0] 312 milliseconds = int(match.groups()[2]) 313 except : 314 raise ValueError("Invalid datetime %s" % incoming_v) 315 # 316 # By now, the pattern should be clear 317 # This may raise an exception... 318 try : 319 tstr = time.strptime(final_v, "%Y-%m-%dT%H:%M:%S") 320 if tzone is not None : 321 return datetime.datetime(tstr.tm_year, tstr.tm_mon, tstr.tm_mday, tstr.tm_hour, tstr.tm_min, tstr.tm_sec, milliseconds, tzone) 322 else : 323 return datetime.datetime(tstr.tm_year, tstr.tm_mon, tstr.tm_mday, tstr.tm_hour, tstr.tm_min, tstr.tm_sec, milliseconds) 324 except : 325 raise ValueError("Invalid datetime %s" % incoming_v)
326 327 # noinspection PyPep8Naming
328 -def _strToTime(incoming_v):
329 """Test (and convert) time values. 330 @param incoming_v: the literal string defined as time value 331 @return time 332 @rtype datetime.time 333 @raise ValueError: invalid datetime or date timestamp 334 """ 335 336 # First, handle the timezone portion, if there is any 337 (v, tzone) = _returnTimeZone(incoming_v) 338 339 # The microseconds should be handled here... 340 final_v = v 341 milliseconds = 0 342 milpattern = "(.*)(\.)([0-9]*)" 343 match = re.match(milpattern, v) 344 if match is not None: 345 # we have a millisecond portion... 346 try : 347 final_v = match.groups()[0] 348 milliseconds = int(match.groups()[2]) 349 except : 350 raise ValueError("Invalid datetime %s" % incoming_v) 351 # 352 # By now, the pattern should be clear 353 # This may raise an exception... 354 try : 355 tstr = time.strptime(final_v,"%H:%M:%S") 356 if tzone is not None: 357 return datetime.time(tstr.tm_hour, tstr.tm_min, tstr.tm_sec, milliseconds, tzone) 358 else : 359 return datetime.time(tstr.tm_hour, tstr.tm_min, tstr.tm_sec, milliseconds) 360 except : 361 raise ValueError("Invalid time %s" % incoming_v)
362 363 # noinspection PyPep8Naming
364 -def _strToDate(incoming_v):
365 """Test (and convert) date values. 366 @param incoming_v: the literal string defined as date (in iso format) 367 @return date 368 @return datetime.date 369 @raise ValueError: invalid datetime or date timestamp 370 """ 371 372 # First, handle the timezone portion, if there is any 373 (final_v, tzone) = _returnTimeZone(incoming_v) 374 375 # This may raise an exception... 376 try : 377 tstr = time.strptime(final_v,"%Y-%m-%d") 378 return datetime.date(tstr.tm_year, tstr.tm_mon, tstr.tm_mday) 379 except : 380 raise ValueError("Invalid date %s" % incoming_v)
381 382 #################################### The 'g' series for dates ############################ 383 # The 'g' datatypes (eg, gYear) cannot be directly represented as a python datatype 384 # the series of methods below simply check whether the incoming string is o.k., but the 385 # returned value is the same as the original 386 # noinspection PyPep8Naming
387 -def _strTogYearMonth(v):
388 """Test gYearMonth value 389 @param v: the literal string 390 @return v 391 @raise ValueError: invalid value 392 """ 393 try : 394 time.strptime(v+"-01", "%Y-%m-%d") 395 return v 396 except : 397 raise ValueError("Invalid gYearMonth %s" % v)
398 399 # noinspection PyPep8Naming
400 -def _strTogYear(v) :
401 """Test gYear value 402 @param v: the literal string 403 @return v 404 @raise ValueError: invalid value 405 """ 406 try : 407 time.strptime(v+"-01-01", "%Y-%m-%d") 408 return v 409 except : 410 raise ValueError("Invalid gYear %s" % v)
411 412 # noinspection PyPep8Naming
413 -def _strTogMonthDay(v) :
414 """Test gYearMonth value 415 @param v: the literal string 416 @return v 417 @raise ValueError: invalid value 418 """ 419 try : 420 time.strptime("2008-" + v, "%Y-%m-%d") 421 return v 422 except : 423 raise ValueError("Invalid gMonthDay %s" % v)
424 425 # noinspection PyPep8Naming
426 -def _strTogDay(v):
427 """Test gYearMonth value 428 @param v: the literal string 429 @return v 430 @raise ValueError: invalid value 431 """ 432 try : 433 time.strptime("2001-01-" + v, "%Y-%m-%d") 434 return v 435 except : 436 raise ValueError("Invalid gDay %s" % v)
437 438 # noinspection PyPep8Naming
439 -def _strTogMonth(v):
440 """Test gYearMonth value 441 @param v: the literal string 442 @return v 443 @raise ValueError: invalid value 444 """ 445 try : 446 time.strptime("2001-" + v + "-01", "%Y-%m-%d") 447 return v 448 except : 449 raise ValueError("Invalid gMonth %s" % v)
450 451 #################################### XML Literal ######################################### 452 # noinspection PyPep8Naming
453 -def _strToXMLLiteral(v):
454 """Test (and convert) XML Literal values. 455 @param v: the literal string defined as an xml literal 456 @return the canonical version of the same xml text 457 @raise ValueError: incorrect xml string 458 """ 459 import xml.dom.minidom 460 try : 461 dom = xml.dom.minidom.parseString(v) 462 return dom.toxml() 463 except : 464 raise ValueError("Invalid XML Literal %s" % v)
465 466 #################################### language, NMTOKEN, NAME, etc ######################### 467 #: regular expression for a 'language' datatype 468 _re_language = "[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*" 469 470 #: regexp for NMTOKEN. It must be used with a re.U flag (the '(?U' regexp form did not work. It may depend on the locale...) 471 _re_NMTOKEN = "[\w:_.\-]+" 472 473 #: characters not permitted at a starting position for Name (otherwise Name is like NMTOKEN 474 _re_Name_ex = ['.','-'] + _numb 475 476 #: regexp for NCName. It must be used with a re.U flag (the '(?U' regexp form did not work. It may depend on the locale...) 477 _re_NCName = "[\w_.\-]+" 478 479 #: characters not permitted at a starting position for NCName 480 _re_NCName_ex = ['.','-'] + _numb 481 482 # noinspection PyDefaultArgument,PyPep8Naming,PyPep8Naming
483 -def _strToVal_Regexp(v, regexp, flag = 0, excludeStart=[]) :
484 """Test (and convert) a generic string type, with a check against a regular expression. 485 @param v: the literal string to be converted 486 @param regexp: the regular expression to check against 487 @param flag: flags to be used in the regular expression 488 @param excludeStart: array of characters disallowed in the first position 489 @return original string 490 @raise ValueError: invalid value 491 """ 492 match = re.match(regexp, v, flag) 493 if match is None or match.end() != len(v): 494 raise ValueError("Invalid literal %s" % v) 495 else : 496 if len(excludeStart) > 0 and v[0] in excludeStart: 497 raise ValueError("Invalid literal %s" % v) 498 return v
499 500 #: Disallowed characters in a token or a normalized string, as a regexp 501 _re_token = "[^\n\t\r]+" 502 503 # noinspection PyPep8Naming
504 -def _strToToken(v):
505 """Test (and convert) a string to a token. 506 @param v: the literal string to be converted 507 @return original string 508 @raise ValueError: invalid value 509 """ 510 if len(v) == 0: 511 return v 512 # filter out the case when there are new lines and similar (if there is a problem, an exception is raised) 513 _strToVal_Regexp(v, _re_token) 514 v1 = ' '.join(v.strip().split()) 515 # normalize the string, and see if the result is the same: 516 if len(v1) == len(v): 517 # no characters lost, ie, no unnecessary spaces 518 return v 519 else : 520 raise ValueError("Invalid literal %s" % v)
521 522 #################################### plain literal ######################################## 523 # noinspection PyPep8Naming
524 -def _strToPlainLiteral(v):
525 """Test (and convert) a plain literal 526 @param v: the literal to be converted 527 @return a new RDFLib Literal with language tag 528 @raise ValueError: invalid value 529 """ 530 reg = "(.*)@([^@]*)" 531 # a plain literal must match this regexp! 532 match = re.match(reg,v) 533 if match is None : 534 raise ValueError("Invalid plain literal %s" % v) 535 else : 536 lit = match.groups()[0] 537 if len(match.groups()) == 1 or match.groups()[1] == "" : 538 # no language tag 539 return Literal(lit) 540 else : 541 lang = match.groups()[1] 542 # check if this is a correct language tag. Note that can raise an exception! 543 try : 544 lang = _strToVal_Regexp(lang, _re_language) 545 return Literal(lit,lang=lang.lower()) 546 except : 547 raise ValueError("Invalid plain literal %s" % v)
548 549 ##################################################################################### 550 #: Replacement of RDFLib's conversion function. Each entry assigns a function to an XSD datatype, attempting to convert a string to a Python datatype (or raise an exception if some problem is found) 551 AltXSDToPYTHON = { 552 ns_xsd["language"] : lambda v: _strToVal_Regexp(v, _re_language), 553 ns_xsd["NMTOKEN"] : lambda v: _strToVal_Regexp(v, _re_NMTOKEN, re.U), 554 ns_xsd["Name"] : lambda v: _strToVal_Regexp(v, _re_NMTOKEN, re.U, _re_Name_ex), 555 ns_xsd["NCName"] : lambda v: _strToVal_Regexp(v, _re_NCName, re.U, _re_NCName_ex), 556 ns_xsd["token"] : _strToToken, 557 ns_rdf["PlainLiteral"] : _strToPlainLiteral, 558 ns_xsd["boolean"] : _strToBool, 559 ns_xsd["decimal"] : _strToDecimal, 560 ns_xsd["anyURI"] : _strToAnyURI, 561 ns_xsd["base64Binary"] : _strToBase64Binary, 562 ns_xsd["double"] : _strToDouble, 563 ns_xsd["float"] : _strToFloat, 564 ns_xsd["byte"] : lambda v: _strToBoundNumeral(v, _limits_byte, int), 565 ns_xsd["int"] : lambda v: _strToBoundNumeral(v, _limits_int, long), 566 ns_xsd["long"] : lambda v: _strToBoundNumeral(v, _limits_long, long), 567 ns_xsd["positiveInteger"] : lambda v: _strToBoundNumeral(v, _limits_positiveInteger, long), 568 ns_xsd["nonPositiveInteger"] : lambda v: _strToBoundNumeral(v, _limits_nonPositiveInteger, long), 569 ns_xsd["negativeInteger"] : lambda v: _strToBoundNumeral(v, _limits_negativeInteger, long), 570 ns_xsd["nonNegativeInteger"] : lambda v: _strToBoundNumeral(v, _limits_nonNegativeInteger, long), 571 ns_xsd["short"] : lambda v: _strToBoundNumeral(v, _limits_short, int), 572 ns_xsd["unsignedByte"] : lambda v: _strToBoundNumeral(v, _limits_unsignedByte, int), 573 ns_xsd["unsignedShort"] : lambda v: _strToBoundNumeral(v, _limits_unsignedShort, int), 574 ns_xsd["unsignedInt"] : lambda v: _strToBoundNumeral(v, _limits_unsignedInt, long), 575 ns_xsd["unsignedLong"] : lambda v: _strToBoundNumeral(v, _limits_unsignedLong, long), 576 ns_xsd["hexBinary"] : _strToHexBinary, 577 ns_xsd["dateTime"] : lambda v: _strToDateTimeAndStamp(v, False), 578 ns_xsd["dateTimeStamp"] : lambda v: _strToDateTimeAndStamp(v, True), 579 ns_rdf["XMLLiteral"] : _strToXMLLiteral, 580 ns_xsd["integer"] : long, 581 ns_xsd["string"] : lambda v: v, 582 ns_rdf["HTML"] : lambda v: v, 583 ns_xsd["normalizedString"] : lambda v: _strToVal_Regexp(v, _re_token), 584 585 # These are RDFS specific... 586 ns_xsd["time"] : _strToTime, 587 ns_xsd["date"] : _strToDate, 588 ns_xsd["gYearMonth"] : _strTogYearMonth, 589 ns_xsd["gYear"] : _strTogYear, 590 ns_xsd["gMonthDay"] : _strTogMonthDay, 591 ns_xsd["gDay"] : _strTogDay, 592 ns_xsd["gMonth"] : _strTogMonth, 593 } 594 595 # noinspection PyPep8Naming
597 """Registering the datatypes item for RDFLib, ie, bind the dictionary values. The 'bind' method of RDFLib adds 598 extra datatypes to the registered ones in RDFLib, though the table used here (ie, L{AltXSDToPYTHON}) actually overrides 599 all of the default conversion routines. The method also add a Decimal entry to the PythonToXSD array of RDFLib. 600 """ 601 _toPythonMapping.update(AltXSDToPYTHON)
602 603 # noinspection PyPep8Naming
605 """Restore the original (ie, RDFLib) set of lexical conversion routines. 606 """ 607 _toPythonMapping.update(XSDToPython)
608 609 ####################################################################################### 610 # This module can pretty much tested individually... 611 if __name__ == '__main__' : 612 import sys 613 dtype = sys.argv[1] 614 string = sys.argv[2] 615 datatype = ns_xsd[dtype] 616 result = AltXSDToPYTHON[datatype](string) 617 print type(result) 618 print result 619

OWL-RL-7.1.4/Doc_OLD/RDFClosure.DatatypeHandling._namelessTZ-class.html000066400000000000000000000334131504201166100253050ustar00rootroot00000000000000 RDFClosure.DatatypeHandling._namelessTZ
Package RDFClosure :: Module DatatypeHandling :: Class _namelessTZ
[hide private]
[frames] | no frames]

Class _namelessTZ

source code

     object --+    
              |    
datetime.tzinfo --+
                  |
                 _namelessTZ

(Nameless) timezone object. The python datetime object requires timezones as a specific object added to the conversion, rather than the explicit hour and minute difference used by XSD. This class is used to wrap around the hour/minute values.

Instance Methods [hide private]
 
__init__(self, hours, minutes)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
utcoffset(self, dt)
datetime -> minutes east of UTC (negative for west of UTC).
source code
 
tzname(self, dt)
datetime -> string name of time zone.
source code
 
dst(self, dt)
datetime -> DST offset in minutes east of UTC.
source code

Inherited from datetime.tzinfo: __getattribute__, __new__, __reduce__, fromutc

Inherited from object: __delattr__, __format__, __hash__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, hours, minutes)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  • hours - hour offset
  • minutes - minute offset
Overrides: object.__init__

utcoffset(self, dt)

source code 

datetime -> minutes east of UTC (negative for west of UTC).

Overrides: datetime.tzinfo.utcoffset
(inherited documentation)

tzname(self, dt)

source code 

datetime -> string name of time zone.

Overrides: datetime.tzinfo.tzname
(inherited documentation)

dst(self, dt)

source code 

datetime -> DST offset in minutes east of UTC.

Overrides: datetime.tzinfo.dst
(inherited documentation)

OWL-RL-7.1.4/Doc_OLD/RDFClosure.DeductiveClosure-class.html000066400000000000000000000473311504201166100231170ustar00rootroot00000000000000 RDFClosure.DeductiveClosure
Package RDFClosure :: Class DeductiveClosure
[hide private]
[frames] | no frames]

Class DeductiveClosure

source code

Entry point to generate the deductive closure of a graph. The exact choice deductive closure is controlled by a class reference. The important initialization parameter is the closure_class: a Class object referring to a subclass of Closure.Core. Although this package includes a number of such subclasses (OWLRL_Semantics, RDFS_Semantics, RDFS_OWLRL_Semantics, and OWLRL_Extension), the user can use his/her own if additional rules are implemented.

Note that owl:imports statements are not interpreted in this class, that has to be done beforehand on the graph that is to be expanded.

Instance Methods [hide private]
 
__init__(self, closure_class, improved_datatypes=True, rdfs_closure=False, axiomatic_triples=False, datatype_axioms=False) source code
 
expand(self, graph)
Expand the graph using forward chaining, and with the relevant closure type.
source code
Static Methods [hide private]
 
use_improved_datatypes_conversions()
Switch the system to use the improved datatype conversion routines.
source code
 
use_rdflib_datatypes_conversions()
Switch the system to use the generic (RDFLib) datatype conversion routines
source code
Class Variables [hide private]
boolean improved_datatype_generic = False
Whether the improved set of lexical-to-Python conversions should be used for datatype handling in general, ie, not only for a particular instance and not only for inference purposes.
Instance Variables [hide private]
boolean axiomatic_triples
Whether relevant axiomatic triples are added before chaining, except for datatype axiomatic triples.
Closure.Core closure_class
the class instance used to expand the graph
boolean datatype_axioms
Whether further datatype axiomatic triples are added to the output.
boolean rdfs_closure
Whether the RDFS closure should also be executed.
Method Details [hide private]

__init__(self, closure_class, improved_datatypes=True, rdfs_closure=False, axiomatic_triples=False, datatype_axioms=False)
(Constructor)

source code 
Parameters:
  • closure_class (subclass of Closure.Core) - a closure class reference.
  • rdfs_closure (boolean) - whether RDFS rules are executed or not
  • axiomatic_triples (boolean) - Whether relevant axiomatic triples are added before chaining, except for datatype axiomatic triples. Default: False.
  • datatype_axioms (boolean) - Whether further datatype axiomatic triples are added to the output. Default: false.
  • improved_datatypes (boolean) - Whether the improved set of lexical-to-Python conversions should be used for datatype handling. See the introduction for more details. Default: True.

expand(self, graph)

source code 

Expand the graph using forward chaining, and with the relevant closure type.

Parameters:
  • graph (rdflib.Graph) - the RDF graph

Class Variable Details [hide private]

improved_datatype_generic

Whether the improved set of lexical-to-Python conversions should be used for datatype handling in general, ie, not only for a particular instance and not only for inference purposes. Default: False.
Type:
boolean
Value:
False

Instance Variable Details [hide private]

axiomatic_triples

Whether relevant axiomatic triples are added before chaining, except for datatype axiomatic triples. Default: False.
Type:
boolean

datatype_axioms

Whether further datatype axiomatic triples are added to the output. Default: false.
Type:
boolean

rdfs_closure

Whether the RDFS closure should also be executed. Default: False.
Type:
boolean

OWL-RL-7.1.4/Doc_OLD/RDFClosure.Literals-module.html000066400000000000000000000250701504201166100216010ustar00rootroot00000000000000 RDFClosure.Literals
Package RDFClosure :: Module Literals
[hide private]
[frames] | no frames]

Module Literals

source code

Separate module to handle literals.

The issue is that pure literals cannot appear in subject position according to the current rules on RDF. That means that different types of conclusions cannot properly finish. The present trick is trying to get around the problem as follows:

  1. For all literals in the graph a bnode is created. The module does not do a full D entailment but just relies on RDFLib's ability to recognize identical literals
  2. All those bnodes get a type Literal
  3. All triples with literals are exchanged against a triple with the associated bnode

The inferences are then calculated with the modified Graph. At the end of the process, the above steps are done backwards: for all triples where a bnode representing a literal appear in object position, a triple is generated; however, all triples where the bnode appears in a subject position are removed from the final graph.


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]
  _LiteralStructure
This class serves as a wrapper around rdflib's Literal, by changing the equality function to a strict identity of datatypes and lexical values.
  LiteralProxies
Variables [hide private]
  __author__ = 'Ivan Herman'
  __license__ = u'W3C® SOFTWARE NOTICE AND LICENSE, http://www.w...
  __package__ = 'RDFClosure'

Imports: BNode, rdflibLiteral, ns_xsd, type, Literal, AltXSDToPYTHON


Variables Details [hide private]

__license__

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

OWL-RL-7.1.4/Doc_OLD/RDFClosure.Literals-pysrc.html000066400000000000000000002041001504201166100214450ustar00rootroot00000000000000 RDFClosure.Literals
Package RDFClosure :: Module Literals
[hide private]
[frames] | no frames]

Source Code for Module RDFClosure.Literals

  1  # -*- coding: utf-8 -*- 
  2  # 
  3  """ 
  4  Separate module to handle literals.  
  5   
  6  The issue is that pure literals cannot appear in subject position according to the current rules on RDF. That means that 
  7  different types of conclusions cannot properly finish. The present trick is trying to get around the problem as follows: 
  8   
  9   1. For all literals in the graph a bnode is created. The module does not do a full D entailment but just relies on RDFLib's ability to recognize identical literals 
 10   2. All those bnodes get a type Literal 
 11   3. All triples with literals are exchanged against a triple with the associated bnode 
 12   
 13  The inferences are then calculated with the modified Graph. At the end of the process, the above steps are done backwards: for all triples where  
 14  a bnode representing a literal appear in object position, a triple is generated; however, all triples where the bnode appears in a 
 15  subject position are removed from the final graph. 
 16   
 17   
 18  @requires: U{RDFLib<https://github.com/RDFLib/rdflib>}, 4.0.0 and higher 
 19  @license: This software is available for use under the U{W3C Software License<http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231>} 
 20  @organization: U{World Wide Web Consortium<http://www.w3.org>} 
 21  @author: U{Ivan Herman<a href="http://www.w3.org/People/Ivan/">} 
 22   
 23  """ 
 24   
 25  __author__  = 'Ivan Herman' 
 26  __contact__ = 'Ivan Herman, ivan@w3.org' 
 27  __license__ = u'W3C® SOFTWARE NOTICE AND LICENSE, http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231' 
 28   
 29  from rdflib import BNode 
 30  from rdflib import Literal as rdflibLiteral 
 31  from rdflib.namespace import XSD as ns_xsd 
 32   
 33  from .RDFS import type 
 34  from .RDFS import Literal 
 35  from .DatatypeHandling import AltXSDToPYTHON 
 36   
 37   
38 -class _LiteralStructure :
39 """This class serves as a wrapper around rdflib's Literal, by changing the equality function to a strict 40 identity of datatypes and lexical values. 41 42 On the other hand, to implement, eg, OWL RL's datatype rules, a should be able to generate 43 an 'a sameAs b' triple, ie, the distinction should be kept. Hence this class that overrides the equality, 44 and then can be used as a key in a Python dictionary. 45 """ 46 47 # noinspection PyPep8
48 - def __init__(self, lit) :
49 self.lit = lit 50 self.lex = str(lit) 51 self.dt = lit.datatype 52 self.lang = lit.language 53 self.value = lit.value
54 55 # def compare_value(self, other ) : 56 # """Compare to literal structure instances for equality. Here equality means in the sense of datatype values 57 # @return: comparison result 58 # @rtype: boolean 59 # """ 60 # try: 61 # if self.dt == OWLNS["rational"] and other.dt == OWLNS["rational"] : 62 # return self.value == other.value 63 # elif self.dt == OWLNS["rational"] and other.dt != OWLNS["rational"] : 64 # l = rdflibLiteral(float(self.lit._cmp_value)) 65 # return l == other.lit 66 # elif self.dt != OWLNS["rational"] and other.dt == OWLNS["rational"] : 67 # l = rdflibLiteral(float(other.lit._cmp_value)) 68 # return self.lit == l 69 # else : 70 # return self.lit == other.lit 71 # except: 72 # # There might be conversion problems... 73 # return False 74 75 # noinspection PyBroadException
76 - def compare_value(self, other) :
77 """Compare to literal structure instances for equality. Here equality means in the sense of datatype values 78 @return: comparison result 79 @rtype: boolean 80 """ 81 try: 82 return self.lit == other.lit 83 except: 84 # There might be conversion problems... 85 return False
86
87 - def __eq__(self, other) :
88 if other is None : 89 return False 90 else : 91 return self.lex == other.lex and self.dt == other.dt and self.lang == other.lang
92
93 - def __ne__(self, other) :
94 return not self.__eq__(other)
95
96 - def __hash__(self) :
97 if self.dt is not None : 98 return hash(self.lit) ^ hash(self.dt) 99 else : 100 return hash(self.lit)
101
102 - def __repr__(self) :
103 retval = "" 104 retval += "lexical value: %s; " % self.lex 105 retval += "datatype: %s; " % self.dt 106 retval += "language tag: %s; " % self.lang 107 return retval
108 109
110 -class LiteralProxies :
111 # noinspection PyPep8
112 - def __init__(self, graph, closure) :
113 """ 114 @param graph: the graph to be modified 115 """ 116 self.lit_to_bnode = {} 117 self.bnode_to_lit = {} 118 self.graph = graph 119 120 to_be_removed = [] 121 to_be_added = [] 122 for t in self.graph : 123 (subj, pred, obj) = t 124 # This is supposed to be a "proper" graph, so only the obj may be a literal 125 if isinstance(obj, rdflibLiteral): 126 # Test the validity of the datatype 127 if obj.datatype: 128 try: 129 AltXSDToPYTHON[obj.datatype](str(obj)) 130 except ValueError: 131 closure.add_error("Lexical value of the literal '%s' does not match its datatype (%s)" % (str(obj), obj.datatype)) 132 133 # In any case, this should be removed: 134 if t not in to_be_removed: 135 to_be_removed.append(t) 136 # Check if a BNode has already been associated with that literal 137 obj_st = _LiteralStructure(obj) 138 found = False 139 for l in self.lit_to_bnode.keys() : 140 if obj_st.lex == l.lex and obj_st.dt == l.dt and obj_st.lang == l.lang : 141 t1 = (subj, pred, self.lit_to_bnode[l]) 142 to_be_added.append(t1) 143 found = True 144 break 145 if not found: 146 # the bnode has to be created 147 bn = BNode() 148 # store this in the internal administration 149 self.lit_to_bnode[obj_st] = bn 150 self.bnode_to_lit[bn] = obj_st 151 # modify the graph 152 to_be_added.append((subj, pred, bn)) 153 to_be_added.append((bn, type, Literal)) 154 # Furthermore: a plain literal should be identified with a corresponding xsd:string and vice versa, 155 # cf, RDFS Semantics document 156 if obj_st.dt is None and obj_st.lang is None: 157 newLit = rdflibLiteral(obj_st.lex, datatype=ns_xsd["string"]) 158 new_obj_st = _LiteralStructure(newLit) 159 new_obj_st.dt = ns_xsd["string"] 160 bn2 = BNode() 161 self.lit_to_bnode[new_obj_st] = bn2 162 self.bnode_to_lit[bn2] = new_obj_st 163 to_be_added.append((subj, pred, bn2)) 164 to_be_added.append((bn2, type, Literal)) 165 elif obj_st.dt == ns_xsd["string"]: 166 newLit = rdflibLiteral(obj_st.lex, datatype=None) 167 new_obj_st = _LiteralStructure(newLit) 168 # new_obj_st = _LiteralStructure(obj) # Was this the correct one, or was this an old bug? 169 new_obj_st.dt = None 170 bn2 = BNode() 171 self.lit_to_bnode[new_obj_st] = bn2 172 self.bnode_to_lit[bn2] = new_obj_st 173 to_be_added.append((subj, pred, bn2)) 174 to_be_added.append((bn2, type, Literal)) 175 176 # Do the real modifications 177 self._massageGraph(to_be_removed, to_be_added)
178
179 - def restore(self) :
180 """ 181 This method is to be invoked at the end of the forward chain processing. It restores literals (whenever possible) 182 to their original self... 183 """ 184 to_be_removed = [] 185 to_be_added = [] 186 for t in self.graph : 187 (subj, pred, obj) = t 188 # The two cases, namely when the literal appears in subject or object positions, should be treated differently 189 if subj in self.bnode_to_lit : 190 # well... there may be to cases here: either this is the original tuple stating that 191 # this bnode is a literal, or it is the result of an inference. In both cases, the tuple must 192 # be removed from the result without any further action 193 if t not in to_be_removed: 194 to_be_removed.append(t) 195 elif obj in self.bnode_to_lit: 196 # This is where the exchange should take place: put back the real literal into the graph, removing the proxy one 197 if t not in to_be_removed: 198 to_be_removed.append(t) 199 # This is an additional thing due to the latest change of literal handling in RDF concepts. 200 # If a literal is an xsd:string then a plain literal is put in its place for the purpose of serialization... 201 lit = self.bnode_to_lit[obj].lit 202 if lit.datatype is not None and lit.datatype == ns_xsd["string"]: 203 lit = rdflibLiteral(str(lit)) 204 to_be_added.append((subj, pred, lit)) 205 206 # Do the real modifications 207 self._massageGraph(to_be_removed, to_be_added)
208
209 - def _massageGraph(self, to_be_removed, to_be_added) :
210 """ 211 Perform the removal and addition actions on the graph 212 @param to_be_removed: list of tuples to be removed 213 @param to_be_added : list of tuples to be added 214 """ 215 for t in to_be_removed: 216 self.graph.remove(t) 217 for t in to_be_added: 218 self.graph.add(t)
219

OWL-RL-7.1.4/Doc_OLD/RDFClosure.Literals.LiteralProxies-class.html000066400000000000000000000243231504201166100243660ustar00rootroot00000000000000 RDFClosure.Literals.LiteralProxies
Package RDFClosure :: Module Literals :: Class LiteralProxies
[hide private]
[frames] | no frames]

Class LiteralProxies

source code

Instance Methods [hide private]
 
__init__(self, graph, closure) source code
 
restore(self)
This method is to be invoked at the end of the forward chain processing.
source code
 
_massageGraph(self, to_be_removed, to_be_added)
Perform the removal and addition actions on the graph
source code
Method Details [hide private]

__init__(self, graph, closure)
(Constructor)

source code 
Parameters:
  • graph - the graph to be modified

restore(self)

source code 

This method is to be invoked at the end of the forward chain processing. It restores literals (whenever possible) to their original self...

_massageGraph(self, to_be_removed, to_be_added)

source code 

Perform the removal and addition actions on the graph

Parameters:
  • to_be_removed - list of tuples to be removed
  • to_be_added - list of tuples to be added

OWL-RL-7.1.4/Doc_OLD/RDFClosure.Literals._LiteralStructure-class.html000066400000000000000000000247301504201166100250760ustar00rootroot00000000000000 RDFClosure.Literals._LiteralStructure
Package RDFClosure :: Module Literals :: Class _LiteralStructure
[hide private]
[frames] | no frames]

Class _LiteralStructure

source code

This class serves as a wrapper around rdflib's Literal, by changing the equality function to a strict identity of datatypes and lexical values.

On the other hand, to implement, eg, OWL RL's datatype rules, a should be able to generate an 'a sameAs b' triple, ie, the distinction should be kept. Hence this class that overrides the equality, and then can be used as a key in a Python dictionary.

Instance Methods [hide private]
 
__init__(self, lit) source code
boolean
compare_value(self, other)
Compare to literal structure instances for equality.
source code
 
__eq__(self, other) source code
 
__ne__(self, other) source code
 
__hash__(self) source code
 
__repr__(self) source code
Method Details [hide private]

compare_value(self, other)

source code 

Compare to literal structure instances for equality. Here equality means in the sense of datatype values

Returns: boolean
comparison result

OWL-RL-7.1.4/Doc_OLD/RDFClosure.OWL'-module.html000066400000000000000000002350211504201166100205310ustar00rootroot00000000000000 RDFClosure.OWL'
Package RDFClosure :: Module OWL'
[hide private]
[frames] | no frames]

Module OWL'

source code

OWL and OWL2 terms. Note that the set of terms is complete, ie, it includes all OWL 2 terms, regardless of whether the term is used in OWL 2 RL or not.


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

Variables [hide private]
  OWLNS = Namespace(u'http://www.w3.org/2002/07/owl#')
  annotatedSource = rdflib.term.URIRef(u'http://www.w3.org/2002/...
  annotatedTarget = rdflib.term.URIRef(u'http://www.w3.org/2002/...
  annotatedProperty = rdflib.term.URIRef(u'http://www.w3.org/200...
  allValuesFrom = rdflib.term.URIRef(u'http://www.w3.org/2002/07...
  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/...
  BottomDataProperty = rdflib.term.URIRef(u'http://www.w3.org/20...
  BottomObjectProperty = rdflib.term.URIRef(u'http://www.w3.org/...
  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...
  disjointUnionOf = rdflib.term.URIRef(u'http://www.w3.org/2002/...
  disjointClasses = 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/...
  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...
  hasValue = rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#...
  hasSelf = rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#h...
  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...
  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...
  oneOf = rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#one...
  onProperty = rdflib.term.URIRef(u'http://www.w3.org/2002/07/ow...
  onProperties = rdflib.term.URIRef(u'http://www.w3.org/2002/07/...
  OWLpredicate = rdflib.term.URIRef(u'http://www.w3.org/2002/07/...
  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/...
  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...
  OWLsubject = rdflib.term.URIRef(u'http://www.w3.org/2002/07/ow...
  targetIndividual = rdflib.term.URIRef(u'http://www.w3.org/2002...
  targetValue = rdflib.term.URIRef(u'http://www.w3.org/2002/07/o...
  TopDataProperty = rdflib.term.URIRef(u'http://www.w3.org/2002/...
  TopObjectProperty = rdflib.term.URIRef(u'http://www.w3.org/200...
  unionOf = rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#u...
  versionInfo = rdflib.term.URIRef(u'http://www.w3.org/2002/07/o...
  versionIRI = rdflib.term.URIRef(u'http://www.w3.org/2002/07/ow...
  withRestrictions = rdflib.term.URIRef(u'http://www.w3.org/2002...
  AllDisjointProperties = rdflib.term.URIRef(u'http://www.w3.org...
  AllDifferent = rdflib.term.URIRef(u'http://www.w3.org/2002/07/...
  AllDisjointClasses = rdflib.term.URIRef(u'http://www.w3.org/20...
  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...
  OWLClass = rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#...
  DataRange = rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl...
  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...
  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...
  ReflexiveProperty = rdflib.term.URIRef(u'http://www.w3.org/200...
  Restriction = rdflib.term.URIRef(u'http://www.w3.org/2002/07/o...
  Thing = rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#Thi...
  SelfRestriction = rdflib.term.URIRef(u'http://www.w3.org/2002/...
  SymmetricProperty = rdflib.term.URIRef(u'http://www.w3.org/200...
  TransitiveProperty = rdflib.term.URIRef(u'http://www.w3.org/20...
  __package__ = 'RDFClosure'

Imports: rdflib, Namespace


Variables Details [hide private]

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')

annotatedProperty

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

allValuesFrom

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

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')

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')

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')

disjointUnionOf

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

disjointClasses

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

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')

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')

hasValue

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

hasSelf

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

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')

oneOf

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

onProperty

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

onProperties

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

OWLpredicate

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

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')

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')

OWLsubject

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

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')

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')

unionOf

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

versionInfo

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

versionIRI

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

withRestrictions

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

AllDisjointProperties

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

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'\
)

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')

OWLClass

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

DataRange

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

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')

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')

ReflexiveProperty

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

Restriction

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

Thing

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

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')

TransitiveProperty

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

OWL-RL-7.1.4/Doc_OLD/RDFClosure.OWL'-pysrc.html000066400000000000000000003425521504201166100204140ustar00rootroot00000000000000 RDFClosure.OWL'
Package RDFClosure :: Module OWL'
[hide private]
[frames] | no frames]

Source Code for Module RDFClosure.OWL'

  1  """ 
  2  OWL and OWL2 terms. Note that the set of terms is I{complete}, ie, it includes I{all} OWL 2 terms, regardless of whether the term is 
  3  used in OWL 2 RL or not. 
  4   
  5  @requires: U{RDFLib<https://github.com/RDFLib/rdflib>}, 4.0.0 and higher 
  6  @license: This software is available for use under the U{W3C Software License<http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231>} 
  7  @organization: U{World Wide Web Consortium<http://www.w3.org>} 
  8  @author: U{Ivan Herman<a href="http://www.w3.org/People/Ivan/">} 
  9  """ 
 10   
 11   
 12  import rdflib 
 13  from rdflib                             import Namespace 
 14   
 15   
 16  #: The OWL namespace as used for RDFLib 
 17  OWLNS  = Namespace("http://www.w3.org/2002/07/owl#") 
 18   
 19  annotatedSource                         = OWLNS["annotatedSource"] 
 20  annotatedTarget                         = OWLNS["annotatedTarget"] 
 21  annotatedProperty                       = OWLNS["annotatedProperty"] 
 22  allValuesFrom                           = OWLNS["allValuesFrom"] 
 23  assertionProperty                       = OWLNS["assertionProperty"] 
 24  backwardCompatibleWith          = OWLNS["backwardCompatibleWith"] 
 25  cardinality                                     = OWLNS["cardinality"] 
 26  complementOf                            = OWLNS["complementOf"] 
 27  BottomDataProperty                      = OWLNS["BottomDataProperty"] 
 28  BottomObjectProperty            = OWLNS["BottomObjectProperty"] 
 29  datatypeComplementOf            = OWLNS["datatypeComplementOf"] 
 30  deprecated                                      = OWLNS["deprecated"] 
 31  differentFrom                           = OWLNS["differentFrom"] 
 32  disjointUnionOf                         = OWLNS["disjointUnionOf"] 
 33  disjointClasses                         = OWLNS["disjointClasses"] 
 34  disjointWith                            = OWLNS["disjointWith"] 
 35  distinctMembers                         = OWLNS["distinctMembers"] 
 36  equivalentClass                         = OWLNS["equivalentClass"] 
 37  equivalentProperty                      = OWLNS["equivalentProperty"] 
 38  hasKey                                          = OWLNS["hasKey"] 
 39  hasValue                                        = OWLNS["hasValue"] 
 40  hasSelf                                         = OWLNS["hasSelf"] 
 41  imports                                         = OWLNS["imports"] 
 42  incompatibleWith                        = OWLNS["incompatibleWith"] 
 43  intersectionOf                          = OWLNS["intersectionOf"] 
 44  inverseOf                                       = OWLNS["inverseOf"] 
 45  maxCardinality                          = OWLNS["maxCardinality"] 
 46  maxQualifiedCardinality         = OWLNS["maxQualifiedCardinality"] 
 47  members                                         = OWLNS["members"] 
 48  minCardinality                          = OWLNS["minCardinality"] 
 49  minQualifiedCardinality         = OWLNS["minQualifiedCardinality"] 
 50  onClass                                         = OWLNS["onClass"] 
 51  onDataRange                                     = OWLNS["onDataRange"] 
 52  onDatatype                                      = OWLNS["onDatatype"] 
 53  oneOf                                           = OWLNS["oneOf"] 
 54  onProperty                                      = OWLNS["onProperty"] 
 55  onProperties                            = OWLNS["onProperties"] 
 56  OWLpredicate                            = OWLNS["predicate"] 
 57  priorVersion                            = OWLNS["priorVersion"] 
 58  propertyChainAxiom                      = OWLNS["propertyChainAxiom"] 
 59  propertyDisjointWith            = OWLNS["propertyDisjointWith"] 
 60  qualifiedCardinality            = OWLNS["qualifiedCardinality"] 
 61  sameAs                                          = OWLNS["sameAs"] 
 62  someValuesFrom                          = OWLNS["someValuesFrom"] 
 63  sourceIndividual                        = OWLNS["sourceIndividual"] 
 64  OWLsubject                                      = OWLNS["subject"] 
 65  targetIndividual                        = OWLNS["targetIndividual"] 
 66  targetValue                                     = OWLNS["targetValue"] 
 67  TopDataProperty                         = OWLNS["TopDataProperty"] 
 68  TopObjectProperty                       = OWLNS["TopObjectProperty"] 
 69  unionOf                                         = OWLNS["unionOf"] 
 70  versionInfo                                     = OWLNS["versionInfo"] 
 71  versionIRI                                      = OWLNS["versionIRI"] 
 72  withRestrictions                        = OWLNS["withRestrictions"] 
 73   
 74  AllDisjointProperties           = OWLNS["AllDisjointProperties"] 
 75  AllDifferent                            = OWLNS["AllDifferent"] 
 76  AllDisjointClasses                      = OWLNS["AllDisjointClasses"] 
 77  Annotation                                      = OWLNS["Annotation"] 
 78  AnnotationProperty                      = OWLNS["AnnotationProperty"] 
 79  AsymmetricProperty                      = OWLNS["AsymmetricProperty"] 
 80  Axiom                                           = OWLNS["Axiom"] 
 81  OWLClass                                        = OWLNS["Class"] 
 82  DataRange                                       = OWLNS["DataRange"] 
 83  DatatypeProperty                        = OWLNS["DatatypeProperty"] 
 84  DeprecatedClass                         = OWLNS["DeprecatedClass"] 
 85  DeprecatedProperty                      = OWLNS["DeprecatedProperty"] 
 86  FunctionalProperty                      = OWLNS["FunctionalProperty"] 
 87  InverseFunctionalProperty       = OWLNS["InverseFunctionalProperty"] 
 88  IrreflexiveProperty                     = OWLNS["IrreflexiveProperty"] 
 89  NamedIndividual                         = OWLNS["NamedIndividual"] 
 90  NegativePropertyAssertion       = OWLNS["NegativePropertyAssertion"] 
 91  Nothing                                         = OWLNS["Nothing"] 
 92  ObjectProperty                          = OWLNS["ObjectProperty"] 
 93  Ontology                                        = OWLNS["Ontology"] 
 94  OntologyProperty                        = OWLNS["OntologyProperty"] 
 95  ReflexiveProperty                       = OWLNS["ReflexiveProperty"] 
 96  Restriction                                     = OWLNS["Restriction"] 
 97  Thing                                           = OWLNS["Thing"] 
 98  SelfRestriction                         = OWLNS["SelfRestriction"] 
 99  SymmetricProperty                       = OWLNS["SymmetricProperty"] 
100  TransitiveProperty                      = OWLNS["TransitiveProperty"] 
101   

OWL-RL-7.1.4/Doc_OLD/RDFClosure.OWLRL-module.html000066400000000000000000002520521504201166100207230ustar00rootroot00000000000000 RDFClosure.OWLRL
Package RDFClosure :: Module OWLRL
[hide private]
[frames] | no frames]

Module OWLRL

source code

This module is a brute force implementation of the OWL 2 RL profile.

RDFLib works with 'generalized' RDF, meaning that triples with a BNode predicate are allowed. This is good because, eg, some of the triples generated for RDF from an OWL 2 functional syntax might look like '[ owl:inverseOf p]', and the RL rules would then operate on such generalized triple. However, as a last, post processing steps, these triples are removed from the graph before serialization to produce 'standard' RDF (which is o.k. for RL, too, because the consequent triples are all right, generalized triples might have had a role in the deduction steps only).


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_Semantics
OWL 2 RL Semantics class, ie, implementation of the OWL 2 RL closure graph.
Variables [hide private]
  __author__ = 'Ivan Herman'
  __license__ = u'W3C® SOFTWARE NOTICE AND LICENSE, http://www.w...
  OWLRL_Annotation_properties = [rdflib.term.URIRef(u'http://www...
  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...
  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/...
  DataRange = rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl...
  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#')
  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...
  ReflexiveProperty = rdflib.term.URIRef(u'http://www.w3.org/200...
  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...
  __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/...
  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...
  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/...
  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...
  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: rdflib, BNode, Property, type, subClassOf, subPropertyOf, comment, label, domain, range, seeAlso, isDefinedBy, Datatype, Core, OWLRL_Axiomatic_Triples, OWLRL_D_Axiomatic_Triples, OWLRL_Datatypes_Disjointness, OWL_RL_Datatypes, OWL_Datatype_Subsumptions, Namespace


Variables Details [hide private]

__license__

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

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'),
...

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')

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')

DataRange

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

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')

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')

ReflexiveProperty

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

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'\
)

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')

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')

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')

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')

OWL-RL-7.1.4/Doc_OLD/RDFClosure.OWLRL-pysrc.html000066400000000000000000013252371504201166100206050ustar00rootroot00000000000000 RDFClosure.OWLRL
Package RDFClosure :: Module OWLRL
[hide private]
[frames] | no frames]

Source Code for Module RDFClosure.OWLRL

  1  #!/d/Bin/Python/python.exe 
  2  # -*- coding: utf-8 -*- 
  3  # 
  4  """ 
  5  This module is a C{brute force} implementation of the OWL 2 RL profile. 
  6   
  7  RDFLib works with 'generalized' RDF, meaning that triples with a BNode predicate are I{allowed}. This is good because, eg, some of the 
  8  triples generated for RDF from an OWL 2 functional syntax might look like '[ owl:inverseOf p]', and the RL rules would then operate 
  9  on such generalized triple. However, as a last, post processing steps, these triples are removed from the graph before serialization 
 10  to produce 'standard' RDF (which is o.k. for RL, too, because the consequent triples are all right, generalized triples might 
 11  have had a role in the deduction steps only). 
 12   
 13  @requires: U{RDFLib<https://github.com/RDFLib/rdflib>}, 4.0.0 and higher 
 14  @license: This software is available for use under the U{W3C Software License<http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231>} 
 15  @organization: U{World Wide Web Consortium<http://www.w3.org>} 
 16  @author: U{Ivan Herman<a href="http://www.w3.org/People/Ivan/">} 
 17   
 18  """ 
 19   
 20  __author__  = 'Ivan Herman' 
 21  __contact__ = 'Ivan Herman, ivan@w3.org' 
 22  __license__ = u'W3C® SOFTWARE NOTICE AND LICENSE, http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231' 
 23   
 24  import rdflib 
 25  from rdflib import BNode 
 26   
 27  from RDFClosure.RDFS import Property, type 
 28  from RDFClosure.RDFS import subClassOf, subPropertyOf, comment, label, domain, range 
 29  from RDFClosure.RDFS import seeAlso, isDefinedBy, Datatype 
 30   
 31  from RDFClosure.OWL                             import * 
 32  from RDFClosure.Closure                         import Core 
 33  from RDFClosure.AxiomaticTriples        import OWLRL_Axiomatic_Triples, OWLRL_D_Axiomatic_Triples 
 34  from RDFClosure.AxiomaticTriples        import OWLRL_Datatypes_Disjointness 
 35   
 36  OWLRL_Annotation_properties = [label, comment, seeAlso, isDefinedBy, deprecated, versionInfo, priorVersion, backwardCompatibleWith, incompatibleWith] 
 37   
 38  from .XsdDatatypes import OWL_RL_Datatypes, OWL_Datatype_Subsumptions 
 39   
 40  ########################################################################################################################### 
 41   
 42   
 43  ## OWL-R Semantics class 
 44  # 
 45  # 
 46  # As an editing help: each rule is prefixed by RULE XXXX where XXXX is the acronym given in the profile document. 
 47  # This helps in referring back to the spec... 
 48  # noinspection PyPep8Naming,PyPep8Naming,PyBroadException 
49 -class OWLRL_Semantics(Core):
50 """OWL 2 RL Semantics class, ie, implementation of the OWL 2 RL closure graph. 51 52 Note that the module does I{not} implement the so called Datatype entailment rules, simply because the underlying RDFLib does 53 not implement the datatypes (ie, RDFLib will not make the literal "1.00" and "1.00000" identical, although 54 even with all the ambiguities on datatypes, this I{should} be made equal...). Also, the so-called extensional entailment rules 55 (Section 7.3.1 in the RDF Semantics document) have not been implemented either. 56 57 The comments and references to the various rule follow the names as used in the U{OWL 2 RL document<http://www.w3.org/TR/owl2-profiles/#Reasoning_in_OWL_2_RL_and_RDF_Graphs_using_Rules>}. 58 """
59 - def __init__(self, graph, axioms, daxioms, rdfs=None):
60 """ 61 @param graph: the RDF graph to be extended 62 @type graph: rdflib.Graph 63 @param axioms: whether (non-datatype) axiomatic triples should be added or not 64 @type axioms: bool 65 @param daxioms: whether datatype axiomatic triples should be added or not 66 @type daxioms: bool 67 @param rdfs: whether RDFS inference is also done (used in subclassed only) 68 @type rdfs: boolean 69 """ 70 Core.__init__(self, graph, axioms, daxioms, rdfs) 71 self.bnodes = []
72
73 - def _list(self, l) :
74 """ 75 Shorthand to get a list of values (ie, from an rdf:List structure) starting at a head 76 77 @param l: RDFLib resource, should be the head of an rdf:List 78 @return: array of resources 79 """ 80 return [ch for ch in self.graph.items(l)]
81
82 - def _get_resource_or_literal(self, node):
83 if node in self.literal_proxies.bnode_to_lit: 84 return "'" + self.literal_proxies.bnode_to_lit[node].lex + "'" 85 else : 86 return node
87
88 - def post_process(self):
89 """ 90 Remove triples with bnode predicates. The Bnodes in the graph are collected in the first cycle run. 91 """ 92 to_be_removed = [] 93 for b in self.bnodes: 94 for t in self.graph.triples((None, b, None)): 95 if t not in to_be_removed: 96 to_be_removed.append(t) 97 for t in to_be_removed: 98 self.graph.remove(t)
99
100 - def add_axioms(self):
101 """ 102 Add axioms 103 """ 104 for t in OWLRL_Axiomatic_Triples: 105 self.graph.add(t)
106
107 - def add_d_axioms(self) :
108 """ 109 Add the datatype axioms 110 """ 111 for t in OWLRL_D_Axiomatic_Triples: 112 self.graph.add(t)
113
114 - def restriction_typing_check(self, v, t) :
115 """Helping method to check whether a type statement is in line with a possible 116 restriction. This method is invoked by rule "cls-avf" before setting a type 117 on an allValuesFrom restriction. 118 119 The method is a placeholder at this level. It is typically implemented by subclasses for 120 extra checks, eg, for datatype facet checks. 121 @param v: the resource that is to be 'typed' 122 @param t: the targeted type (ie, Class) 123 @return: boolean 124 """ 125 return True
126
128 """ 129 Some of the rules in the rule set are axiomatic in nature, meaning that they really have to be added only 130 once, there is no reason to add these in a cycle. These are performed by this method that is invoked only once 131 at the beginning of the process. 132 133 These are: cls-thing, cls-nothing1, prp-ap, dt-types1, dt-types2, dt-eq, dt-diff. 134 135 Note, however, that the dt-* are executed only partially, limited by the possibilities offered by RDFLib. These may not 136 cover all the edge cases of OWL RL. Especially, dt-not-type has not (yet?) been implemented (I wonder whether RDFLib should not raise 137 exception for those anyway... 138 """ 139 # noinspection PyShadowingNames 140 def _add_to_explicit(s, o): 141 if s not in explicit: 142 explicit[s] = [] 143 if o not in explicit[s]: 144 explicit[s].append(o)
145 146 # noinspection PyShadowingNames 147 def _append_to_explicit(s, o): 148 if s not in explicit: 149 explicit[s] = [] 150 for d in explicit[o]: 151 if d not in explicit[s]: 152 explicit[s].append(d)
153 154 def _add_to_used_datatypes(d): 155 used_datatypes.add(d) 156 157 # noinspection PyShadowingNames 158 def _handle_subsumptions(r, dt): 159 if dt in OWL_Datatype_Subsumptions: 160 for new_dt in OWL_Datatype_Subsumptions[dt]: 161 self.store_triple((r, type, new_dt)) 162 self.store_triple((new_dt, type, Datatype)) 163 _add_to_used_datatypes(new_dt) 164 165 166 # For processing later: 167 # implicit object->datatype relationships: these come from real literals which are represented by 168 # an internal bnode 169 implicit = {} 170 171 # explicit object->datatype relationships: those that came from an object being typed as a datatype 172 # or a sameAs. The values are arrays of datatypes to which the resource belong 173 explicit = {} 174 175 # datatypes in use by the graph (directly or indirectly). This will be used at the end to add the 176 # necessary disjointness statements (but not more 177 used_datatypes = set() 178 179 # the real literals from the original graph: 180 # literals = self.literal_proxies.lit_to_bnode.keys() 181 182 # RULE dt-type2: for all explicit literals the corresponding bnode should get the right type 183 # definition. The 'implicit' dictionary is also filled on the fly 184 # RULE dt-not-type: see whether an explicit literal is valid in terms of the defined datatype 185 for lt in self.literal_proxies.lit_to_bnode.keys(): 186 # note that all non-RL datatypes are ignored 187 if lt.dt is not None and lt.dt in OWL_RL_Datatypes: 188 bn = self.literal_proxies.lit_to_bnode[lt] 189 # add the explicit typing triple 190 self.store_triple((bn, type, lt.dt)) 191 if bn not in implicit: 192 implicit[bn] = lt.dt 193 _add_to_used_datatypes(lt.dt) 194 195 # for dt-not-type 196 # This is a dirty trick: rdflib's Literal includes a method that raises an exception if the 197 # lexical value cannot be mapped on the value space. 198 try : 199 val = lt.lit.toPython() 200 except: 201 self.add_error("Literal's lexical value and datatype do not match: (%s,%s)" % (lt.lex, lt.dt)) 202 203 # RULE dt-diff 204 # RULE dt-eq 205 # Try to compare literals whether they are different or not. If they are different, then an explicit 206 # different from statement should be added, if they are identical, then an equality should be added 207 for lt1 in self.literal_proxies.lit_to_bnode.keys(): 208 for lt2 in self.literal_proxies.lit_to_bnode.keys() : 209 if lt1 != lt2: 210 try : 211 lt1_d = lt1.lit.toPython() 212 lt2_d = lt2.lit.toPython() 213 #if lt1_d != lt2_d : 214 # self.store_triple((self.literal_proxies.lit_to_bnode[lt1], differentFrom, self.literal_proxies.lit_to_bnode[lt2])) 215 #else : 216 # self.store_triple((self.literal_proxies.lit_to_bnode[lt1], sameAs, self.literal_proxies.lit_to_bnode[lt2])) 217 except: 218 # there may be a problem with one of the python conversion, but that should have been taken 219 # care of already 220 pass 221 222 # Other datatype definitions can come from explicitly defining some nodes as datatypes (though rarely used, 223 # it is perfectly possible... 224 # there may be explicit relationships set in the graph, too! 225 for (s,p,o) in self.graph.triples((None, type, None)): 226 if o in OWL_RL_Datatypes: 227 _add_to_used_datatypes(o) 228 if s not in implicit: 229 _add_to_explicit(s, o) 230 231 # Finally, there may be sameAs statements that bind nodes to some of the existing ones. This does not introduce 232 # new datatypes, so the used_datatypes array does not get extended 233 for (s,p,o) in self.graph.triples((None, sameAs, None)): 234 if o in implicit: 235 _add_to_explicit(s, implicit[o]) 236 # note that s in implicit would mean that the original graph has 237 # a literal in subject position which is not allowed at the moment, so I do not bother 238 if o in explicit : 239 _append_to_explicit(s, o) 240 if s in explicit : 241 _append_to_explicit(o, s) 242 243 # what we have now: 244 # explicit+implicit contains all the resources of type datatype; 245 # implicit contains those that are given by an explicit literal 246 # explicit contains those that are given by general resources, and there can be a whole array for each entry 247 248 # RULE dt-type1: add a Datatype typing for all those 249 # Note: the strict interpretation of OWL RL is to do that for all allowed datatypes, but this is 250 # under discussion right now. The optimized version uses only what is really in use 251 for dt in OWL_RL_Datatypes: 252 self.store_triple((dt,type,Datatype)) 253 for dts in explicit.values(): 254 for dt in dts: 255 self.store_triple((dt, type, Datatype)) 256 257 # Datatype reasoning means that certain datatypes are subtypes of one another. 258 # I could simply generate the extra subclass relationships into the graph and let the generic 259 # process work its way, but it seems to be an overkill. Instead, I prefer to add the explicit typing 260 # into the graph 'manually' 261 for r in explicit: 262 # these are the datatypes that this resource has 263 dtypes = explicit[r] 264 for dt in dtypes: 265 _handle_subsumptions(r, dt) 266 267 for r in implicit: 268 dt = implicit[r] 269 _handle_subsumptions(r, dt) 270 271 # Last step: add the datatype disjointness relationships. This is done only for 272 # - 'top' level datatypes 273 # - used in the graph 274 for t in OWLRL_Datatypes_Disjointness: 275 (l, pred, r) = t 276 if l in used_datatypes and r in used_datatypes: 277 self.store_triple(t) 278
279 - def _one_time_rules_misc(self):
280 """ 281 Rules executed: cls-thing, cls-nothing, prp-ap. 282 """ 283 # RULE cls-thing 284 self.store_triple((Thing, type, OWLClass)) 285 286 # RULE cls-nothing 287 self.store_triple((Nothing, type, OWLClass)) 288 289 # RULE prp-ap 290 for an in OWLRL_Annotation_properties: 291 self.store_triple((an, type, AnnotationProperty))
292
293 - def one_time_rules(self):
294 """ 295 Some of the rules in the rule set are axiomatic in nature, meaning that they really have to be added only 296 once, there is no reason to add these in a cycle. These are performed by this method that is invoked only once 297 at the beginning of the process. 298 299 These are: cls-thing, cls-nothing1, prp-ap, dt-types1, dt-types2, dt-eq, dt-diff. 300 """ 301 self._one_time_rules_misc() 302 self._one_time_rules_datatypes()
303
304 - def rules(self, t, cycle_num):
305 """ 306 Go through the various rule groups, as defined in the OWL-RL profile text and implemented via 307 local methods. (The calling cycle takes every tuple in the graph.) 308 @param t: a triple (in the form of a tuple) 309 @param cycle_num: which cycle are we in, starting with 1. This value is forwarded to all local rules; it is also used 310 locally to collect the bnodes in the graph. 311 """ 312 if cycle_num == 1: 313 for r in t: 314 if isinstance(r, BNode) and r not in self.bnodes: 315 self.bnodes.append(r) 316 317 self._properties(t,cycle_num) 318 self._equality(t,cycle_num) 319 self._classes(t,cycle_num) 320 self._class_axioms(t,cycle_num) 321 self._schema_vocabulary(t,cycle_num)
322
323 - def _property_chain(self, p, x):
324 """ 325 Implementation of the property chain axiom, invoked from inside the property axiom handler. This is the 326 implementation of rule prp-spo2, taken aside for an easier readability of the code. """ 327 chain = self._list(x) 328 # The complication is that, at each step of the chain, there may be spawns, leading to a multitude 329 # of 'sub' chains:-( 330 if len(chain) > 0: 331 for (u1, _y, _z) in self.graph.triples((None, chain[0], None)): 332 # At least the chain can be started, because the leftmost property has at least 333 # one element in its extension 334 finalList = [(u1, _z)] 335 chainExists = True 336 for pi in chain[1:]: 337 newList = [] 338 for (_u,ui) in finalList: 339 for u in self.graph.objects(ui,pi): 340 # what is stored is only last entry with u1, the intermediate results 341 # are not of interest 342 newList.append((u1, u)) 343 # I have now, in new list, all the intermediate results 344 # until pi 345 # if new list is empty, that means that is a blind alley 346 if len(newList) == 0: 347 chainExists = False 348 break 349 else : 350 finalList = newList 351 if chainExists: 352 for (_u, un) in finalList : 353 self.store_triple((u1, p, un))
354
355 - def _equality(self, triple, cycle_num):
356 """ 357 Table 4: Semantics of equality. Essentially, the eq-* rules. 358 @param triple: triple to work on 359 @param cycle_num: which cycle are we in, starting with 1. Can be used for some optimization. 360 """ 361 # In many of the 'if' branches, corresponding to rules in the document, 362 # the branch begins by a renaming of variables (eg, pp,c = s,o). 363 # There is no programming reasons for doing that, but by renaming the 364 # variables it becomes easier to compare the declarative rules 365 # in the document with the implementation 366 s,p,o = triple 367 # RULE eq-ref 368 self.store_triple((s, sameAs, s)) 369 self.store_triple((o, sameAs, o)) 370 self.store_triple((p, sameAs, p)) 371 if p == sameAs: 372 x, y = s, o 373 # RULE eq-sym 374 self.store_triple((y, sameAs, x)) 375 # RULE eq-trans 376 for z in self.graph.objects(y, sameAs): 377 self.store_triple((x, sameAs, z)) 378 # RULE eq-rep-s 379 for pp,oo in self.graph.predicate_objects(s): 380 self.store_triple((o, pp, oo)) 381 # RULE eq-rep-p 382 for ss,oo in self.graph.subject_objects(s): 383 self.store_triple((ss, o, oo)) 384 # RULE eq-rep-o 385 for ss,pp in self.graph.subject_predicates(o): 386 self.store_triple((ss, pp, s)) 387 # RULE eq-diff1 388 if (s,differentFrom,o) in self.graph or (o,differentFrom,s) in self.graph: 389 s_e = self._get_resource_or_literal(s) 390 o_e = self._get_resource_or_literal(o) 391 self.add_error("'sameAs' and 'differentFrom' cannot be used on the same subject-object pair: (%s, %s)" % (s_e, o_e)) 392 393 # RULES eq-diff2 and eq-diff3 394 if p == type and o == AllDifferent: 395 x = s 396 # the objects method are generators, we cannot simply concatenate them. So we turn the results 397 # into lists first. (Otherwise the body of the for loops should be repeated verbatim, which 398 # is silly and error prone... 399 m1 = [i for i in self.graph.objects(x, members)] 400 m2 = [i for i in self.graph.objects(x, distinctMembers)] 401 for y in m1 + m2: 402 zis = self._list(y) 403 for i in xrange(0, len(zis) - 1): 404 zi = zis[i] 405 for j in xrange(i+1, len(zis) - 1): 406 zj = zis[j] 407 if ((zi, sameAs, zj) in self.graph or (zj, sameAs, zi) in self.graph) and zi != zj: 408 self.add_error("'sameAs' and 'AllDifferent' cannot be used on the same subject-object pair: (%s, %s)" % (zi,zj))
409
410 - def _properties(self, triple, cycle_num):
411 """ 412 Table 5: The Semantics of Axioms about Properties. Essentially, the prp-* rules. 413 @param triple: triple to work on 414 @param cycle_num: which cycle are we in, starting with 1. Can be used for some optimization. 415 """ 416 # In many of the 'if' branches, corresponding to rules in the document, 417 # the branch begins by a renaming of variables (eg, pp,c = s,o). 418 # There is no programming reasons for doing that, but by renaming the 419 # variables it becomes easier to compare the declarative rules 420 # in the document with the implementation 421 p, t, o = triple 422 423 # RULE prp-ap 424 if cycle_num == 1 and t in OWLRL_Annotation_properties: 425 self.store_triple((t, type, AnnotationProperty)) 426 427 # RULE prp-dom 428 if t == domain: 429 for x, y in self.graph.subject_objects(p): 430 self.store_triple((x, type, o)) 431 432 # RULE prp-rng 433 elif t == range: 434 for x, y in self.graph.subject_objects(p): 435 self.store_triple((y, type, o)) 436 437 elif t == type: 438 # RULE prp-fp 439 if o == FunctionalProperty: 440 # Property axiom #3 441 for x, y1 in self.graph.subject_objects(p): 442 for y2 in self.graph.objects(x,p): 443 # Optimization: if the two resources are identical, the samAs is already 444 # taken place somewhere else, unnecessary to add it here 445 if y1 != y2: 446 self.store_triple((y1, sameAs, y2)) 447 448 # RULE prp-ifp 449 elif o == InverseFunctionalProperty: 450 for x1, y in self.graph.subject_objects(p): 451 for x2 in self.graph.subjects(p,y): 452 # Optimization: if the two resources are identical, the samAs is already 453 # taken place somewhere else, unnecessary to add it here 454 if x1 != x2: 455 self.store_triple((x1, sameAs, x2)) 456 457 # RULE prp-irp 458 elif o == IrreflexiveProperty: 459 for x, y in self.graph.subject_objects(p): 460 if x == y: 461 self.add_error("Irreflexive property used on %s with %s" % (x,p)) 462 463 # RULE prp-symp 464 elif o == SymmetricProperty: 465 for x, y in self.graph.subject_objects(p): 466 self.store_triple((y, p, x)) 467 468 # RULE prp-asyp 469 elif o == AsymmetricProperty: 470 for x, y in self.graph.subject_objects(p): 471 if (y, p, x) in self.graph : 472 self.add_error("Erroneous usage of asymmetric property %s on %s and %s" % (p, x, y)) 473 474 # RULE prp-trp 475 elif o == TransitiveProperty: 476 for x, y in self.graph.subject_objects(p): 477 for z in self.graph.objects(y, p): 478 self.store_triple((x, p, z)) 479 480 # 481 # Breaking the order here, I take some additional rules here to the branch checking the type... 482 # 483 # RULE prp-adp 484 elif o == AllDisjointProperties: 485 x = p 486 for y in self.graph.objects(x, members): 487 pis = self._list(y) 488 for i in xrange(0,len(pis) - 1): 489 pi = pis[i] 490 for j in xrange(i+1,len(pis) - 1): 491 pj = pis[j] 492 for x,y in self.graph.subject_objects(pi): 493 if (x, pj, y) in self.graph : 494 self.add_error("Disjoint properties in an 'AllDisjointProperties' are not really disjoint: (%s, %s,%s) and (%s,%s,%s)" % (x, pi, y, x, pj, y)) 495 496 # RULE prp-spo1 497 elif t == subPropertyOf: 498 p1, p2 = p, o 499 for x, y in self.graph.subject_objects(p1): 500 self.store_triple((x, p2, y)) 501 502 # RULE prp-spo2 503 elif t == propertyChainAxiom: 504 self._property_chain(p, o) 505 506 # RULES prp-eqp1 and prp-eqp2 507 elif t == equivalentProperty: 508 p1, p2 = p, o 509 # Optimization: it clearly does not make sense to run these 510 # if the two properties are identical (a separate axiom 511 # does create an equivalent property relations among identical 512 # properties, too...) 513 if p1 != p2: 514 # RULE prp-eqp1 515 for x, y in self.graph.subject_objects(p1): 516 self.store_triple((x, p2, y)) 517 # RULE prp-eqp2 518 for x, y in self.graph.subject_objects(p2): 519 self.store_triple((x, p1, y)) 520 521 # RULE prp-pdw 522 elif t == propertyDisjointWith: 523 p1, p2 = p, o 524 for x, y in self.graph.subject_objects(p1): 525 if (x, p2, y) in self.graph: 526 self.add_error("Erroneous usage of disjoint properties %s and %s on %s and %s" % (p1,p2,x,y)) 527 528 529 # RULES prp-inv1 and prp-inv2 530 elif t == inverseOf: 531 p1, p2 = p, o 532 # RULE prp-inv1 533 for x, y in self.graph.subject_objects(p1): 534 self.store_triple((y, p2, x)) 535 # RULE prp-inv2 536 for x, y in self.graph.subject_objects(p2): 537 self.store_triple((y, p1, x)) 538 539 # RULE prp-key 540 elif t == hasKey : 541 c, u = p, o 542 pis = self._list(u) 543 if len(pis) > 0 : 544 for x in self.graph.subjects(type, c): 545 # "Calculate" the keys for 'x'. The complication is that there can be various combinations 546 # of the keys, and that is the structure one has to build up here... 547 # 548 # The final list will be a list of lists, with each constituents being the possible combinations of the 549 # key values. 550 # startup the list 551 finalList = [[zi] for zi in self.graph.objects(x, pis[0])] 552 for pi in pis[1:]: 553 newList = [] 554 for zi in self.graph.objects(x, pi): 555 newList = newList + [l + [zi] for l in finalList] 556 finalList = newList 557 558 # I am not sure this can happen, but better safe then sorry... ruling out 559 # the value lists whose length are not kosher 560 # (To be checked whether this is necessary in the first place) 561 valueList = [l for l in finalList if len(l) == len(pis)] 562 563 # Now we can look for the y-s, to see if they have the same key values 564 for y in self.graph.subjects(type, c): 565 # rule out the existing equivalences 566 if not(y == x or (y, sameAs, x) in self.graph or (x, sameAs, y) in self.graph) : 567 # 'calculate' the keys for the y values and see if there is a match 568 for vals in valueList: 569 same = True 570 for i in xrange(0,len(pis) - 1): 571 if (y, pis[i], vals[i]) not in self.graph : 572 same = False 573 # No use going with this property line 574 break 575 if same : 576 self.store_triple((x, sameAs, y)) 577 # Look for the next 'y', this branch is finished, no reason to continue 578 break 579 580 # RULES prp-npa1 and prp-npa2 581 elif t == sourceIndividual: 582 x, i1 = p, o 583 for p1 in self.graph.objects(x, assertionProperty): 584 for i2 in self.graph.objects(x, targetIndividual): 585 if (i1, p1, i2) in self.graph : 586 self.add_error("Negative (object) property assertion violated for: (%s, %s, %s)" % (i1, p1, i2)) 587 for i2 in self.graph.objects(x,targetValue) : 588 if (i1, p1, i2) in self.graph : 589 self.add_error("Negative (datatype) property assertion violated for: (%s, %s, %s)" % (i1, p1, self.get_literal_value(i2)))
590
591 - def _classes(self, triple, cycle_num) :
592 """ 593 Table 6: The Semantics of Classes. Essentially, the cls-* rules 594 @param triple: triple to work on 595 @param cycle_num: which cycle are we in, starting with 1. Can be used for some optimization. 596 """ 597 # In many of the 'if' branches, corresponding to rules in the document, 598 # the branch begins by a renaming of variables (eg, pp,c = s,o). 599 # There is no programming reasons for doing that, but by renaming the 600 # variables it becomes easier to compare the declarative rules 601 # in the document with the implementation 602 c, p, x = triple 603 604 # RULE cls-nothing2 605 if p == type and x == Nothing : 606 self.add_error("%s is defined of type 'Nothing'" % c) 607 608 # RULES cls-int1 and cls-int2 609 if p == intersectionOf: 610 classes = self._list(x) 611 # RULE cls-int1 612 # Optimization: by looking at the members of class[0] right away one 613 # reduces the search spaces a bit. Individuals not in that class 614 # are without interest anyway 615 # I am not sure how empty lists are sanctioned, so having an extra check 616 # on that does not hurt.. 617 if len(classes) > 0 : 618 for y in self.graph.subjects(type, classes[0]): 619 if False not in [(y, type, cl) in self.graph for cl in classes[1:]] : 620 self.store_triple((y, type, c)) 621 # RULE cls-int2 622 for y in self.graph.subjects(type, c): 623 for cl in classes: 624 self.store_triple((y, type, cl)) 625 626 # RULE cls-uni 627 elif p == unionOf: 628 for cl in self._list(x): 629 for y in self.graph.subjects(type, cl): 630 self.store_triple((y, type, c)) 631 632 # RULE cls-comm 633 elif p == complementOf: 634 c1, c2 = c, x 635 for x1 in self.graph.subjects(type, c1): 636 if (x1, type, c2) in self.graph : 637 self.add_error("Violation of complementarity for classes %s and %s on element %s" % (c1, c2, x)) 638 639 # RULES cls-svf1 and cls=svf2 640 elif p == someValuesFrom: 641 xx, y = c, x 642 # RULE cls-svf1 643 # RULE cls-svf2 644 for pp in self.graph.objects(xx, onProperty): 645 for u, v in self.graph.subject_objects(pp) : 646 if y == Thing or (v, type, y) in self.graph: 647 self.store_triple((u, type, xx)) 648 649 # RULE cls-avf 650 elif p == allValuesFrom: 651 xx, y = c, x 652 for pp in self.graph.objects(xx, onProperty): 653 for u in self.graph.subjects(type, xx): 654 for v in self.graph.objects(u, pp) : 655 if self.restriction_typing_check(v, y): 656 self.store_triple((v, type, y)) 657 else : 658 self.add_error("Violation of type restriction for allValuesFrom in %s for datatype %s on value %s" % (pp, y, self._get_resource_or_literal(v))) 659 660 # RULES cls-hv1 and cls-hv2 661 elif p == hasValue: 662 xx, y = c, x 663 for pp in self.graph.objects(xx, onProperty): 664 # RULE cls-hv1 665 for u in self.graph.subjects(type, xx): 666 self.store_triple((u, pp, y)) 667 # RULE cls-hv2 668 for u in self.graph.subjects(pp, y): 669 self.store_triple((u, type, xx)) 670 671 # RULES cls-maxc1 and cls-maxc1 672 elif p == maxCardinality: 673 # This one is a bit complicated, because the literals have been 674 # exchanged against bnodes... 675 # 676 # The construct should lead to an integer. Something may go wrong along the line 677 # leading to an exception... 678 val = -1 679 try: 680 val = int(self.literal_proxies.bnode_to_lit[x].lit) 681 except: 682 pass 683 xx = c 684 if val == 0: 685 # RULE cls-maxc1 686 for pp in self.graph.objects(xx, onProperty): 687 for u,y in self.graph.subject_objects(pp): 688 # This should not occur: 689 if (u, type, xx) in self.graph: 690 self.add_error("Erroneous usage of maximum cardinality with %s, %s" % (xx, y)) 691 elif val == 1: 692 # RULE cls-maxc2 693 for pp in self.graph.objects(xx, onProperty): 694 for u, y1 in self.graph.subject_objects(pp): 695 if (u, type, xx) in self.graph: 696 for y2 in self.graph.objects(u, pp): 697 if y1 != y2 : 698 self.store_triple((y1, sameAs, y2)) 699 700 # RULES cls-maxqc1, cls-maxqc2, cls-maxqc3, cls-maxqc4 701 elif p == maxQualifiedCardinality: 702 # This one is a bit complicated, because the literals have been 703 # exchanged against bnodes... 704 # 705 # The construct should lead to an integer. Something may go wrong along the line 706 # leading to an exception... 707 val = -1 708 try : 709 val = int(self.literal_proxies.bnode_to_lit[x].lit) 710 except: 711 pass 712 xx = c 713 if val == 0 : 714 # RULES cls-maxqc1 and cls-maxqc2 folded in one 715 for pp in self.graph.objects(xx, onProperty): 716 for cc in self.graph.objects(xx, onClass): 717 for u,y in self.graph.subject_objects(pp): 718 # This should not occur: 719 if (u, type, xx) in self.graph and (cc == Thing or (y, type, cc) in self.graph): 720 self.add_error("Erroneous usage of maximum qualified cardinality with %s, %s, and %s" % (xx, cc, y)) 721 elif val == 1 : 722 # RULE cls-maxqc3 and cls-maxqc4 folded in one 723 for pp in self.graph.objects(xx, onProperty): 724 for cc in self.graph.objects(xx, onClass) : 725 for u, y1 in self.graph.subject_objects(pp): 726 if (u, type, xx) in self.graph : 727 if cc == Thing: 728 for y2 in self.graph.objects(u, pp): 729 if y1 != y2: 730 self.store_triple((y1, sameAs, y2)) 731 else : 732 if (y1, type, cc) in self.graph: 733 for y2 in self.graph.objects(u, pp) : 734 if y1 != y2 and (y2, type, cc) in self.graph: 735 self.store_triple((y1, sameAs, y2)) 736 737 # RULE cls-oo 738 elif p == oneOf: 739 for y in self._list(x): 740 self.store_triple((y, type, c))
741
742 - def _class_axioms(self, triple, cycle_num):
743 """ 744 Table 7: Class Axioms. Essentially, the cax-* rules. 745 @param triple: triple to work on 746 @param cycle_num: which cycle are we in, starting with 1. Can be used for some optimization. 747 """ 748 # In many of the 'if' branches, corresponding to rules in the document, 749 # the branch begins by a renaming of variables (eg, pp,c = s,o). 750 # There is no programming reasons for doing that, but by renaming the 751 # variables it becomes easier to compare the declarative rules 752 # in the document with the implementation 753 c1,p,c2 = triple 754 # RULE cax-sco 755 if p == subClassOf: 756 # Other axioms sets classes to be subclasses of themselves, to one can optimize the trivial case 757 if c1 != c2 : 758 for x in self.graph.subjects(type, c1): 759 self.store_triple((x, type, c2)) 760 761 # RULES cax-eqc1 and cax-eqc1 762 # Other axioms set classes to be equivalent to themselves, one can optimize the trivial case 763 elif p == equivalentClass and c1 != c2: 764 # RULE cax-eqc1 765 for x in self.graph.subjects(type, c1): 766 self.store_triple((x, type, c2)) 767 # RULE cax-eqc1 768 for x in self.graph.subjects(type, c2): 769 self.store_triple((x, type, c1)) 770 771 # RULE cax-dw 772 elif p == disjointWith: 773 for x in self.graph.subjects(type, c1): 774 if (x, type, c2) in self.graph: 775 self.add_error("Disjoint classes %s and %s have a common individual %s" % (c1, c2, self._get_resource_or_literal(x))) 776 777 # RULE cax-adc 778 elif p == type and c2 == AllDisjointClasses: 779 x = c1 780 for y in self.graph.objects(x, members): 781 classes = self._list(y) 782 if len(classes) > 0: 783 for i in xrange(0, len(classes) - 1): 784 cl1 = classes[i] 785 for z in self.graph.subjects(type,cl1): 786 for cl2 in classes[(i + 1):]: 787 if (z, type, cl2) in self.graph: 788 self.add_error("Disjoint classes %s and %s have a common individual %s" % (cl1, cl2, z))
789
790 - def _schema_vocabulary(self, triple, cycle_num):
791 """ 792 Table 9: The Semantics of Schema Vocabulary. Essentially, the scm-* rules 793 @param triple: triple to work on 794 @param cycle_num: which cycle are we in, starting with 1. Can be used for some optimization. 795 """ 796 # In many of the 'if' branches, corresponding to rules in the document, 797 # the branch begins by a renaming of variables (eg, pp,c = s,o). 798 # There is no programming reasons for doing that, but by renaming the 799 # variables it becomes easier to compare the declarative rules 800 # in the document with the implementation 801 s,p,o = triple 802 803 # RULE scm-cls 804 if p == type and o == OWLClass: 805 c = s 806 self.store_triple((c, subClassOf, c)) 807 self.store_triple((c, equivalentClass, c)) 808 self.store_triple((c, subClassOf, Thing)) 809 self.store_triple((Nothing, subClassOf, c)) 810 811 # RULE scm-sco 812 # Rule scm-eqc2 813 elif p == subClassOf: 814 c1, c2 = s, o 815 # RULE scm-sco 816 # Optimize out the trivial identity case (set elsewhere already) 817 if c1 != c2: 818 for c3 in self.graph.objects(c2, subClassOf): 819 # Another axiom already sets that... 820 if c1 != c3 : self.store_triple((c1, subClassOf, c3)) 821 # RULE scm-eqc2 822 if (c2, subClassOf, c1) in self.graph: 823 self.store_triple((c1, equivalentClass, c2)) 824 825 # RULE scm-eqc 826 elif p == equivalentClass and s != o: 827 c1,c2 = s,o 828 self.store_triple((c1, subClassOf, c2)) 829 self.store_triple((c2, subClassOf, c1)) 830 831 # RULE scm-op and RULE scm-dp folded together 832 # There is a bit of a cheating here: 'Property' is not, strictly speaking, in the rule set! 833 elif p == type and (o == ObjectProperty or o == DatatypeProperty or o == Property): 834 pp = s 835 self.store_triple((pp, subPropertyOf, pp)) 836 self.store_triple((pp, equivalentProperty, pp)) 837 838 # RULE scm-spo 839 # RULE scm-eqp2 840 elif p == subPropertyOf and s != o: 841 p1, p2 = s, o 842 # Optimize out the trivial identity case (set elsewhere already) 843 # RULE scm-spo 844 if p1 != p2 : 845 for p3 in self.graph.objects(p2,subPropertyOf): 846 if p1 != p3: 847 self.store_triple((p1, subPropertyOf, p3)) 848 849 #RULE scm-eqp2 850 if (p2, subPropertyOf, p1) in self.graph: 851 self.store_triple((p1, equivalentProperty, p2)) 852 853 # RULE scm-eqp 854 # Optimize out the trivial identity case (set elsewhere already) 855 elif p == equivalentProperty and s != o: 856 p1, p2 = s, o 857 self.store_triple((p1, subPropertyOf, p2)) 858 self.store_triple((p2, subPropertyOf, p1)) 859 860 # RULES scm-dom1 and scm-dom2 861 elif p == domain: 862 # RULE scm-dom1 863 pp, c1 = s, o 864 for (_x, _y, c2) in self.graph.triples((c1, subClassOf, None)) : 865 if c1 != c2 : 866 self.store_triple((pp, domain, c2)) 867 # RULE scm-dom1 868 p2, c = s, o 869 for (p1,_x,_y) in self.graph.triples((None, subPropertyOf, p2)) : 870 if p1 != p2 : 871 self.store_triple((p1, domain, c)) 872 873 # RULES scm-rng1 and scm-rng2 874 elif p == range: 875 # RULE scm-rng1 876 pp, c1 = s, o 877 for (_x,_y,c2) in self.graph.triples((c1, subClassOf, None)) : 878 if c1 != c2 : self.store_triple((pp, range, c2)) 879 # RULE scm-rng1 880 p2, c = s, o 881 for (p1,_x,_y) in self.graph.triples((None, subPropertyOf, p2)) : 882 if p1 != p2 : self.store_triple((p1, range, c)) 883 884 # RULE scm-hv 885 elif p == hasValue: 886 c1, i = s, o 887 for p1 in self.graph.objects(c1, onProperty): 888 for c2 in self.graph.subjects(hasValue, i): 889 for p2 in self.graph.objects(c2, onProperty): 890 if (p1, subPropertyOf, p2) in self.graph: 891 self.store_triple((c1, subClassOf, c2)) 892 893 # RULES scm-svf1 and scm-svf2 894 elif p == someValuesFrom: 895 # RULE scm-svf1 896 c1, y1 = s, o 897 for pp in self.graph.objects(c1,onProperty): 898 for c2 in self.graph.subjects(onProperty,pp): 899 for y2 in self.graph.objects(c2, someValuesFrom): 900 if (y1,subClassOf, y2) in self.graph: 901 self.store_triple((c1, subClassOf, c2)) 902 903 # RULE scm-svf2 904 c1, y = s, o 905 for p1 in self.graph.objects(c1, onProperty): 906 for c2 in self.graph.subjects(someValuesFrom,y): 907 for p2 in self.graph.objects(c2, onProperty): 908 if (p1,subPropertyOf,p2) in self.graph: 909 self.store_triple((c1, subClassOf, c2)) 910 911 # RULES scm-avf1 and scm-avf2 912 elif p == allValuesFrom: 913 # RULE scm-avf1 914 c1, y1 = s, o 915 for pp in self.graph.objects(c1, onProperty): 916 for c2 in self.graph.subjects(onProperty, pp) : 917 for y2 in self.graph.objects(c2, allValuesFrom) : 918 if (y1,subClassOf,y2) in self.graph: 919 self.store_triple((c1, subClassOf, c2)) 920 921 # RULE scm-avf2 922 c1, y = s, o 923 for p1 in self.graph.objects(c1, onProperty): 924 for c2 in self.graph.subjects(allValuesFrom, y): 925 for p2 in self.graph.objects(c2, onProperty): 926 if (p1,subPropertyOf, p2) in self.graph : 927 self.store_triple((c2, subClassOf, c1)) 928 929 # RULE scm-int 930 elif p == intersectionOf: 931 c, x = s, o 932 for ci in self._list(x): 933 self.store_triple((c, subClassOf, ci)) 934 935 # RULE scm-uni 936 elif p == unionOf: 937 c, x = s, o 938 for ci in self._list(x): 939 self.store_triple((ci, subClassOf, c))
940

OWL-RL-7.1.4/Doc_OLD/RDFClosure.OWLRL.OWLRL_Semantics-class.html000066400000000000000000001164701504201166100234520ustar00rootroot00000000000000 RDFClosure.OWLRL.OWLRL_Semantics
Package RDFClosure :: Module OWLRL :: Class OWLRL_Semantics
[hide private]
[frames] | no frames]

Class OWLRL_Semantics

source code

Closure.Core --+
               |
              OWLRL_Semantics
Known Subclasses:

OWL 2 RL Semantics class, ie, implementation of the OWL 2 RL closure graph.

Note that the module does not implement the so called Datatype entailment rules, simply because the underlying RDFLib does not implement the datatypes (ie, RDFLib will not make the literal "1.00" and "1.00000" identical, although even with all the ambiguities on datatypes, this should be made equal...). Also, the so-called extensional entailment rules (Section 7.3.1 in the RDF Semantics document) have not been implemented either.

The comments and references to the various rule follow the names as used in the OWL 2 RL document.

Instance Methods [hide private]
 
__init__(self, graph, axioms, daxioms, rdfs=None) source code
 
_list(self, l)
Shorthand to get a list of values (ie, from an rdf:List structure) starting at a head
source code
 
_get_resource_or_literal(self, node) source code
 
post_process(self)
Remove triples with bnode predicates.
source code
 
add_axioms(self)
Add axioms
source code
 
add_d_axioms(self)
Add the datatype axioms
source code
 
restriction_typing_check(self, v, t)
Helping method to check whether a type statement is in line with a possible restriction.
source code
 
_one_time_rules_datatypes(self)
Some of the rules in the rule set are axiomatic in nature, meaning that they really have to be added only once, there is no reason to add these in a cycle.
source code
 
_one_time_rules_misc(self)
Rules executed: cls-thing, cls-nothing, prp-ap.
source code
 
one_time_rules(self)
Some of the rules in the rule set are axiomatic in nature, meaning that they really have to be added only once, there is no reason to add these in a cycle.
source code
 
rules(self, t, cycle_num)
Go through the various rule groups, as defined in the OWL-RL profile text and implemented via local methods.
source code
 
_property_chain(self, p, x)
Implementation of the property chain axiom, invoked from inside the property axiom handler.
source code
 
_equality(self, triple, cycle_num)
Table 4: Semantics of equality.
source code
 
_properties(self, triple, cycle_num)
Table 5: The Semantics of Axioms about Properties.
source code
 
_classes(self, triple, cycle_num)
Table 6: The Semantics of Classes.
source code
 
_class_axioms(self, triple, cycle_num)
Table 7: Class Axioms.
source code
 
_schema_vocabulary(self, triple, cycle_num)
Table 9: The Semantics of Schema Vocabulary.
source code

Inherited from Closure.Core: add_error, closure, empty_stored_triples, flush_stored_triples, get_literal_value, pre_process, store_triple

Instance Variables [hide private]

Inherited from Closure.Core: IMaxNum, added_triples, axioms, daxioms, error_messages, graph, literal_proxies, rdfs

Method Details [hide private]

__init__(self, graph, axioms, daxioms, rdfs=None)
(Constructor)

source code 
Parameters:
  • graph (rdflib.Graph) - the RDF graph to be extended
  • axioms (bool) - whether (non-datatype) axiomatic triples should be added or not
  • daxioms (bool) - whether datatype axiomatic triples should be added or not
  • rdfs (boolean) - whether RDFS inference is also done (used in subclassed only)
Overrides: Closure.Core.__init__

_list(self, l)

source code 

Shorthand to get a list of values (ie, from an rdf:List structure) starting at a head

Parameters:
  • l - RDFLib resource, should be the head of an rdf:List
Returns:
array of resources

post_process(self)

source code 

Remove triples with bnode predicates. The Bnodes in the graph are collected in the first cycle run.

Overrides: Closure.Core.post_process

add_axioms(self)

source code 

Add axioms

Overrides: Closure.Core.add_axioms

add_d_axioms(self)

source code 

Add the datatype axioms

Overrides: Closure.Core.add_d_axioms

restriction_typing_check(self, v, t)

source code 

Helping method to check whether a type statement is in line with a possible restriction. This method is invoked by rule "cls-avf" before setting a type on an allValuesFrom restriction.

The method is a placeholder at this level. It is typically implemented by subclasses for extra checks, eg, for datatype facet checks.

Parameters:
  • v - the resource that is to be 'typed'
  • t - the targeted type (ie, Class)
Returns:
boolean

_one_time_rules_datatypes(self)

source code 

Some of the rules in the rule set are axiomatic in nature, meaning that they really have to be added only once, there is no reason to add these in a cycle. These are performed by this method that is invoked only once at the beginning of the process.

These are: cls-thing, cls-nothing1, prp-ap, dt-types1, dt-types2, dt-eq, dt-diff.

Note, however, that the dt-* are executed only partially, limited by the possibilities offered by RDFLib. These may not cover all the edge cases of OWL RL. Especially, dt-not-type has not (yet?) been implemented (I wonder whether RDFLib should not raise exception for those anyway...

one_time_rules(self)

source code 

Some of the rules in the rule set are axiomatic in nature, meaning that they really have to be added only once, there is no reason to add these in a cycle. These are performed by this method that is invoked only once at the beginning of the process.

These are: cls-thing, cls-nothing1, prp-ap, dt-types1, dt-types2, dt-eq, dt-diff.

Overrides: Closure.Core.one_time_rules

rules(self, t, cycle_num)

source code 

Go through the various rule groups, as defined in the OWL-RL profile text and implemented via local methods. (The calling cycle takes every tuple in the graph.)

Parameters:
  • t - a triple (in the form of a tuple)
  • cycle_num - which cycle are we in, starting with 1. This value is forwarded to all local rules; it is also used locally to collect the bnodes in the graph.
Overrides: Closure.Core.rules

_property_chain(self, p, x)

source code 

Implementation of the property chain axiom, invoked from inside the property axiom handler. This is the implementation of rule prp-spo2, taken aside for an easier readability of the code.

_equality(self, triple, cycle_num)

source code 

Table 4: Semantics of equality. Essentially, the eq-* rules.

Parameters:
  • triple - triple to work on
  • cycle_num - which cycle are we in, starting with 1. Can be used for some optimization.

_properties(self, triple, cycle_num)

source code 

Table 5: The Semantics of Axioms about Properties. Essentially, the prp-* rules.

Parameters:
  • triple - triple to work on
  • cycle_num - which cycle are we in, starting with 1. Can be used for some optimization.

_classes(self, triple, cycle_num)

source code 

Table 6: The Semantics of Classes. Essentially, the cls-* rules

Parameters:
  • triple - triple to work on
  • cycle_num - which cycle are we in, starting with 1. Can be used for some optimization.

_class_axioms(self, triple, cycle_num)

source code 

Table 7: Class Axioms. Essentially, the cax-* rules.

Parameters:
  • triple - triple to work on
  • cycle_num - which cycle are we in, starting with 1. Can be used for some optimization.

_schema_vocabulary(self, triple, cycle_num)

source code 

Table 9: The Semantics of Schema Vocabulary. Essentially, the scm-* rules

Parameters:
  • triple - triple to work on
  • cycle_num - which cycle are we in, starting with 1. Can be used for some optimization.

OWL-RL-7.1.4/Doc_OLD/RDFClosure.OWLRLExtras-module.html000066400000000000000000003171371504201166100221200ustar00rootroot00000000000000 RDFClosure.OWLRLExtras
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:

  • self restriction
  • owl:rational datatype
  • datatype restrictions via facets

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')

OWL-RL-7.1.4/Doc_OLD/RDFClosure.OWLRLExtras-pysrc.html000066400000000000000000003657331504201166100220000ustar00rootroot00000000000000 RDFClosure.OWLRLExtras
Package RDFClosure :: Module OWLRLExtras
[hide private]
[frames] | no frames]

Source Code for Module RDFClosure.OWLRLExtras

  1  #!/d/Bin/Python/python.exe 
  2  # -*- coding: utf-8 -*- 
  3  # 
  4  """ 
  5   
  6  Extension to OWL 2 RL, ie, some additional rules added to the system from OWL 2 Full. It is implemented through 
  7  the L{OWLRL_Extension} class, whose reference has to be passed to the relevant semantic class (ie, either the OWL 2 RL or the combined 
  8  closure class) as an 'extension'. 
  9   
 10  The added rules and features are: 
 11   
 12   - self restriction 
 13   - owl:rational datatype 
 14   - datatype restrictions via facets 
 15    
 16  In more details, the rules that are added: 
 17   
 18   1. self restriction 1: C{?z owl:hasSelf ?x. ?x owl:onProperty ?p. ?y rdf:type ?z. => ?y ?p ?y.} 
 19   2. self restriction 2: C{?z owl:hasSelf ?x. ?x owl:onProperty ?p. ?y ?p ?y. => ?y rdf:type ?z. } 
 20   
 21  @requires: U{RDFLib<https://github.com/RDFLib/rdflib>}, 4.0.0 and higher 
 22  @license: This software is available for use under the U{W3C Software License<http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231>} 
 23  @organization: U{World Wide Web Consortium<http://www.w3.org>} 
 24  @author: U{Ivan Herman<a href="http://www.w3.org/People/Ivan/">} 
 25   
 26  """ 
 27   
 28  __author__  = 'Ivan Herman' 
 29  __contact__ = 'Ivan Herman, ivan@w3.org' 
 30  __license__ = u'W3C® SOFTWARE NOTICE AND LICENSE, http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231' 
 31   
 32  import rdflib 
 33  # noinspection PyPep8Naming 
 34  from rdflib.namespace   import XSD as ns_xsd 
 35   
 36  from .RDFS      import  Property 
 37  # noinspection PyPep8Naming 
 38  from .RDFS      import type as rdfType 
 39  from .RDFS      import Resource, Class, subClassOf, subPropertyOf, domain 
 40  from .RDFS      import Datatype 
 41   
 42  from fractions import Fraction as Rational 
 43   
 44  from .DatatypeHandling import AltXSDToPYTHON 
 45   
 46  from .OWL import * 
 47  # noinspection PyPep8Naming 
 48  from .OWL import OWLNS as ns_owl 
 49  from .CombinedClosure import RDFS_OWLRL_Semantics 
 50  from .OWLRL import OWLRL_Annotation_properties 
 51   
 52  from .XsdDatatypes import OWL_RL_Datatypes, OWL_Datatype_Subsumptions 
 53   
 54  from RestrictedDatatype import extract_faceted_datatypes 
 55   
 56  ########################################################################################################################### 
 57  # Rational datatype 
 58   
 59  # noinspection PyPep8Naming 
60 -def _strToRational(v):
61 """Converting a string to a rational. 62 63 According to the OWL spec: numerator must be an integer, denominator a positive integer (ie, xsd['integer'] type), and the denominator 64 should not have a '+' sign. 65 66 @param v: the literal string defined as boolean 67 @return corresponding Rational value 68 @rtype: Rational 69 @raise ValueError: invalid rational string literal 70 """ 71 try : 72 r = v.split('/') 73 if len(r) == 2: 74 n_str = r[0] 75 d_str = r[1] 76 else: 77 n_str = r[0] 78 d_str = "1" 79 if d_str.strip()[0] == '+': 80 raise ValueError("Invalid Rational literal value %s" % v) 81 else : 82 return Rational(AltXSDToPYTHON[ns_xsd["integer"]](n_str), AltXSDToPYTHON[ns_xsd["positiveInteger"]](d_str)) 83 except: 84 raise ValueError("Invalid Rational literal value %s" % v)
85 86 ########################################################################################################################### 87 88 89 # noinspection PyPep8Naming,PyBroadException
90 -class OWLRL_Extension(RDFS_OWLRL_Semantics) :
91 """ 92 Additional rules to OWL 2 RL. The initialization method also adds the C{owl:rational} datatype to the set of allowed 93 datatypes with the L{_strToRational} function as a conversion between the literal form and a Rational. The C{xsd:decimal} datatype 94 is also set to be a subclass of C{owl:rational}. Furthermore, the restricted datatypes are extracted from the graph 95 using a L{separate method in a different module<RestrictedDatatype.extract_faceted_datatypes>}, and all those datatypes are also 96 added to the set of allowed datatypes. In the case of the restricted datatypes and extra subsumption relationship is set up 97 between the restricted and the base datatypes. 98 99 @cvar extra_axioms: additional axioms that have to be added to the deductive closure (in case the axiomatic triples are required) 100 @ivar restricted_datatypes : list of the datatype restriction 101 @type restricted_datatypes : array of L{restricted datatype<RestrictedDatatype.RestrictedDatatype>} instances 102 """ 103 extra_axioms = [ 104 (hasSelf, rdfType, Property), 105 (hasSelf, domain, Property), 106 ]
107 - def __init__(self, graph, axioms, daxioms, rdfs=False):
108 """ 109 @param graph: the RDF graph to be extended 110 @type graph: rdflib.Graph 111 @param axioms: whether (non-datatype) axiomatic triples should be added or not 112 @type axioms: Boolean 113 @param daxioms: whether datatype axiomatic triples should be added or not 114 @type daxioms: Boolean 115 @param rdfs: whether RDFS extension is done 116 @type rdfs: boolean 117 """ 118 RDFS_OWLRL_Semantics.__init__(self, graph, axioms, daxioms, rdfs) 119 self.rdfs = rdfs 120 self.add_new_datatype(ns_owl["rational"], _strToRational, OWL_RL_Datatypes, 121 subsumption_dict = OWL_Datatype_Subsumptions, 122 subsumption_key = ns_xsd["decimal"], 123 subsumption_list = [ns_owl["rational"]]) 124 125 self.restricted_datatypes = extract_faceted_datatypes(self, graph) 126 for dt in self.restricted_datatypes: 127 self.add_new_datatype(dt.datatype, dt.toPython, OWL_RL_Datatypes, 128 subsumption_dict = OWL_Datatype_Subsumptions, 129 subsumption_key = dt.datatype, 130 subsumption_list = [dt.base_type])
131 132 # noinspection PyShadowingNames
134 """ 135 A one-time-rule: all the literals are checked whether they are (a) of type restricted by a 136 faceted (restricted) datatype and (b) whether 137 the corresponding value abides to the restrictions. If true, then the literal gets an extra 138 tag as being of type of the restricted datatype, too. 139 """ 140 for rt in self.restricted_datatypes: 141 # This is a recorded restriction. The base type is: 142 base_type = rt.base_type 143 # Look through all the literals; more precisely, through the 144 # proxy bnodes: 145 for bn in self.literal_proxies.bnode_to_lit: 146 # check if the type of that proxy matches. Note that this also takes 147 # into account the subsumption datatypes, that have been taken 148 # care of by the 'regular' OWL RL process 149 if (bn, rdfType, base_type) in self.graph: 150 # yep, that is a good candidate! 151 lt = self.literal_proxies.bnode_to_lit[bn] 152 try : 153 # the conversion or the check may go wrong and raise an exception; then simply move on 154 value = lt.lit.toPython() 155 if rt.checkValue(value): 156 # yep, this is also of type 'rt' 157 self.store_triple((bn, rdfType, rt.datatype)) 158 except: 159 continue
160
161 - def restriction_typing_check(self, v, t):
162 """Helping method to check whether a type statement is in line with a possible 163 restriction. This method is invoked by rule "cls-avf" before setting a type 164 on an allValuesFrom restriction. 165 166 The method is a placeholder at this level. It is typically implemented by subclasses for 167 extra checks, eg, for datatype facet checks. 168 @param v: the resource that is to be 'typed' 169 @param t: the targeted type (ie, Class) 170 @return: boolean 171 """ 172 # Look through the restricted datatypes to see if 't' corresponds to one of those... 173 # There are a bunch of possible exceptions here with datatypes, but they can all 174 # be ignored... 175 try : 176 for rt in self.restricted_datatypes: 177 if rt.datatype == t: 178 # bingo 179 if v in self.literal_proxies.bnode_to_lit: 180 return rt.checkValue(self.literal_proxies.bnode_to_lit[v].lit.toPython()) 181 else : 182 return True 183 # if we got here, no restriction applies 184 return True 185 except : 186 return True
187
188 - def one_time_rules(self):
189 """ 190 This method is invoked only once at the beginning, and prior of, the forward chaining process. 191 192 At present, only the L{subsumption} of restricted datatypes<_subsume_restricted_datatypes>} is performed. 193 """ 194 RDFS_OWLRL_Semantics.one_time_rules(self) 195 # it is important to flush the triples at this point, because 196 # the handling of the restriction datatypes rely on the datatype 197 # subsumption triples added by the superclass 198 self.flush_stored_triples() 199 self._subsume_restricted_datatypes()
200
201 - def add_axioms(self):
202 """ 203 Add the L{extra axioms<OWLRL_Extension.extra_axioms>}, related to the self restrictions. 204 """ 205 RDFS_OWLRL_Semantics.add_axioms(self) 206 for t in self.extra_axioms : self.graph.add(t)
207
208 - def rules(self, t, cycle_num):
209 """ 210 Go through the additional rules implemented by this module. 211 @param t: a triple (in the form of a tuple) 212 @param cycle_num: which cycle are we in, starting with 1. This value is forwarded to all local rules; it is also used 213 locally to collect the bnodes in the graph. 214 """ 215 RDFS_OWLRL_Semantics.rules(self, t, cycle_num) 216 z, q, x = t 217 if q == hasSelf: 218 for p in self.graph.objects(z, onProperty): 219 for y in self.graph.subjects(rdfType, z): 220 self.store_triple((y, p, y)) 221 for y1, y2 in self.graph.subject_objects(p): 222 if y1 == y2 : 223 self.store_triple((y1, rdfType, z))
224 225 226 # noinspection PyPep8Naming
227 -class OWLRL_Extension_Trimming(OWLRL_Extension):
228 """ 229 This Class adds only one feature to L{OWLRL_Extension}: to initialize with a trimming flag set to C{True} by default. 230 231 This is pretty experimental and probably contentious: this class I{removes} a number of triples from the Graph at the very end of the processing steps. 232 These triples are either the by-products of the deductive closure calculation or are axiom like triples that are added following the rules of OWL 2 RL. 233 While these triples I{are necessary} for the correct inference of really 'useful' triples, they may not be of interest for the application 234 for the end result. The triples that are removed are of the form (following a SPARQL-like notation): 235 236 - C{?x owl:sameAs ?x}, C{?x rdfs:subClassOf ?x}, C{?x rdfs:subPropertyOf ?x}, C{?x owl:equivalentClass ?x} type triples 237 - C{?x rdfs:subClassOf rdf:Resource}, C{?x rdfs:subClassOf owl:Thing}, C{?x rdf:type rdf:Resource}, C{owl:Nothing rdfs:subClassOf ?x} type triples 238 - For a datatype that does I{not} appear explicitly in a type assignments (ie, in a C{?x rdf:type dt}) the corresponding C{dt rdf:type owl:Datatype} and C{dt rdf:type owl:DataRange} triples, as well as the disjointness statements with other datatypes 239 - annotation property axioms 240 - a number of axiomatic triples on C{owl:Thing}, C{owl:Nothing} and C{rdf:Resource} (eg, C{owl:Nothing rdf:type owl:Class}, C{owl:Thing owl:equivalentClass rdf:Resource}, etc.) 241 242 Trimming is the only feature of this class, done in the L{post_process} step. If users extend L{OWLRL_Extension}, this class can be safely mixed in via multiple 243 inheritance. 244 """
245 - def __init__(self, graph, axioms, daxioms, rdfs=False):
246 """ 247 @param graph: the RDF graph to be extended 248 @type graph: rdflib.Graph 249 @param axioms: whether (non-datatype) axiomatic triples should be added or not 250 @type axioms: Boolean 251 @param daxioms: whether datatype axiomatic triples should be added or not 252 @type daxioms: Boolean 253 @param rdfs: whether RDFS extension is done 254 @type rdfs: boolean 255 """ 256 OWLRL_Extension.__init__(self, graph, axioms, daxioms, rdfs=False)
257
258 - def post_process(self) :
259 """ 260 Do some post-processing step performing the trimming of the graph. See the L{class description<OWLRL_Extension_Trimming>} for further details. 261 262 """ 263 OWLRL_Extension.post_process(self) 264 self.flush_stored_triples() 265 266 to_be_removed = set() 267 for t in self.graph: 268 s, p, o = t 269 if s == o : 270 if p == sameAs or p == equivalentClass or p == subClassOf or p == subPropertyOf: 271 to_be_removed.add(t) 272 if (p == subClassOf and (o == Thing or o == Resource)) or (p == rdfType and o == Resource) or (s == Nothing and p == subClassOf): 273 to_be_removed.add(t) 274 275 for dt in OWL_RL_Datatypes : 276 # see if this datatype appears explicitly in the graph as the type of a symbol 277 if len([s for s in self.graph.subjects(rdfType, dt)]) == 0: 278 to_be_removed.add((dt, rdfType, Datatype)) 279 to_be_removed.add((dt, rdfType, DataRange)) 280 281 for t in self.graph.triples((dt, disjointWith, None)): 282 to_be_removed.add(t) 283 for t in self.graph.triples((None, disjointWith, dt)): 284 to_be_removed.add(t) 285 286 for an in OWLRL_Annotation_properties: 287 self.graph.remove((an, rdfType, AnnotationProperty)) 288 289 to_be_removed.add((Nothing, rdfType, OWLClass)) 290 to_be_removed.add((Nothing, rdfType, Class)) 291 to_be_removed.add((Thing, rdfType, OWLClass)) 292 to_be_removed.add((Thing, rdfType, Class)) 293 to_be_removed.add((Thing, equivalentClass, Resource)) 294 to_be_removed.add((Resource, equivalentClass, Thing)) 295 to_be_removed.add((OWLClass, equivalentClass, Class)) 296 to_be_removed.add((OWLClass, subClassOf, Class)) 297 to_be_removed.add((Class, equivalentClass, OWLClass)) 298 to_be_removed.add((Class, subClassOf, OWLClass)) 299 to_be_removed.add((Datatype, subClassOf, DataRange)) 300 to_be_removed.add((Datatype, equivalentClass, DataRange)) 301 to_be_removed.add((DataRange, subClassOf, Datatype)) 302 to_be_removed.add((DataRange, equivalentClass, Datatype)) 303 304 for t in to_be_removed: 305 self.graph.remove(t)
306

OWL-RL-7.1.4/Doc_OLD/RDFClosure.OWLRLExtras.OWLRL_Extension-class.html000066400000000000000000000732111504201166100246620ustar00rootroot00000000000000 RDFClosure.OWLRLExtras.OWLRL_Extension
Package RDFClosure :: Module OWLRLExtras :: Class OWLRL_Extension
[hide private]
[frames] | no frames]

Class OWLRL_Extension

source code

                Closure.Core --+        
                               |        
      RDFSClosure.RDFS_Semantics --+    
                                   |    
                Closure.Core --+   |    
                               |   |    
           OWLRL.OWLRL_Semantics --+    
                                   |    
CombinedClosure.RDFS_OWLRL_Semantics --+
                                       |
                                      OWLRL_Extension
Known Subclasses:

Additional rules to OWL 2 RL. The initialization method also adds the owl:rational datatype to the set of allowed datatypes with the _strToRational function as a conversion between the literal form and a Rational. The xsd:decimal datatype is also set to be a subclass of owl:rational. Furthermore, the restricted datatypes are extracted from the graph using a separate method in a different module, and all those datatypes are also added to the set of allowed datatypes. In the case of the restricted datatypes and extra subsumption relationship is set up between the restricted and the base datatypes.

Instance Methods [hide private]
 
__init__(self, graph, axioms, daxioms, rdfs=False) source code
 
_subsume_restricted_datatypes(self)
A one-time-rule: all the literals are checked whether they are (a) of type restricted by a faceted (restricted) datatype and (b) whether the corresponding value abides to the restrictions.
source code
 
add_axioms(self)
Add the extra axioms, related to the self restrictions.
source code
 
one_time_rules(self)
This method is invoked only once at the beginning, and prior of, the forward chaining process.
source code
 
restriction_typing_check(self, v, t)
Helping method to check whether a type statement is in line with a possible restriction.
source code
 
rules(self, t, cycle_num)
Go through the additional rules implemented by this module.
source code

Inherited from CombinedClosure.RDFS_OWLRL_Semantics: add_d_axioms, post_process

Inherited from Closure.Core: add_error, closure, empty_stored_triples, flush_stored_triples, get_literal_value, pre_process, store_triple

Static Methods [hide private]

Inherited from CombinedClosure.RDFS_OWLRL_Semantics: add_new_datatype

Class Variables [hide private]
  extra_axioms = [(rdflib.term.URIRef(u'http://www.w3.org/2002/0...
additional axioms that have to be added to the deductive closure (in case the axiomatic triples are required)
Instance Variables [hide private]
array of restricted datatype instances restricted_datatypes
list of the datatype restriction

Inherited from CombinedClosure.RDFS_OWLRL_Semantics: full_binding_triples, rdfs

Inherited from Closure.Core: IMaxNum, added_triples, axioms, daxioms, error_messages, graph, literal_proxies

Method Details [hide private]

__init__(self, graph, axioms, daxioms, rdfs=False)
(Constructor)

source code 
Parameters:
  • graph (rdflib.Graph) - the RDF graph to be extended
  • axioms (Boolean) - whether (non-datatype) axiomatic triples should be added or not
  • daxioms (Boolean) - whether datatype axiomatic triples should be added or not
  • rdfs (boolean) - whether RDFS extension is done
Overrides: OWLRL.OWLRL_Semantics.__init__

_subsume_restricted_datatypes(self)

source code 

A one-time-rule: all the literals are checked whether they are (a) of type restricted by a faceted (restricted) datatype and (b) whether the corresponding value abides to the restrictions. If true, then the literal gets an extra tag as being of type of the restricted datatype, too.

add_axioms(self)

source code 

Add the extra axioms, related to the self restrictions.

Overrides: OWLRL.OWLRL_Semantics.add_axioms

one_time_rules(self)

source code 

This method is invoked only once at the beginning, and prior of, the forward chaining process.

At present, only the L{subsumption} of restricted datatypes<_subsume_restricted_datatypes>} is performed.

Overrides: OWLRL.OWLRL_Semantics.one_time_rules

restriction_typing_check(self, v, t)

source code 

Helping method to check whether a type statement is in line with a possible restriction. This method is invoked by rule "cls-avf" before setting a type on an allValuesFrom restriction.

The method is a placeholder at this level. It is typically implemented by subclasses for extra checks, eg, for datatype facet checks.

Parameters:
  • v - the resource that is to be 'typed'
  • t - the targeted type (ie, Class)
Returns:
boolean
Overrides: OWLRL.OWLRL_Semantics.restriction_typing_check

rules(self, t, cycle_num)

source code 

Go through the additional rules implemented by this module.

Parameters:
  • t - a triple (in the form of a tuple)
  • cycle_num - which cycle are we in, starting with 1. This value is forwarded to all local rules; it is also used locally to collect the bnodes in the graph.
Overrides: OWLRL.OWLRL_Semantics.rules

Class Variable Details [hide private]

extra_axioms

additional axioms that have to be added to the deductive closure (in case the axiomatic triples are required)
Value:
[(rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#hasSelf'),
  rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#type\
'),
  rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#Prop\
erty')),
 (rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#hasSelf'),
  rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#domain'),
  rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#Prop\
...

OWL-RL-7.1.4/Doc_OLD/RDFClosure.OWLRLExtras.OWLRL_Extension_Trimming-class.html000066400000000000000000000511611504201166100265300ustar00rootroot00000000000000 RDFClosure.OWLRLExtras.OWLRL_Extension_Trimming
Package RDFClosure :: Module OWLRLExtras :: Class OWLRL_Extension_Trimming
[hide private]
[frames] | no frames]

Class OWLRL_Extension_Trimming

source code

                Closure.Core --+            
                               |            
      RDFSClosure.RDFS_Semantics --+        
                                   |        
                Closure.Core --+   |        
                               |   |        
           OWLRL.OWLRL_Semantics --+        
                                   |        
CombinedClosure.RDFS_OWLRL_Semantics --+    
                                       |    
                         OWLRL_Extension --+
                                           |
                                          OWLRL_Extension_Trimming

This Class adds only one feature to OWLRL_Extension: to initialize with a trimming flag set to True by default.

This is pretty experimental and probably contentious: this class removes a number of triples from the Graph at the very end of the processing steps. These triples are either the by-products of the deductive closure calculation or are axiom like triples that are added following the rules of OWL 2 RL. While these triples are necessary for the correct inference of really 'useful' triples, they may not be of interest for the application for the end result. The triples that are removed are of the form (following a SPARQL-like notation):

  • ?x owl:sameAs ?x, ?x rdfs:subClassOf ?x, ?x rdfs:subPropertyOf ?x, ?x owl:equivalentClass ?x type triples
  • ?x rdfs:subClassOf rdf:Resource, ?x rdfs:subClassOf owl:Thing, ?x rdf:type rdf:Resource, owl:Nothing rdfs:subClassOf ?x type triples
  • For a datatype that does not appear explicitly in a type assignments (ie, in a ?x rdf:type dt) the corresponding dt rdf:type owl:Datatype and dt rdf:type owl:DataRange triples, as well as the disjointness statements with other datatypes
  • annotation property axioms
  • a number of axiomatic triples on owl:Thing, owl:Nothing and rdf:Resource (eg, owl:Nothing rdf:type owl:Class, owl:Thing owl:equivalentClass rdf:Resource, etc.)

Trimming is the only feature of this class, done in the post_process step. If users extend OWLRL_Extension, this class can be safely mixed in via multiple inheritance.

Instance Methods [hide private]
 
__init__(self, graph, axioms, daxioms, rdfs=False) source code
 
post_process(self)
Do some post-processing step performing the trimming of the graph.
source code

Inherited from OWLRL_Extension: add_axioms, one_time_rules, restriction_typing_check, rules

Inherited from CombinedClosure.RDFS_OWLRL_Semantics: add_d_axioms

Inherited from Closure.Core: add_error, closure, empty_stored_triples, flush_stored_triples, get_literal_value, pre_process, store_triple

Static Methods [hide private]

Inherited from CombinedClosure.RDFS_OWLRL_Semantics: add_new_datatype

Class Variables [hide private]

Inherited from OWLRL_Extension: extra_axioms

Instance Variables [hide private]

Inherited from OWLRL_Extension: restricted_datatypes

Inherited from CombinedClosure.RDFS_OWLRL_Semantics: full_binding_triples, rdfs

Inherited from Closure.Core: IMaxNum, added_triples, axioms, daxioms, error_messages, graph, literal_proxies

Method Details [hide private]

__init__(self, graph, axioms, daxioms, rdfs=False)
(Constructor)

source code 
Parameters:
  • graph (rdflib.Graph) - the RDF graph to be extended
  • axioms (Boolean) - whether (non-datatype) axiomatic triples should be added or not
  • daxioms (Boolean) - whether datatype axiomatic triples should be added or not
  • rdfs (boolean) - whether RDFS extension is done
Overrides: OWLRL.OWLRL_Semantics.__init__

post_process(self)

source code 

Do some post-processing step performing the trimming of the graph. See the class description for further details.

Overrides: OWLRL.OWLRL_Semantics.post_process

OWL-RL-7.1.4/Doc_OLD/RDFClosure.RDFS'-module.html000066400000000000000000001066041504201166100206320ustar00rootroot00000000000000 RDFClosure.RDFS'
Package RDFClosure :: Module RDFS'
[hide private]
[frames] | no frames]

Module RDFS'

source code

RDF(S) terms. Note that the set of terms is complete, ie, it includes all OWL 2 terms, regardless of whether the term is used in OWL 2 RL or not.


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

Variables [hide private]
  RDFNS = Namespace(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#')
  RDFSNS = Namespace(u'http://www.w3.org/2000/01/rdf-schema#')
  Seq = rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-sy...
  Bag = rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-sy...
  Alt = rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-sy...
  Statement = rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-...
  Property = rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-r...
  XMLLiteral = rdflib.term.URIRef(u'http://www.w3.org/1999/02/22...
  HTMLLiteral = rdflib.term.URIRef(u'http://www.w3.org/1999/02/2...
  LangString = rdflib.term.URIRef(u'http://www.w3.org/1999/02/22...
  List = rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-s...
  subject = rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rd...
  predicate = rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-...
  object = rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf...
  type = rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-s...
  value = rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-...
  first = rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-...
  rest = rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-s...
  nil = rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-sy...
  Resource = rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-...
  Class = rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-sch...
  subClassOf = rdflib.term.URIRef(u'http://www.w3.org/2000/01/rd...
  subPropertyOf = rdflib.term.URIRef(u'http://www.w3.org/2000/01...
  comment = rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-s...
  label = rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-sch...
  domain = rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-sc...
  range = rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-sch...
  seeAlso = rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-s...
  isDefinedBy = rdflib.term.URIRef(u'http://www.w3.org/2000/01/r...
  Literal = rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-s...
  Container = rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf...
  ContainerMembershipProperty = rdflib.term.URIRef(u'http://www....
  member = rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-sc...
  Datatype = rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-...
  __package__ = 'RDFClosure'

Imports: rdflib, Namespace


Variables Details [hide private]

Seq

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

Bag

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

Alt

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

Statement

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

Property

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

XMLLiteral

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

HTMLLiteral

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

LangString

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

List

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

subject

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

predicate

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

object

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

type

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

value

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

first

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

rest

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

nil

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

Resource

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

Class

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

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')

comment

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

label

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

domain

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

range

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

seeAlso

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

isDefinedBy

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

Literal

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

Container

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

ContainerMembershipProperty

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

member

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

Datatype

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

OWL-RL-7.1.4/Doc_OLD/RDFClosure.RDFS'-pysrc.html000066400000000000000000000672651504201166100205160ustar00rootroot00000000000000 RDFClosure.RDFS'
Package RDFClosure :: Module RDFS'
[hide private]
[frames] | no frames]

Source Code for Module RDFClosure.RDFS'

 1  """ 
 2  RDF(S) terms. Note that the set of terms is I{complete}, ie, it includes I{all} OWL 2 terms, regardless of whether the term is 
 3  used in OWL 2 RL or not. 
 4   
 5  @requires: U{RDFLib<https://github.com/RDFLib/rdflib>}, 4.0.0 and higher 
 6  @license: This software is available for use under the U{W3C Software License<http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231>} 
 7  @organization: U{World Wide Web Consortium<http://www.w3.org>} 
 8  @author: U{Ivan Herman<a href="http://www.w3.org/People/Ivan/">} 
 9  """ 
10   
11  import rdflib 
12  from rdflib                             import Namespace 
13   
14  RDFNS           = Namespace("http://www.w3.org/1999/02/22-rdf-syntax-ns#") 
15  RDFSNS          = Namespace("http://www.w3.org/2000/01/rdf-schema#") 
16   
17  # RDF Classes 
18  Seq             = RDFNS["Seq"] 
19  Bag             = RDFNS["Bag"] 
20  Alt             = RDFNS["Alt"] 
21  Statement       = RDFNS["Statement"] 
22  Property        = RDFNS["Property"] 
23  XMLLiteral      = RDFNS["XMLLiteral"] 
24  HTMLLiteral     = RDFNS["HTML"] 
25  LangString      = RDFNS["LangString"] 
26  List            = RDFNS["List"] 
27   
28  # RDF Properties 
29  subject         = RDFNS["subject"] 
30  predicate       = RDFNS["predicate"] 
31  object          = RDFNS["object"] 
32  type            = RDFNS["type"] 
33  value           = RDFNS["value"] 
34  first           = RDFNS["first"] 
35  rest            = RDFNS["rest"] 
36  # and _n where n is a non-negative integer 
37   
38  # RDF Resources 
39  nil             = RDFNS["nil"] 
40   
41  Resource                                        = RDFSNS["Resource"] 
42  Class                                           = RDFSNS["Class"] 
43  subClassOf                                      = RDFSNS["subClassOf"] 
44  subPropertyOf                           = RDFSNS["subPropertyOf"] 
45  comment                                         = RDFSNS["comment"] 
46  label                                           = RDFSNS["label"] 
47  domain                                          = RDFSNS["domain"] 
48  range                                           = RDFSNS["range"] 
49  seeAlso                                         = RDFSNS["seeAlso"] 
50  isDefinedBy                                     = RDFSNS["isDefinedBy"] 
51  Literal                                         = RDFSNS["Literal"] 
52  Container                                       = RDFSNS["Container"] 
53  ContainerMembershipProperty     = RDFSNS["ContainerMembershipProperty"] 
54  member                                          = RDFSNS["member"] 
55  Datatype                                        = RDFSNS["Datatype"] 
56   

OWL-RL-7.1.4/Doc_OLD/RDFClosure.RDFSClosure-module.html000066400000000000000000000240021504201166100221070ustar00rootroot00000000000000 RDFClosure.RDFSClosure
Package RDFClosure :: Module RDFSClosure
[hide private]
[frames] | no frames]

Module RDFSClosure

source code

This module is brute force implementation of the RDFS semantics on the top of RDFLib (with some caveats, see in the introductory text).


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]
  RDFS_Semantics
RDFS Semantics class, ie, implementation of the RDFS closure graph.
Variables [hide private]
  __author__ = 'Ivan Herman'
  __license__ = u'W3C® SOFTWARE NOTICE AND LICENSE, http://www.w...
  __package__ = 'RDFClosure'

Imports: Property, type, Resource, Class, subClassOf, subPropertyOf, domain, range, Literal, ContainerMembershipProperty, member, Datatype, ns_rdf, Core, RDFS_Axiomatic_Triples, RDFS_D_Axiomatic_Triples


Variables Details [hide private]

__license__

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

OWL-RL-7.1.4/Doc_OLD/RDFClosure.RDFSClosure-pysrc.html000066400000000000000000002062711504201166100217740ustar00rootroot00000000000000 RDFClosure.RDFSClosure
Package RDFClosure :: Module RDFSClosure
[hide private]
[frames] | no frames]

Source Code for Module RDFClosure.RDFSClosure

  1  #!/d/Bin/Python/python.exe 
  2  # -*- coding: utf-8 -*- 
  3  # 
  4  """ 
  5  This module is brute force implementation of the RDFS semantics on the top of RDFLib (with some caveats, see in the introductory text). 
  6   
  7   
  8  @requires: U{RDFLib<https://github.com/RDFLib/rdflib>}, 4.0.0 and higher 
  9  @license: This software is available for use under the U{W3C Software License<http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231>} 
 10  @organization: U{World Wide Web Consortium<http://www.w3.org>} 
 11  @author: U{Ivan Herman<a href="http://www.w3.org/People/Ivan/">} 
 12   
 13  """ 
 14   
 15  __author__  = 'Ivan Herman' 
 16  __contact__ = 'Ivan Herman, ivan@w3.org' 
 17  __license__ = u'W3C® SOFTWARE NOTICE AND LICENSE, http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231' 
 18   
 19  from RDFClosure.RDFS    import Property, type 
 20  from RDFClosure.RDFS    import Resource, Class, subClassOf, subPropertyOf, domain, range 
 21  from RDFClosure.RDFS    import Literal, ContainerMembershipProperty, member, Datatype 
 22  # noinspection PyPep8Naming 
 23  from RDFClosure.RDFS    import RDFNS as ns_rdf 
 24   
 25  from RDFClosure.Closure          import Core 
 26  from RDFClosure.AxiomaticTriples import RDFS_Axiomatic_Triples, RDFS_D_Axiomatic_Triples 
 27   
 28   
 29  ###################################################################################################### 
 30   
 31  ## RDFS Semantics class 
 32  # noinspection PyPep8Naming 
33 -class RDFS_Semantics(Core):
34 """RDFS Semantics class, ie, implementation of the RDFS closure graph. 35 36 Note that the module does I{not} implement the so called Datatype entailment rules, simply because the underlying RDFLib does 37 not implement the datatypes (ie, RDFLib will not make the literal "1.00" and "1.00000" identical, although 38 even with all the ambiguities on datatypes, this I{should} be made equal...). Also, the so-called extensional entailment rules 39 (Section 7.3.1 in the RDF Semantics document) have not been implemented either. 40 41 The comments and references to the various rule follow the names as used in the U{RDF Semantics document<http://www.w3.org/TR/rdf-mt/>}. 42 """
43 - def __init__(self, graph, axioms, daxioms, rdfs):
44 """ 45 @param graph: the RDF graph to be extended 46 @type graph: rdflib.Graph 47 @param axioms: whether (non-datatype) axiomatic triples should be added or not 48 @type axioms: bool 49 @param daxioms: whether datatype axiomatic triples should be added or not 50 @type daxioms: bool 51 @param rdfs: whether RDFS inference is also done (used in subclassed only) 52 @type rdfs: boolean 53 """ 54 Core.__init__(self, graph, axioms, daxioms, rdfs)
55
56 - def add_axioms(self):
57 """Add axioms 58 """ 59 for t in RDFS_Axiomatic_Triples: 60 self.graph.add(t) 61 for i in xrange(1, self.IMaxNum + 1): 62 ci = ns_rdf[("_%d" % i)] 63 self.graph.add((ci, type, Property)) 64 self.graph.add((ci, domain, Resource)) 65 self.graph.add((ci, range, Resource)) 66 self.graph.add((ci, type, ContainerMembershipProperty))
67
68 - def add_d_axioms(self):
69 """This is not really complete, because it just uses the comparison possibilities that rdflib provides.""" 70 literals = self.literal_proxies.lit_to_bnode.keys() 71 # #1 72 for lt in literals: 73 if lt.dt is not None: 74 self.graph.add((self.literal_proxies.lit_to_bnode[lt], type, lt.dt)) 75 76 for t in RDFS_D_Axiomatic_Triples : 77 self.graph.add(t)
78 79 # noinspection PyBroadException
80 - def one_time_rules(self):
81 """Some of the rules in the rule set are axiomatic in nature, meaning that they really have to be added only 82 once, there is no reason to add these in a cycle. These are performed by this method that is invoked only once 83 at the beginning of the process. 84 85 In this case this is related to a 'hidden' same as rules on literals with identical values (though different lexical values) 86 """ 87 # There is also a hidden sameAs rule in RDF Semantics: if a literal appears in a triple, and another one has the same value, 88 # then the triple should be duplicated with the other value. 89 for lt1 in self.literal_proxies.lit_to_bnode.keys(): 90 for lt2 in self.literal_proxies.lit_to_bnode.keys(): 91 if lt1 != lt2: 92 try: 93 lt1_d = lt1.lit.toPython() 94 lt2_d = lt2.lit.toPython() 95 if lt1_d == lt2_d : 96 # In OWL, this line is simply stating a sameAs for the corresponding BNodes, and then let 97 # the usual rules take effect. In RDFS this is not possible, so the sameAs rule is, essentially 98 # replicated... 99 bn1 = self.literal_proxies.lit_to_bnode[lt1] 100 bn2 = self.literal_proxies.lit_to_bnode[lt2] 101 for (s, p, o) in self.graph.triples((None, None, bn1)) : 102 self.graph.add((s, p, bn2)) 103 except: 104 # there may be a problem with one of the python conversions; the rule is imply ignored 105 #raise e 106 pass
107
108 - def rules(self,t,cycle_num):
109 """ 110 Go through the RDFS entailment rules rdf1, rdfs4-rdfs12, by extending the graph. 111 @param t: a triple (in the form of a tuple) 112 @param cycle_num: which cycle are we in, starting with 1. Can be used for some (though minor) optimization. 113 """ 114 s, p, o = t 115 # rdf1 116 self.store_triple((p, type, Property)) 117 # rdfs4a 118 if cycle_num == 1: 119 self.store_triple((s, type, Resource)) 120 # rdfs4b 121 if cycle_num == 1: 122 self.store_triple((o, type, Resource)) 123 if p == domain: 124 # rdfs2 125 for uuu, Y, yyy in self.graph.triples((None, s, None)): 126 self.store_triple((uuu, type, o)) 127 if p == range: 128 # rdfs3 129 for uuu, Y, vvv in self.graph.triples((None, s, None)): 130 self.store_triple((vvv, type, o)) 131 if p == subPropertyOf: 132 # rdfs5 133 for Z, Y, xxx in self.graph.triples((o, subPropertyOf, None)): 134 self.store_triple((s, subPropertyOf, xxx)) 135 # rdfs7 136 for zzz, Z, www in self.graph.triples((None, s, None)): 137 self.store_triple((zzz, o, www)) 138 if p == type and o == Property: 139 # rdfs6 140 self.store_triple((s, subPropertyOf, s)) 141 if p == type and o == Class: 142 # rdfs8 143 self.store_triple((s, subClassOf, Resource)) 144 # rdfs10 145 self.store_triple((s, subClassOf, s)) 146 if p == subClassOf: 147 # rdfs9 148 for vvv, Y, Z in self.graph.triples((None, type, s)): 149 self.store_triple((vvv, type, o)) 150 # rdfs11 151 for Z, Y, xxx in self.graph.triples((o, subClassOf, None)): 152 self.store_triple((s, subClassOf, xxx)) 153 if p == type and o == ContainerMembershipProperty : 154 # rdfs12 155 self.store_triple((s, subPropertyOf, member)) 156 if p == type and o == Datatype: 157 self.store_triple((s, subClassOf, Literal))
158

OWL-RL-7.1.4/Doc_OLD/RDFClosure.RDFSClosure.RDFS_Semantics-class.html000066400000000000000000000445371504201166100245110ustar00rootroot00000000000000 RDFClosure.RDFSClosure.RDFS_Semantics
Package RDFClosure :: Module RDFSClosure :: Class RDFS_Semantics
[hide private]
[frames] | no frames]

Class RDFS_Semantics

source code

Closure.Core --+
               |
              RDFS_Semantics
Known Subclasses:

RDFS Semantics class, ie, implementation of the RDFS closure graph.

Note that the module does not implement the so called Datatype entailment rules, simply because the underlying RDFLib does not implement the datatypes (ie, RDFLib will not make the literal "1.00" and "1.00000" identical, although even with all the ambiguities on datatypes, this should be made equal...). Also, the so-called extensional entailment rules (Section 7.3.1 in the RDF Semantics document) have not been implemented either.

The comments and references to the various rule follow the names as used in the RDF Semantics document.

Instance Methods [hide private]
 
__init__(self, graph, axioms, daxioms, rdfs) source code
 
add_axioms(self)
Add axioms
source code
 
add_d_axioms(self)
This is not really complete, because it just uses the comparison possibilities that rdflib provides.
source code
 
one_time_rules(self)
Some of the rules in the rule set are axiomatic in nature, meaning that they really have to be added only once, there is no reason to add these in a cycle.
source code
 
rules(self, t, cycle_num)
Go through the RDFS entailment rules rdf1, rdfs4-rdfs12, by extending the graph.
source code

Inherited from Closure.Core: add_error, closure, empty_stored_triples, flush_stored_triples, get_literal_value, post_process, pre_process, store_triple

Instance Variables [hide private]

Inherited from Closure.Core: IMaxNum, added_triples, axioms, daxioms, error_messages, graph, literal_proxies, rdfs

Method Details [hide private]

__init__(self, graph, axioms, daxioms, rdfs)
(Constructor)

source code 
Parameters:
  • graph (rdflib.Graph) - the RDF graph to be extended
  • axioms (bool) - whether (non-datatype) axiomatic triples should be added or not
  • daxioms (bool) - whether datatype axiomatic triples should be added or not
  • rdfs (boolean) - whether RDFS inference is also done (used in subclassed only)
Overrides: Closure.Core.__init__

add_axioms(self)

source code 

Add axioms

Overrides: Closure.Core.add_axioms

add_d_axioms(self)

source code 

This is not really complete, because it just uses the comparison possibilities that rdflib provides.

Overrides: Closure.Core.add_d_axioms

one_time_rules(self)

source code 

Some of the rules in the rule set are axiomatic in nature, meaning that they really have to be added only once, there is no reason to add these in a cycle. These are performed by this method that is invoked only once at the beginning of the process.

In this case this is related to a 'hidden' same as rules on literals with identical values (though different lexical values)

Overrides: Closure.Core.one_time_rules

rules(self, t, cycle_num)

source code 

Go through the RDFS entailment rules rdf1, rdfs4-rdfs12, by extending the graph.

Parameters:
  • t - a triple (in the form of a tuple)
  • cycle_num - which cycle are we in, starting with 1. Can be used for some (though minor) optimization.
Overrides: Closure.Core.rules

OWL-RL-7.1.4/Doc_OLD/RDFClosure.RestrictedDatatype-module.html000066400000000000000000003051631504201166100236320ustar00rootroot00000000000000 RDFClosure.RestrictedDatatype
Package RDFClosure :: Module RestrictedDatatype
[hide private]
[frames] | no frames]

Module RestrictedDatatype

source code

Module to datatype restrictions, ie, data ranges.

The module implements the following aspects of datatype restrictions:

  • a new datatype is created run-time and added to the allowed and accepted datatypes; literals are checked whether they abide to the restrictions
  • the new datatype is defined to be a 'subClass' of the restricted datatype
  • literals of the restricted datatype and that abide to the restrictions defined by the facets are also assigned to be of the new type

The last item is important to handle the following structures:

ex:RE a owl:Restriction ;
       owl:onProperty ex:p ;
       owl:someValuesFrom [
               a rdfs:Datatype ;
               owl:onDatatype xsd:string ;
               owl:withRestrictions (
                       [ xsd:minLength "3"^^xsd:integer ]
                       [ xsd:maxLength "6"^^xsd:integer ]
               )
       ]
.
ex:q ex:p "abcd"^^xsd:string.

In the case above the system can then infer that ex:q is also of type ex:RE.

Datatype restrictions are used by the OWL RL Extensions extension class.

The implementation is not 100% complete. Some things that an ideal implementation should do are not done yet like:

  • checking whether a facet is of a datatype that is allowed for that facet
  • handling of non-literals in the facets (ie, if the resource is defined to be of type literal, but whose value is defined via a separate 'owl:sameAs' somewhere else)

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]
  RestrictedDatatypeCore
An 'abstract' superclass for datatype restrictions.
  RestrictedDatatype
Implementation of a datatype with facets, ie, datatype with restrictions.
Functions [hide private]
 
_lit_to_value(dt, v)
This method is used to convert a string to a value with facet checking.
source code
boolean
_lang_range_check(range, lang)
Implementation of the extended filtering algorithm, as defined in point 3.3.2, of RFC 4647, on matching language ranges and language tags.
source code
 
extract_faceted_datatypes(core, graph)
Extractions of restricted (ie, faceted) datatypes from the graph.
source code
Variables [hide private]
  __author__ = 'Ivan Herman'
  __license__ = u'W3C® SOFTWARE NOTICE AND LICENSE, http://www.w...
  MIN_MAX = 0
  LENGTH = 1
  LENGTH_AND_PATTERN = 2
  LENGTH_PATTERN_LRANGE = 3
  Datatypes_per_facets = {0: [rdflib.term.URIRef(u'http://www.w3...
  facetable_datatypes = [rdflib.term.URIRef(u'http://www.w3.org/...
  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...
  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/...
  DataRange = rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl...
  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#')
  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...
  ReflexiveProperty = rdflib.term.URIRef(u'http://www.w3.org/200...
  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...
  __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/...
  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...
  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/...
  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...
  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: re, ns_owl, Datatype, type, ns_rdf, rdflibLiteral, ns_xsd, AltXSDToPYTHON, Namespace, rdflib


Function Details [hide private]

_lit_to_value(dt, v)

source code 

This method is used to convert a string to a value with facet checking. RDF Literals are converted to Python values using this method; if there is a problem, an exception is raised (and caught higher up to generate an error message).

The method is the equivalent of all the methods in the DatatypeHandling module, and is registered to the system run time, as new restricted datatypes are discovered.

(Technically, the registration is done via a lambda v: _lit_to_value(self,v) setting from within a RestrictedDatatype instance)

Parameters:
Raises:
  • ValueError - invalid literal value

_lang_range_check(range, lang)

source code 

Implementation of the extended filtering algorithm, as defined in point 3.3.2, of RFC 4647, on matching language ranges and language tags. Needed to handle the rdf:PlainLiteral datatype.

Parameters:
  • range - language range
  • lang - language tag
Returns: boolean

extract_faceted_datatypes(core, graph)

source code 

Extractions of restricted (ie, faceted) datatypes from the graph.

Parameters:
  • core (Closure.Core) - the core closure instance that is being handled
  • graph - RDFLib graph
Returns:
array of RestrictedDatatype instances

Variables Details [hide private]

__license__

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

Datatypes_per_facets

Value:
{0: [rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#rational'),
     rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#decimal'),
     rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#integer'),
     rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#nonNegative\
Integer'),
     rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#nonPositive\
Integer'),
     rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#positiveInt\
...

facetable_datatypes

Value:
[rdflib.term.URIRef(u'http://www.w3.org/2002/07/owl#rational'),
 rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#decimal'),
 rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#integer'),
 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#positiveInteger\
...

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')

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')

DataRange

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

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')

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')

ReflexiveProperty

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

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'\
)

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')

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')

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')

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')

OWL-RL-7.1.4/Doc_OLD/RDFClosure.RestrictedDatatype-pysrc.html000066400000000000000000004502541504201166100235070ustar00rootroot00000000000000 RDFClosure.RestrictedDatatype
Package RDFClosure :: Module RestrictedDatatype
[hide private]
[frames] | no frames]

Source Code for Module RDFClosure.RestrictedDatatype

  1  # -*- coding: utf-8 -*- 
  2  # 
  3  """ 
  4  Module to datatype restrictions, ie, data ranges. 
  5    
  6  The module implements the following aspects of datatype restrictions: 
  7   
  8   - a new datatype is created run-time and added to the allowed and accepted datatypes; literals are checked whether they abide to the restrictions 
  9   - the new datatype is defined to be a 'subClass' of the restricted datatype 
 10   - literals of the restricted datatype and that abide to the restrictions defined by the facets are also assigned to be of the new type 
 11    
 12  The last item is important to handle the following structures:: 
 13   ex:RE a owl:Restriction ; 
 14          owl:onProperty ex:p ; 
 15          owl:someValuesFrom [ 
 16                  a rdfs:Datatype ; 
 17                  owl:onDatatype xsd:string ; 
 18                  owl:withRestrictions ( 
 19                          [ xsd:minLength "3"^^xsd:integer ] 
 20                          [ xsd:maxLength "6"^^xsd:integer ] 
 21                  ) 
 22          ] 
 23   . 
 24   ex:q ex:p "abcd"^^xsd:string. 
 25  In the case above the system can then infer that C{ex:q} is also of type C{ex:RE}. 
 26   
 27  Datatype restrictions are used by the L{OWL RL Extensions<OWLRLExtras.OWLRL_Extension>} extension class. 
 28   
 29  The implementation is not 100% complete. Some things that an ideal implementation should do are not done yet like: 
 30   
 31   - checking whether a facet is of a datatype that is allowed for that facet 
 32   - handling of non-literals in the facets (ie, if the resource is defined to be of type literal, but whose value 
 33   is defined via a separate 'owl:sameAs' somewhere else) 
 34   
 35  @requires: U{RDFLib<https://github.com/RDFLib/rdflib>}, 4.0.0 and higher 
 36  @license: This software is available for use under the U{W3C Software License<http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231>} 
 37  @organization: U{World Wide Web Consortium<http://www.w3.org>} 
 38  @author: U{Ivan Herman<a href="http://www.w3.org/People/Ivan/">} 
 39   
 40  """ 
 41   
 42  __author__  = 'Ivan Herman' 
 43  __contact__ = 'Ivan Herman, ivan@w3.org' 
 44  __license__ = u'W3C® SOFTWARE NOTICE AND LICENSE, http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231' 
 45   
 46  import re 
 47   
 48  from OWL import * 
 49  # noinspection PyPep8Naming,PyPep8Naming 
 50  from OWL import OWLNS as ns_owl 
 51  from RDFClosure.RDFS import Datatype 
 52  from RDFClosure.RDFS import type 
 53  # noinspection PyPep8Naming 
 54  from RDFClosure.RDFS import RDFNS as ns_rdf 
 55   
 56  from rdflib     import Literal as rdflibLiteral 
 57  # noinspection PyPep8Naming 
 58  from rdflib.namespace import XSD as ns_xsd 
 59   
 60  from DatatypeHandling import AltXSDToPYTHON 
 61   
 62  #: Constant for datatypes using min, max (inclusive and exclusive): 
 63  MIN_MAX                                 = 0 
 64  #: Constant for datatypes using length, minLength, and maxLength (and nothing else) 
 65  LENGTH                                  = 1 
 66  #: Constant for datatypes using length, minLength, maxLength, and pattern 
 67  LENGTH_AND_PATTERN              = 2 
 68  #: Constant for datatypes using length, minLength, maxLength, pattern, and lang range 
 69  LENGTH_PATTERN_LRANGE   = 3 
 70   
 71  #: Dictionary of all the datatypes, keyed by category 
 72  Datatypes_per_facets = { 
 73          MIN_MAX                                 : [ns_owl["rational"], ns_xsd["decimal"], ns_xsd["integer"], 
 74                                                                  ns_xsd["nonNegativeInteger"], ns_xsd["nonPositiveInteger"], 
 75                                                                  ns_xsd["positiveInteger"], ns_xsd["negativeInteger"], 
 76                                                                  ns_xsd["long"], ns_xsd["short"], ns_xsd["byte"], 
 77                                                                  ns_xsd["unsignedLong"], ns_xsd["unsignedInt"], ns_xsd["unsignedShort"], ns_xsd["unsignedByte"], 
 78                                                                  ns_xsd["double"], ns_xsd["float"], 
 79                                                                  ns_xsd["dateTime"], ns_xsd["dateTimeStamp"], ns_xsd["time"], ns_xsd["date"] 
 80                                                            ], 
 81          LENGTH                                  : [ns_xsd["hexBinary"], ns_xsd["base64Binary"]], 
 82          LENGTH_AND_PATTERN              : [ns_xsd["anyURI"], ns_xsd["string"], ns_xsd["NMTOKEN"], ns_xsd["Name"], ns_xsd["NCName"], 
 83                                                                  ns_xsd["language"], ns_xsd["normalizedString"] 
 84                                                            ], 
 85          LENGTH_PATTERN_LRANGE   : [ns_rdf["plainLiteral"]] 
 86  } 
 87   
 88  #: a simple list containing C{all} datatypes that may have a facet 
 89  facetable_datatypes = reduce(lambda x, y: x + y, Datatypes_per_facets.values()) 
 90   
 91  ####################################################################################################### 
 92   
93 -def _lit_to_value(dt, v):
94 """ 95 This method is used to convert a string to a value with facet checking. RDF Literals are converted to 96 Python values using this method; if there is a problem, an exception is raised (and caught higher 97 up to generate an error message). 98 99 The method is the equivalent of all the methods in the L{DatatypeHandling} module, and is registered 100 to the system run time, as new restricted datatypes are discovered. 101 102 (Technically, the registration is done via a C{lambda v: _lit_to_value(self,v)} setting from within a 103 L{RestrictedDatatype} instance) 104 @param dt: faceted datatype 105 @type dt: L{RestrictedDatatype} 106 @param v: literal to be converted and checked 107 @raise ValueError: invalid literal value 108 """ 109 # This may raise an exception... 110 value = dt.converter(v) 111 112 # look at the different facet categories and try to find which is 113 # is, if any, the one that is of relevant for this literal 114 for cat in Datatypes_per_facets.keys(): 115 if dt.base_type in Datatypes_per_facets[cat]: 116 # yep, this is to be checked. 117 if not dt.checkValue(value) : 118 raise ValueError("Literal value %s does not fit the faceted datatype %s" % (v,dt)) 119 # got here, everything should be fine 120 return value
121 122 # noinspection PyPep8Naming,PyShadowingBuiltins
123 -def _lang_range_check(range, lang):
124 """ 125 Implementation of the extended filtering algorithm, as defined in point 3.3.2, 126 of U{RFC 4647<http://www.rfc-editor.org/rfc/rfc4647.txt>}, on matching language ranges and language tags. 127 Needed to handle the C{rdf:PlainLiteral} datatype. 128 @param range: language range 129 @param lang: language tag 130 @rtype: boolean 131 """ 132 def _match(r, l): 133 """Matching of a range and language item: either range is a wildcard or the two are equal 134 @param r: language range item 135 @param l: language tag item 136 @rtype: boolean 137 """ 138 return r == '*' or r == l
139 140 rangeList = range.strip().lower().split('-') 141 langList = lang.strip().lower().split('-') 142 if not _match(rangeList[0], langList[0]): 143 return False 144 145 rI = 1 146 rL = 1 147 while rI < len(rangeList) : 148 if rangeList[rI] == '*' : 149 rI += 1 150 continue 151 if rL >= len(langList) : 152 return False 153 if _match(rangeList[rI], langList[rL]) : 154 rI += 1 155 rL += 1 156 continue 157 if len(langList[rL]) == 1 : 158 return False 159 else : 160 rL += 1 161 continue 162 return True 163 164 ####################################################################################################### 165
166 -def extract_faceted_datatypes(core, graph):
167 """ 168 Extractions of restricted (ie, faceted) datatypes from the graph. 169 @param core: the core closure instance that is being handled 170 @type core: L{Closure.Core} 171 @param graph: RDFLib graph 172 @return: array of L{RestrictedDatatype} instances 173 """ 174 retval = [] 175 for dtype in graph.subjects(type, Datatype) : 176 base_type = None 177 facets = [] 178 try : 179 base_types = [x for x in graph.objects(dtype, onDatatype)] 180 if len(base_types) > 0 : 181 if len(base_types) > 1 : 182 raise Exception("Several base datatype for the same restriction %s" % dtype) 183 else : 184 base_type = base_types[0] 185 if base_type in facetable_datatypes : 186 rlists = [x for x in graph.objects(dtype, withRestrictions)] 187 if len(rlists) > 1 : 188 raise Exception("More than one facet lists for the same restriction %s" % dtype) 189 elif len(rlists) > 0 : 190 final_facets = [] 191 for r in graph.items(rlists[0]) : 192 for (facet, lit) in graph.predicate_objects(r) : 193 if isinstance(lit, rdflibLiteral) : 194 # the python value of the literal should be extracted 195 # note that this call may lead to an exception, but that is fine, 196 # it is caught some lines below anyway... 197 try : 198 if lit.datatype is None or lit.datatype == ns_xsd["string"]: 199 final_facets.append((facet, str(lit))) 200 else : 201 final_facets.append((facet, AltXSDToPYTHON[lit.datatype](str(lit)))) 202 except Exception, msg : 203 core.add_error(msg) 204 continue 205 # We do have everything we need: 206 new_datatype = RestrictedDatatype(dtype, base_type, final_facets) 207 retval.append(new_datatype) 208 except Exception, msg: 209 #import sys 210 #print sys.exc_info() 211 #print sys.exc_type 212 #print sys.exc_value 213 #print sys.exc_traceback 214 core.add_error(msg) 215 continue 216 return retval
217 218 219 # noinspection PyPep8Naming
221 """An 'abstract' superclass for datatype restrictions. The instance variables listed here are 222 used in general, without the specificities of the concrete restricted datatype. 223 224 This module defines the L{RestrictedDatatype} class that corresponds to the datatypes and their restrictions 225 defined in the OWL 2 standard. Other modules may subclass this class to define new datatypes with restrictions. 226 @ivar type_uri : the URI for this datatype 227 @ivar base_type : URI of the datatype that is restricted 228 @ivar toPython : function to convert a Literal of the specified type to a Python value. 229 """
230 - def __init__(self, type_uri, base_type):
231 self.datatype = type_uri 232 self.base_type = base_type 233 self.toPython = None
234
235 - def checkValue(self, value) :
236 """ 237 Check whether the (python) value abides to the constraints defined by the current facets. 238 @param value: the value to be checked 239 @rtype: boolean 240 """ 241 raise Exception("This class should not be used by itself, only via its subclasses!")
242 243 # noinspection PyPep8Naming
244 -class RestrictedDatatype(RestrictedDatatypeCore):
245 """ 246 Implementation of a datatype with facets, ie, datatype with restrictions. 247 248 @ivar datatype : the URI for this datatype 249 @ivar base_type : URI of the datatype that is restricted 250 @ivar converter : method to convert a literal of the base type to a Python value (drawn from L{DatatypeHandling.AltXSDToPYTHON}) 251 @ivar minExclusive : value for the C{xsd:minExclusive} facet, initialized to C{None} and set to the right value if a facet is around 252 @ivar minInclusive : value for the C{xsd:minInclusive} facet, initialized to C{None} and set to the right value if a facet is around 253 @ivar maxExclusive : value for the C{xsd:maxExclusive} facet, initialized to C{None} and set to the right value if a facet is around 254 @ivar maxInclusive : value for the C{xsd:maxInclusive} facet, initialized to C{None} and set to the right value if a facet is around 255 @ivar minLength : value for the C{xsd:minLength} facet, initialized to C{None} and set to the right value if a facet is around 256 @ivar maxLength : value for the C{xsd:maxLength} facet, initialized to C{None} and set to the right value if a facet is around 257 @ivar length : value for the C{xsd:length} facet, initialized to C{None} and set to the right value if a facet is around 258 @ivar pattern : array of patterns for the C{xsd:pattern} facet, initialized to C{[]} and set to the right value if a facet is around 259 @ivar langRange : array of language ranges for the C{rdf:langRange} facet, initialized to C{[]} and set to the right value if a facet is around 260 @ivar check_methods : list of class methods that are relevant for the given C{base_type} 261 @ivar toPython : function to convert a Literal of the specified type to a Python value. Is defined by C{lambda v : _lit_to_value(self, v)}, see L{_lit_to_value} 262 """ 263
264 - def __init__(self, type_uri, base_type, facets):
265 """ 266 @param type_uri: URI of the datatype being defined 267 @param base_type: URI of the base datatype, ie, the one being restricted 268 @param facets : array of C{(facetURI, value)} pairs 269 """ 270 RestrictedDatatypeCore.__init__(self, type_uri, base_type) 271 if self.base_type not in AltXSDToPYTHON : 272 raise Exception("No facet is implemented for datatype %s" % self.base_type) 273 self.converter = AltXSDToPYTHON[self.base_type] 274 275 self.minExclusive = None 276 self.maxExclusive = None 277 self.minInclusive = None 278 self.maxInclusive = None 279 self.length = None 280 self.maxLength = None 281 self.minLength = None 282 self.pattern = [] 283 self.langRange = [] 284 for (facet, value) in facets: 285 if facet == ns_xsd["minInclusive"] and (self.minInclusive is None or self.minInclusive < value): 286 self.minInclusive = value 287 elif facet == ns_xsd["minExclusive"] and (self.minExclusive is None or self.minExclusive < value): 288 self.minExclusive = value 289 elif facet == ns_xsd["maxInclusive"] and (self.maxInclusive is None or value < self.maxInclusive): 290 self.maxInclusive = value 291 elif facet == ns_xsd["maxExclusive"] and (self.maxExclusive is None or value < self.maxExclusive): 292 self.maxExclusive = value 293 elif facet == ns_rdf["langRange"]: 294 self.langRange.append(value) 295 elif facet == ns_xsd["length"]: 296 self.length = value 297 elif facet == ns_xsd["maxLength"] and (self.maxLength is None or value < self.maxLength): 298 self.maxLength = value 299 elif facet == ns_xsd["minLength"] and (self.minLength is None or value > self.minLength): 300 self.minLength = value 301 elif facet == ns_xsd["pattern"] : 302 self.pattern.append(re.compile(value)) 303 304 # Choose the methods that are relevant for this datatype, based on the base type 305 facet_to_method = { 306 MIN_MAX : [RestrictedDatatype._check_max_exclusive, RestrictedDatatype._check_min_exclusive, 307 RestrictedDatatype._check_max_inclusive, RestrictedDatatype._check_min_inclusive], 308 LENGTH : [RestrictedDatatype._check_min_length, RestrictedDatatype._check_max_length, 309 RestrictedDatatype._check_length], 310 LENGTH_AND_PATTERN : [RestrictedDatatype._check_min_length, RestrictedDatatype._check_max_length, 311 RestrictedDatatype._check_length, RestrictedDatatype._check_pattern], 312 LENGTH_PATTERN_LRANGE : [RestrictedDatatype._check_min_length, RestrictedDatatype._check_max_length, 313 RestrictedDatatype._check_length, RestrictedDatatype._check_lang_range] 314 } 315 self.check_methods = [] 316 for cat in Datatypes_per_facets.keys(): 317 if self.base_type in Datatypes_per_facets[cat]: 318 self.check_methods = facet_to_method[cat] 319 break 320 self.toPython = lambda v : _lit_to_value(self, v)
321
322 - def checkValue(self, value) :
323 """ 324 Check whether the (python) value abides to the constraints defined by the current facets. 325 @param value: the value to be checked 326 @rtype: boolean 327 """ 328 for method in self.check_methods: 329 if not method(self, value): 330 return False 331 return True
332
333 - def _check_min_exclusive(self, value):
334 """ 335 Check the (python) value against min exclusive facet. 336 @param value: the value to be checked 337 @rtype: boolean 338 """ 339 if self.minExclusive is not None: 340 return self.minExclusive < value 341 else : 342 return True
343
344 - def _check_min_inclusive(self, value):
345 """ 346 Check the (python) value against min inclusive facet. 347 @param value: the value to be checked 348 @rtype: boolean 349 """ 350 if self.minInclusive is not None : 351 return self.minInclusive <= value 352 else : 353 return True
354
355 - def _check_max_exclusive(self, value) :
356 """ 357 Check the (python) value against max exclusive facet. 358 @param value: the value to be checked 359 @rtype: boolean 360 """ 361 if self.maxExclusive is not None : 362 return value < self.maxExclusive 363 else : 364 return True
365
366 - def _check_max_inclusive(self, value) :
367 """ 368 Check the (python) value against max inclusive facet. 369 @param value: the value to be checked 370 @rtype: boolean 371 """ 372 if self.maxInclusive is not None : 373 return value <= self.maxInclusive 374 else : 375 return True
376
377 - def _check_min_length(self, value) :
378 """ 379 Check the (python) value against minimum length facet. 380 @param value: the value to be checked 381 @rtype: boolean 382 """ 383 if isinstance(value, rdflibLiteral) : 384 val = str(value) 385 else : 386 val = value 387 if self.minLength is not None : 388 return self.minLength <= len(val) 389 else : 390 return True
391
392 - def _check_max_length(self, value):
393 """ 394 Check the (python) value against maximum length facet. 395 @param value: the value to be checked 396 @rtype: boolean 397 """ 398 if isinstance(value, rdflibLiteral): 399 val = str(value) 400 else : 401 val = value 402 if self.maxLength is not None: 403 return self.maxLength >= len(val) 404 else : 405 return True
406
407 - def _check_length(self, value):
408 """ 409 Check the (python) value against exact length facet. 410 @param value: the value to be checked 411 @rtype: boolean 412 """ 413 if isinstance(value, rdflibLiteral): 414 val = str(value) 415 else : 416 val = value 417 if self.length is not None: 418 return self.length == len(val) 419 else : 420 return True
421
422 - def _check_pattern(self, value):
423 """ 424 Check the (python) value against array of regular expressions. 425 @param value: the value to be checked 426 @rtype: boolean 427 """ 428 if isinstance(value, rdflibLiteral): 429 val = str(value) 430 else : 431 val = value 432 for p in self.pattern : 433 if p.match(val) is None : 434 return False 435 return True
436
437 - def _check_lang_range(self, value):
438 """ 439 Check the (python) value against array of language ranges. 440 @param value: the value to be checked 441 @rtype: boolean 442 """ 443 if isinstance(value, rdflibLiteral) : 444 lang = value.language 445 else : 446 return False 447 for r in self.langRange : 448 if not _lang_range_check(r, lang): 449 return False 450 return True
451

OWL-RL-7.1.4/Doc_OLD/RDFClosure.RestrictedDatatype.RestrictedDatatype-class.html000066400000000000000000001026351504201166100272540ustar00rootroot00000000000000 RDFClosure.RestrictedDatatype.RestrictedDatatype
Package RDFClosure :: Module RestrictedDatatype :: Class RestrictedDatatype
[hide private]
[frames] | no frames]

Class RestrictedDatatype

source code

RestrictedDatatypeCore --+
                         |
                        RestrictedDatatype

Implementation of a datatype with facets, ie, datatype with restrictions.

Instance Methods [hide private]
 
__init__(self, type_uri, base_type, facets) source code
boolean
checkValue(self, value)
Check whether the (python) value abides to the constraints defined by the current facets.
source code
boolean
_check_min_exclusive(self, value)
Check the (python) value against min exclusive facet.
source code
boolean
_check_min_inclusive(self, value)
Check the (python) value against min inclusive facet.
source code
boolean
_check_max_exclusive(self, value)
Check the (python) value against max exclusive facet.
source code
boolean
_check_max_inclusive(self, value)
Check the (python) value against max inclusive facet.
source code
boolean
_check_min_length(self, value)
Check the (python) value against minimum length facet.
source code
boolean
_check_max_length(self, value)
Check the (python) value against maximum length facet.
source code
boolean
_check_length(self, value)
Check the (python) value against exact length facet.
source code
boolean
_check_pattern(self, value)
Check the (python) value against array of regular expressions.
source code
boolean
_check_lang_range(self, value)
Check the (python) value against array of language ranges.
source code
Instance Variables [hide private]
  base_type
URI of the datatype that is restricted
  check_methods
list of class methods that are relevant for the given base_type
  converter
method to convert a literal of the base type to a Python value (drawn from DatatypeHandling.AltXSDToPYTHON)
  datatype
the URI for this datatype
  langRange
array of language ranges for the rdf:langRange facet, initialized to [] and set to the right value if a facet is around
  length
value for the xsd:length facet, initialized to None and set to the right value if a facet is around
  maxExclusive
value for the xsd:maxExclusive facet, initialized to None and set to the right value if a facet is around
  maxInclusive
value for the xsd:maxInclusive facet, initialized to None and set to the right value if a facet is around
  maxLength
value for the xsd:maxLength facet, initialized to None and set to the right value if a facet is around
  minExclusive
value for the xsd:minExclusive facet, initialized to None and set to the right value if a facet is around
  minInclusive
value for the xsd:minInclusive facet, initialized to None and set to the right value if a facet is around
  minLength
value for the xsd:minLength facet, initialized to None and set to the right value if a facet is around
  pattern
array of patterns for the xsd:pattern facet, initialized to [] and set to the right value if a facet is around
  toPython
function to convert a Literal of the specified type to a Python value.

Inherited from RestrictedDatatypeCore: type_uri

Method Details [hide private]

__init__(self, type_uri, base_type, facets)
(Constructor)

source code 
Parameters:
  • type_uri - URI of the datatype being defined
  • base_type - URI of the base datatype, ie, the one being restricted
  • facets - array of (facetURI, value) pairs
Overrides: RestrictedDatatypeCore.__init__

checkValue(self, value)

source code 

Check whether the (python) value abides to the constraints defined by the current facets.

Parameters:
  • value - the value to be checked
Returns: boolean
Overrides: RestrictedDatatypeCore.checkValue

_check_min_exclusive(self, value)

source code 

Check the (python) value against min exclusive facet.

Parameters:
  • value - the value to be checked
Returns: boolean

_check_min_inclusive(self, value)

source code 

Check the (python) value against min inclusive facet.

Parameters:
  • value - the value to be checked
Returns: boolean

_check_max_exclusive(self, value)

source code 

Check the (python) value against max exclusive facet.

Parameters:
  • value - the value to be checked
Returns: boolean

_check_max_inclusive(self, value)

source code 

Check the (python) value against max inclusive facet.

Parameters:
  • value - the value to be checked
Returns: boolean

_check_min_length(self, value)

source code 

Check the (python) value against minimum length facet.

Parameters:
  • value - the value to be checked
Returns: boolean

_check_max_length(self, value)

source code 

Check the (python) value against maximum length facet.

Parameters:
  • value - the value to be checked
Returns: boolean

_check_length(self, value)

source code 

Check the (python) value against exact length facet.

Parameters:
  • value - the value to be checked
Returns: boolean

_check_pattern(self, value)

source code 

Check the (python) value against array of regular expressions.

Parameters:
  • value - the value to be checked
Returns: boolean

_check_lang_range(self, value)

source code 

Check the (python) value against array of language ranges.

Parameters:
  • value - the value to be checked
Returns: boolean

Instance Variable Details [hide private]

toPython

function to convert a Literal of the specified type to a Python value.

OWL-RL-7.1.4/Doc_OLD/RDFClosure.RestrictedDatatype.RestrictedDatatypeCore-class.html000066400000000000000000000240321504201166100300570ustar00rootroot00000000000000 RDFClosure.RestrictedDatatype.RestrictedDatatypeCore
Package RDFClosure :: Module RestrictedDatatype :: Class RestrictedDatatypeCore
[hide private]
[frames] | no frames]

Class RestrictedDatatypeCore

source code

Known Subclasses:

An 'abstract' superclass for datatype restrictions. The instance variables listed here are used in general, without the specificities of the concrete restricted datatype.

This module defines the RestrictedDatatype class that corresponds to the datatypes and their restrictions defined in the OWL 2 standard. Other modules may subclass this class to define new datatypes with restrictions.

Instance Methods [hide private]
 
__init__(self, type_uri, base_type) source code
boolean
checkValue(self, value)
Check whether the (python) value abides to the constraints defined by the current facets.
source code
Instance Variables [hide private]
  base_type
URI of the datatype that is restricted
  toPython
function to convert a Literal of the specified type to a Python value.
  type_uri
the URI for this datatype
Method Details [hide private]

checkValue(self, value)

source code 

Check whether the (python) value abides to the constraints defined by the current facets.

Parameters:
  • value - the value to be checked
Returns: boolean

OWL-RL-7.1.4/Doc_OLD/RDFClosure.XsdDatatypes-module.html000066400000000000000000000530531504201166100224410ustar00rootroot00000000000000 RDFClosure.XsdDatatypes
Package RDFClosure :: Module XsdDatatypes
[hide private]
[frames] | no frames]

Module XsdDatatypes

source code

Lists of XSD datatypes and their mutual relationships


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

Variables [hide private]
  __author__ = 'Ivan Herman'
  __license__ = u'W3C® SOFTWARE NOTICE AND LICENSE, http://www.w...
  _Common_XSD_Datatypes = [rdflib.term.URIRef(u'http://www.w3.or...
  RDFS_Datatypes = [rdflib.term.URIRef(u'http://www.w3.org/2001/...
  OWL_RL_Datatypes = [rdflib.term.URIRef(u'http://www.w3.org/200...
  _Common_Datatype_Subsumptions = {rdflib.term.URIRef(u'http://w...
  RDFS_Datatype_Subsumptions = {rdflib.term.URIRef(u'http://www....
  OWL_Datatype_Subsumptions = {rdflib.term.URIRef(u'http://www.w...
  __package__ = 'RDFClosure'

Imports: ns_rdf, Literal, XMLLiteral, HTMLLiteral, LangString, rdflib, ns_xsd


Variables Details [hide private]

__license__

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

_Common_XSD_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\
'),
...

RDFS_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\
'),
...

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\
'),
...

_Common_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')],
...

RDFS_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_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-7.1.4/Doc_OLD/RDFClosure.XsdDatatypes-pysrc.html000066400000000000000000001574131504201166100223210ustar00rootroot00000000000000 RDFClosure.XsdDatatypes
Package RDFClosure :: Module XsdDatatypes
[hide private]
[frames] | no frames]

Source Code for Module RDFClosure.XsdDatatypes

 1  #!/d/Bin/Python/python.exe 
 2  # -*- coding: utf-8 -*- 
 3  # 
 4  """ 
 5  Lists of XSD datatypes and their mutual relationships 
 6   
 7  @requires: U{RDFLib<https://github.com/RDFLib/rdflib>}, 4.0.0 and higher 
 8  @license: This software is available for use under the U{W3C Software License<http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231>} 
 9  @organization: U{World Wide Web Consortium<http://www.w3.org>} 
10  @author: U{Ivan Herman<a href="http://www.w3.org/People/Ivan/">} 
11   
12  """ 
13   
14  __author__  = 'Ivan Herman' 
15  __contact__ = 'Ivan Herman, ivan@w3.org' 
16  __license__ = u'W3C® SOFTWARE NOTICE AND LICENSE, http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231' 
17   
18  # noinspection PyPep8Naming 
19  from .RDFS import RDFNS as ns_rdf 
20  from .RDFS import Literal 
21  from .RDFS import XMLLiteral 
22  from .RDFS import HTMLLiteral 
23  from .RDFS import LangString 
24   
25  import rdflib 
26  # noinspection PyPep8Naming 
27  from rdflib.namespace   import XSD as ns_xsd 
28   
29  #: The basic XSD types used everywhere; this means not the complete set of day/month types 
30  _Common_XSD_Datatypes = [ 
31          ns_xsd['integer'], ns_xsd['decimal'], ns_xsd['nonNegativeInteger'], ns_xsd['nonPositiveInteger'], 
32          ns_xsd['negativeInteger'], ns_xsd['positiveInteger'], ns_xsd['long'], ns_xsd['int'], ns_xsd['short'], 
33          ns_xsd['byte'], ns_xsd['unsignedLong'], ns_xsd['unsignedInt'], ns_xsd['unsignedShort'], 
34          ns_xsd['unsignedByte'], ns_xsd['float'], ns_xsd['double'], ns_xsd['string'], ns_xsd['normalizedString'], 
35          ns_xsd['token'], ns_xsd['language'], ns_xsd['Name'], ns_xsd['NCName'], ns_xsd['NMTOKEN'], 
36          ns_xsd['boolean'], ns_xsd['hexBinary'], ns_xsd['base64Binary'], ns_xsd['anyURI'], 
37          ns_xsd['dateTimeStamp'], ns_xsd['dateTime'], ns_xsd['time'], ns_xsd['date'], 
38          Literal, XMLLiteral, HTMLLiteral, LangString 
39  ] 
40   
41  #: RDFS Datatypes: the basic ones plus the complete set of day/month ones 
42  RDFS_Datatypes   = _Common_XSD_Datatypes + [ns_xsd['gYearMonth'], ns_xsd['gMonthDay'], ns_xsd['gYear'], ns_xsd['gDay'], ns_xsd['gMonth']] 
43   
44  #: OWL RL Datatypes: the basic ones plus plain literal 
45  OWL_RL_Datatypes = _Common_XSD_Datatypes + [ns_rdf['PlainLiteral']] 
46   
47  #: XSD Datatype subsumptions 
48  _Common_Datatype_Subsumptions = { 
49          ns_xsd['dateTimeStamp']                 : [ns_xsd['dateTime']], 
50          ns_xsd['integer']                               : [ns_xsd['decimal']], 
51          ns_xsd['long']                                  : [ns_xsd['integer'], ns_xsd['decimal']], 
52          ns_xsd['int']                                   : [ns_xsd['long'], ns_xsd['integer'], ns_xsd['decimal']], 
53          ns_xsd['short']                                 : [ns_xsd['int'], ns_xsd['long'], ns_xsd['integer'], ns_xsd['decimal']], 
54          ns_xsd['byte']                                  : [ns_xsd['short'], ns_xsd['int'], ns_xsd['long'], ns_xsd['integer'], ns_xsd['decimal']], 
55   
56          ns_xsd['nonNegativeInteger']    : [ns_xsd['integer'], ns_xsd['decimal']], 
57          ns_xsd['positiveInteger']               : [ns_xsd['nonNegativeInteger'], ns_xsd['integer'], ns_xsd['decimal']], 
58          ns_xsd['unsignedLong']                  : [ns_xsd['nonNegativeInteger'], ns_xsd['integer'], ns_xsd['decimal']], 
59          ns_xsd['unsignedInt']                   : [ns_xsd['unsignedLong'], ns_xsd['nonNegativeInteger'], ns_xsd['integer'], ns_xsd['decimal']], 
60          ns_xsd['unsignedShort']                 : [ns_xsd['unsignedInt'], ns_xsd['unsignedLong'], ns_xsd['nonNegativeInteger'], ns_xsd['integer'], ns_xsd['decimal']], 
61          ns_xsd['unsignedByte']                  : [ns_xsd['unsignedShort'], ns_xsd['unsignedInt'], ns_xsd['unsignedLong'], ns_xsd['nonNegativeInteger'], ns_xsd['integer'], ns_xsd['decimal']], 
62   
63          ns_xsd['nonPositiveInteger']    : [ns_xsd['integer'], ns_xsd['decimal']], 
64          ns_xsd['negativeInteger']               : [ns_xsd['nonPositiveInteger'], ns_xsd['integer'], ns_xsd['decimal']], 
65   
66          ns_xsd['normalizedString']              : [ns_xsd["string"] ], 
67          ns_xsd['token']                                 : [ns_xsd['normalizedString'], ns_xsd["string"]], 
68          ns_xsd['language']                              : [ns_xsd['token'], ns_xsd['normalizedString'], ns_xsd["string"]], 
69          ns_xsd['Name']                                  : [ns_xsd['token'], ns_xsd['normalizedString'], ns_xsd["string"]], 
70          ns_xsd['NCName']                                : [ns_xsd['Name'], ns_xsd['token'], ns_xsd['normalizedString'], ns_xsd["string"]], 
71          ns_xsd['NMTOKEN']                               : [ns_xsd['Name'], ns_xsd['token'], ns_xsd['normalizedString'], ns_xsd["string"]], 
72  } 
73   
74  #: RDFS Datatype subsumptions: at the moment, there is no extra to XSD 
75  RDFS_Datatype_Subsumptions      = _Common_Datatype_Subsumptions 
76   
77  #: OWL Datatype subsumptions: at the moment, there is no extra to XSD 
78  OWL_Datatype_Subsumptions       = _Common_Datatype_Subsumptions 
79   

OWL-RL-7.1.4/Doc_OLD/api-objects.txt000066400000000000000000002271131504201166100166450ustar00rootroot00000000000000RDFClosure RDFClosure-module.html RDFClosure.TURTLE RDFClosure-module.html#TURTLE RDFClosure.interpret_owl_imports RDFClosure-module.html#interpret_owl_imports RDFClosure.return_closure_class RDFClosure-module.html#return_closure_class RDFClosure.json_ld_available RDFClosure-module.html#json_ld_available RDFClosure.__author__ RDFClosure-module.html#__author__ RDFClosure.RDFXML RDFClosure-module.html#RDFXML RDFClosure.__parse_input RDFClosure-module.html#__parse_input RDFClosure.OWL RDFClosure-module.html#OWL RDFClosure.NONE RDFClosure-module.html#NONE RDFClosure.RDFS RDFClosure-module.html#RDFS RDFClosure.__package__ RDFClosure-module.html#__package__ RDFClosure.convert_graph RDFClosure-module.html#convert_graph RDFClosure.JSON RDFClosure-module.html#JSON RDFClosure.FULL RDFClosure-module.html#FULL RDFClosure.__license__ RDFClosure-module.html#__license__ RDFClosure.AUTO RDFClosure-module.html#AUTO RDFClosure.RDFA RDFClosure-module.html#RDFA RDFClosure.RDF RDFClosure-module.html#RDF RDFClosure.AxiomaticTriples RDFClosure.AxiomaticTriples-module.html RDFClosure.AxiomaticTriples.DatatypeProperty RDFClosure.AxiomaticTriples-module.html#DatatypeProperty RDFClosure.AxiomaticTriples._OWL_axiomatic_triples_Facets RDFClosure.AxiomaticTriples-module.html#_OWL_axiomatic_triples_Facets RDFClosure.AxiomaticTriples.OntologyProperty RDFClosure.AxiomaticTriples-module.html#OntologyProperty RDFClosure.AxiomaticTriples.Axiom RDFClosure.AxiomaticTriples-module.html#Axiom RDFClosure.AxiomaticTriples.OWL_D_Axiomatic_Triples_subclasses RDFClosure.AxiomaticTriples-module.html#OWL_D_Axiomatic_Triples_subclasses RDFClosure.AxiomaticTriples.sourceIndividual RDFClosure.AxiomaticTriples-module.html#sourceIndividual RDFClosure.AxiomaticTriples.hasKey RDFClosure.AxiomaticTriples-module.html#hasKey RDFClosure.AxiomaticTriples.annotatedSource RDFClosure.AxiomaticTriples-module.html#annotatedSource RDFClosure.AxiomaticTriples.onProperties RDFClosure.AxiomaticTriples-module.html#onProperties RDFClosure.AxiomaticTriples._OWL_D_Axiomatic_Triples_types RDFClosure.AxiomaticTriples-module.html#_OWL_D_Axiomatic_Triples_types RDFClosure.AxiomaticTriples.RDFS_D_Axiomatic_Triples_subclasses RDFClosure.AxiomaticTriples-module.html#RDFS_D_Axiomatic_Triples_subclasses RDFClosure.AxiomaticTriples.Annotation RDFClosure.AxiomaticTriples-module.html#Annotation RDFClosure.AxiomaticTriples.__license__ RDFClosure.AxiomaticTriples-module.html#__license__ RDFClosure.AxiomaticTriples.RDFS_Axiomatic_Triples RDFClosure.AxiomaticTriples-module.html#RDFS_Axiomatic_Triples RDFClosure.AxiomaticTriples._RDFS_axiomatic_triples RDFClosure.AxiomaticTriples-module.html#_RDFS_axiomatic_triples RDFClosure.AxiomaticTriples.OWLRL_Datatypes_Disjointness RDFClosure.AxiomaticTriples-module.html#OWLRL_Datatypes_Disjointness RDFClosure.AxiomaticTriples.backwardCompatibleWith RDFClosure.AxiomaticTriples-module.html#backwardCompatibleWith RDFClosure.AxiomaticTriples.OWLRL_D_Axiomatic_Triples RDFClosure.AxiomaticTriples-module.html#OWLRL_D_Axiomatic_Triples RDFClosure.AxiomaticTriples.RDFS_D_Axiomatic_Triples_types RDFClosure.AxiomaticTriples-module.html#RDFS_D_Axiomatic_Triples_types RDFClosure.AxiomaticTriples.oneOf RDFClosure.AxiomaticTriples-module.html#oneOf RDFClosure.AxiomaticTriples.DataRange RDFClosure.AxiomaticTriples-module.html#DataRange RDFClosure.AxiomaticTriples.ReflexiveProperty RDFClosure.AxiomaticTriples-module.html#ReflexiveProperty RDFClosure.AxiomaticTriples.disjointClasses RDFClosure.AxiomaticTriples-module.html#disjointClasses RDFClosure.AxiomaticTriples.AsymmetricProperty RDFClosure.AxiomaticTriples-module.html#AsymmetricProperty RDFClosure.AxiomaticTriples.intersectionOf RDFClosure.AxiomaticTriples-module.html#intersectionOf RDFClosure.AxiomaticTriples.DeprecatedClass RDFClosure.AxiomaticTriples-module.html#DeprecatedClass RDFClosure.AxiomaticTriples.versionIRI RDFClosure.AxiomaticTriples-module.html#versionIRI RDFClosure.AxiomaticTriples.assertionProperty RDFClosure.AxiomaticTriples-module.html#assertionProperty RDFClosure.AxiomaticTriples.datatypeComplementOf RDFClosure.AxiomaticTriples-module.html#datatypeComplementOf RDFClosure.AxiomaticTriples.AllDisjointClasses RDFClosure.AxiomaticTriples-module.html#AllDisjointClasses RDFClosure.AxiomaticTriples.annotatedProperty RDFClosure.AxiomaticTriples-module.html#annotatedProperty RDFClosure.AxiomaticTriples.IrreflexiveProperty RDFClosure.AxiomaticTriples-module.html#IrreflexiveProperty RDFClosure.AxiomaticTriples.NegativePropertyAssertion RDFClosure.AxiomaticTriples-module.html#NegativePropertyAssertion RDFClosure.AxiomaticTriples.Nothing RDFClosure.AxiomaticTriples-module.html#Nothing RDFClosure.AxiomaticTriples.SelfRestriction RDFClosure.AxiomaticTriples-module.html#SelfRestriction RDFClosure.AxiomaticTriples.versionInfo RDFClosure.AxiomaticTriples-module.html#versionInfo RDFClosure.AxiomaticTriples.InverseFunctionalProperty RDFClosure.AxiomaticTriples-module.html#InverseFunctionalProperty RDFClosure.AxiomaticTriples.priorVersion RDFClosure.AxiomaticTriples-module.html#priorVersion RDFClosure.AxiomaticTriples.propertyDisjointWith RDFClosure.AxiomaticTriples-module.html#propertyDisjointWith RDFClosure.AxiomaticTriples.Thing RDFClosure.AxiomaticTriples-module.html#Thing RDFClosure.AxiomaticTriples.maxQualifiedCardinality RDFClosure.AxiomaticTriples-module.html#maxQualifiedCardinality RDFClosure.AxiomaticTriples.members RDFClosure.AxiomaticTriples-module.html#members RDFClosure.AxiomaticTriples.RDFS_D_Axiomatic_Triples RDFClosure.AxiomaticTriples-module.html#RDFS_D_Axiomatic_Triples RDFClosure.AxiomaticTriples.qualifiedCardinality RDFClosure.AxiomaticTriples-module.html#qualifiedCardinality RDFClosure.AxiomaticTriples.Restriction RDFClosure.AxiomaticTriples-module.html#Restriction RDFClosure.AxiomaticTriples._Simple_RDF_axiomatic_triples RDFClosure.AxiomaticTriples-module.html#_Simple_RDF_axiomatic_triples RDFClosure.AxiomaticTriples.FunctionalProperty RDFClosure.AxiomaticTriples-module.html#FunctionalProperty RDFClosure.AxiomaticTriples._OWL_axiomatic_triples_Classes RDFClosure.AxiomaticTriples-module.html#_OWL_axiomatic_triples_Classes RDFClosure.AxiomaticTriples.withRestrictions RDFClosure.AxiomaticTriples-module.html#withRestrictions RDFClosure.AxiomaticTriples.disjointWith RDFClosure.AxiomaticTriples-module.html#disjointWith RDFClosure.AxiomaticTriples.onClass RDFClosure.AxiomaticTriples-module.html#onClass RDFClosure.AxiomaticTriples.sameAs RDFClosure.AxiomaticTriples-module.html#sameAs RDFClosure.AxiomaticTriples.DeprecatedProperty RDFClosure.AxiomaticTriples-module.html#DeprecatedProperty RDFClosure.AxiomaticTriples.OWLpredicate RDFClosure.AxiomaticTriples-module.html#OWLpredicate RDFClosure.AxiomaticTriples.AnnotationProperty RDFClosure.AxiomaticTriples-module.html#AnnotationProperty RDFClosure.AxiomaticTriples.distinctMembers RDFClosure.AxiomaticTriples-module.html#distinctMembers RDFClosure.AxiomaticTriples.annotatedTarget RDFClosure.AxiomaticTriples-module.html#annotatedTarget RDFClosure.AxiomaticTriples.OWLNS RDFClosure.AxiomaticTriples-module.html#OWLNS RDFClosure.AxiomaticTriples.propertyChainAxiom RDFClosure.AxiomaticTriples-module.html#propertyChainAxiom RDFClosure.AxiomaticTriples.targetValue RDFClosure.AxiomaticTriples-module.html#targetValue RDFClosure.AxiomaticTriples.Ontology RDFClosure.AxiomaticTriples-module.html#Ontology RDFClosure.AxiomaticTriples.OWLRL_Axiomatic_Triples RDFClosure.AxiomaticTriples-module.html#OWLRL_Axiomatic_Triples RDFClosure.AxiomaticTriples.__author__ RDFClosure.AxiomaticTriples-module.html#__author__ RDFClosure.AxiomaticTriples.cardinality RDFClosure.AxiomaticTriples-module.html#cardinality RDFClosure.AxiomaticTriples.AllDisjointProperties RDFClosure.AxiomaticTriples-module.html#AllDisjointProperties RDFClosure.AxiomaticTriples.someValuesFrom RDFClosure.AxiomaticTriples-module.html#someValuesFrom RDFClosure.AxiomaticTriples.BottomDataProperty RDFClosure.AxiomaticTriples-module.html#BottomDataProperty RDFClosure.AxiomaticTriples.onDataRange RDFClosure.AxiomaticTriples-module.html#onDataRange RDFClosure.AxiomaticTriples.onDatatype RDFClosure.AxiomaticTriples-module.html#onDatatype RDFClosure.AxiomaticTriples.minCardinality RDFClosure.AxiomaticTriples-module.html#minCardinality RDFClosure.AxiomaticTriples.deprecated RDFClosure.AxiomaticTriples-module.html#deprecated RDFClosure.AxiomaticTriples.equivalentProperty RDFClosure.AxiomaticTriples-module.html#equivalentProperty RDFClosure.AxiomaticTriples.TopObjectProperty RDFClosure.AxiomaticTriples-module.html#TopObjectProperty RDFClosure.AxiomaticTriples.complementOf RDFClosure.AxiomaticTriples-module.html#complementOf RDFClosure.AxiomaticTriples.imports RDFClosure.AxiomaticTriples-module.html#imports RDFClosure.AxiomaticTriples.TopDataProperty RDFClosure.AxiomaticTriples-module.html#TopDataProperty RDFClosure.AxiomaticTriples.AllDifferent RDFClosure.AxiomaticTriples-module.html#AllDifferent RDFClosure.AxiomaticTriples.OWLsubject RDFClosure.AxiomaticTriples-module.html#OWLsubject RDFClosure.AxiomaticTriples.inverseOf RDFClosure.AxiomaticTriples-module.html#inverseOf RDFClosure.AxiomaticTriples.incompatibleWith RDFClosure.AxiomaticTriples-module.html#incompatibleWith RDFClosure.AxiomaticTriples.hasValue RDFClosure.AxiomaticTriples-module.html#hasValue RDFClosure.AxiomaticTriples._OWL_axiomatic_triples_Properties RDFClosure.AxiomaticTriples-module.html#_OWL_axiomatic_triples_Properties RDFClosure.AxiomaticTriples.__package__ RDFClosure.AxiomaticTriples-module.html#__package__ RDFClosure.AxiomaticTriples.maxCardinality RDFClosure.AxiomaticTriples-module.html#maxCardinality RDFClosure.AxiomaticTriples.BottomObjectProperty RDFClosure.AxiomaticTriples-module.html#BottomObjectProperty RDFClosure.AxiomaticTriples.OWLClass RDFClosure.AxiomaticTriples-module.html#OWLClass RDFClosure.AxiomaticTriples.TransitiveProperty RDFClosure.AxiomaticTriples-module.html#TransitiveProperty RDFClosure.AxiomaticTriples.disjointUnionOf RDFClosure.AxiomaticTriples-module.html#disjointUnionOf RDFClosure.AxiomaticTriples.allValuesFrom RDFClosure.AxiomaticTriples-module.html#allValuesFrom RDFClosure.AxiomaticTriples.hasSelf RDFClosure.AxiomaticTriples-module.html#hasSelf RDFClosure.AxiomaticTriples.SymmetricProperty RDFClosure.AxiomaticTriples-module.html#SymmetricProperty RDFClosure.AxiomaticTriples.ObjectProperty RDFClosure.AxiomaticTriples-module.html#ObjectProperty RDFClosure.AxiomaticTriples.NamedIndividual RDFClosure.AxiomaticTriples-module.html#NamedIndividual RDFClosure.AxiomaticTriples.differentFrom RDFClosure.AxiomaticTriples-module.html#differentFrom RDFClosure.AxiomaticTriples.minQualifiedCardinality RDFClosure.AxiomaticTriples-module.html#minQualifiedCardinality RDFClosure.AxiomaticTriples.onProperty RDFClosure.AxiomaticTriples-module.html#onProperty RDFClosure.AxiomaticTriples.equivalentClass RDFClosure.AxiomaticTriples-module.html#equivalentClass RDFClosure.AxiomaticTriples.unionOf RDFClosure.AxiomaticTriples-module.html#unionOf RDFClosure.AxiomaticTriples.targetIndividual RDFClosure.AxiomaticTriples-module.html#targetIndividual RDFClosure.Closure RDFClosure.Closure-module.html RDFClosure.Closure.__license__ RDFClosure.Closure-module.html#__license__ RDFClosure.Closure.offlineGeneration RDFClosure.Closure-module.html#offlineGeneration RDFClosure.Closure.__author__ RDFClosure.Closure-module.html#__author__ RDFClosure.Closure.debugGlobal RDFClosure.Closure-module.html#debugGlobal RDFClosure.Closure.__package__ RDFClosure.Closure-module.html#__package__ RDFClosure.CombinedClosure RDFClosure.CombinedClosure-module.html RDFClosure.CombinedClosure.__license__ RDFClosure.CombinedClosure-module.html#__license__ RDFClosure.CombinedClosure.__package__ RDFClosure.CombinedClosure-module.html#__package__ RDFClosure.CombinedClosure.__author__ RDFClosure.CombinedClosure-module.html#__author__ RDFClosure.DatatypeHandling RDFClosure.DatatypeHandling-module.html RDFClosure.DatatypeHandling._re_NMTOKEN RDFClosure.DatatypeHandling-module.html#_re_NMTOKEN RDFClosure.DatatypeHandling._strToDateTimeAndStamp RDFClosure.DatatypeHandling-module.html#_strToDateTimeAndStamp RDFClosure.DatatypeHandling._strToAnyURI RDFClosure.DatatypeHandling-module.html#_strToAnyURI RDFClosure.DatatypeHandling._re_NCName RDFClosure.DatatypeHandling-module.html#_re_NCName RDFClosure.DatatypeHandling._strToVal_Regexp RDFClosure.DatatypeHandling-module.html#_strToVal_Regexp RDFClosure.DatatypeHandling._limits_unsignedByte RDFClosure.DatatypeHandling-module.html#_limits_unsignedByte RDFClosure.DatatypeHandling._strToBoundNumeral RDFClosure.DatatypeHandling-module.html#_strToBoundNumeral RDFClosure.DatatypeHandling._strToFloat RDFClosure.DatatypeHandling-module.html#_strToFloat RDFClosure.DatatypeHandling._strToToken RDFClosure.DatatypeHandling-module.html#_strToToken RDFClosure.DatatypeHandling._limits_nonPositiveInteger RDFClosure.DatatypeHandling-module.html#_limits_nonPositiveInteger RDFClosure.DatatypeHandling._numb RDFClosure.DatatypeHandling-module.html#_numb RDFClosure.DatatypeHandling._strTogDay RDFClosure.DatatypeHandling-module.html#_strTogDay RDFClosure.DatatypeHandling._re_token RDFClosure.DatatypeHandling-module.html#_re_token RDFClosure.DatatypeHandling.__license__ RDFClosure.DatatypeHandling-module.html#__license__ RDFClosure.DatatypeHandling.use_Alt_lexical_conversions RDFClosure.DatatypeHandling-module.html#use_Alt_lexical_conversions RDFClosure.DatatypeHandling._strToPlainLiteral RDFClosure.DatatypeHandling-module.html#_strToPlainLiteral RDFClosure.DatatypeHandling._strToHexBinary RDFClosure.DatatypeHandling-module.html#_strToHexBinary RDFClosure.DatatypeHandling._limits_long RDFClosure.DatatypeHandling-module.html#_limits_long RDFClosure.DatatypeHandling.__package__ RDFClosure.DatatypeHandling-module.html#__package__ RDFClosure.DatatypeHandling._strTogMonth RDFClosure.DatatypeHandling-module.html#_strTogMonth RDFClosure.DatatypeHandling._limits_negativeInteger RDFClosure.DatatypeHandling-module.html#_limits_negativeInteger RDFClosure.DatatypeHandling._re_language RDFClosure.DatatypeHandling-module.html#_re_language RDFClosure.DatatypeHandling._strToDecimal RDFClosure.DatatypeHandling-module.html#_strToDecimal RDFClosure.DatatypeHandling._limits_byte RDFClosure.DatatypeHandling-module.html#_limits_byte RDFClosure.DatatypeHandling.AltXSDToPYTHON RDFClosure.DatatypeHandling-module.html#AltXSDToPYTHON RDFClosure.DatatypeHandling._strToBase64Binary RDFClosure.DatatypeHandling-module.html#_strToBase64Binary RDFClosure.DatatypeHandling._strTogYear RDFClosure.DatatypeHandling-module.html#_strTogYear RDFClosure.DatatypeHandling._strToDate RDFClosure.DatatypeHandling-module.html#_strToDate RDFClosure.DatatypeHandling.use_RDFLib_lexical_conversions RDFClosure.DatatypeHandling-module.html#use_RDFLib_lexical_conversions RDFClosure.DatatypeHandling._strToTime RDFClosure.DatatypeHandling-module.html#_strToTime RDFClosure.DatatypeHandling._strToXMLLiteral RDFClosure.DatatypeHandling-module.html#_strToXMLLiteral RDFClosure.DatatypeHandling._limits_int RDFClosure.DatatypeHandling-module.html#_limits_int RDFClosure.DatatypeHandling._returnTimeZone RDFClosure.DatatypeHandling-module.html#_returnTimeZone RDFClosure.DatatypeHandling._limits_positiveInteger RDFClosure.DatatypeHandling-module.html#_limits_positiveInteger RDFClosure.DatatypeHandling._re_Name_ex RDFClosure.DatatypeHandling-module.html#_re_Name_ex RDFClosure.DatatypeHandling.__author__ RDFClosure.DatatypeHandling-module.html#__author__ RDFClosure.DatatypeHandling._limits_unsignedShort RDFClosure.DatatypeHandling-module.html#_limits_unsignedShort RDFClosure.DatatypeHandling._limits_unsignedLong RDFClosure.DatatypeHandling-module.html#_limits_unsignedLong RDFClosure.DatatypeHandling._re_NCName_ex RDFClosure.DatatypeHandling-module.html#_re_NCName_ex RDFClosure.DatatypeHandling._limits_nonNegativeInteger RDFClosure.DatatypeHandling-module.html#_limits_nonNegativeInteger RDFClosure.DatatypeHandling._hexc RDFClosure.DatatypeHandling-module.html#_hexc RDFClosure.DatatypeHandling._strToBool RDFClosure.DatatypeHandling-module.html#_strToBool RDFClosure.DatatypeHandling._limits_unsignedInt RDFClosure.DatatypeHandling-module.html#_limits_unsignedInt RDFClosure.DatatypeHandling._limits_short RDFClosure.DatatypeHandling-module.html#_limits_short RDFClosure.DatatypeHandling._strTogYearMonth RDFClosure.DatatypeHandling-module.html#_strTogYearMonth RDFClosure.DatatypeHandling._strToDouble RDFClosure.DatatypeHandling-module.html#_strToDouble RDFClosure.DatatypeHandling._strTogMonthDay RDFClosure.DatatypeHandling-module.html#_strTogMonthDay RDFClosure.Literals RDFClosure.Literals-module.html RDFClosure.Literals.__license__ RDFClosure.Literals-module.html#__license__ RDFClosure.Literals.__author__ RDFClosure.Literals-module.html#__author__ RDFClosure.Literals.__package__ RDFClosure.Literals-module.html#__package__ RDFClosure.OWL' RDFClosure.OWL%27-module.html RDFClosure.OWL'.equivalentProperty RDFClosure.OWL%27-module.html#equivalentProperty RDFClosure.OWL'.TopObjectProperty RDFClosure.OWL%27-module.html#TopObjectProperty RDFClosure.OWL'.DatatypeProperty RDFClosure.OWL%27-module.html#DatatypeProperty RDFClosure.OWL'.disjointWith RDFClosure.OWL%27-module.html#disjointWith RDFClosure.OWL'.onClass RDFClosure.OWL%27-module.html#onClass RDFClosure.OWL'.complementOf RDFClosure.OWL%27-module.html#complementOf RDFClosure.OWL'.AnnotationProperty RDFClosure.OWL%27-module.html#AnnotationProperty RDFClosure.OWL'.imports RDFClosure.OWL%27-module.html#imports RDFClosure.OWL'.DeprecatedProperty RDFClosure.OWL%27-module.html#DeprecatedProperty RDFClosure.OWL'.TopDataProperty RDFClosure.OWL%27-module.html#TopDataProperty RDFClosure.OWL'.OWLpredicate RDFClosure.OWL%27-module.html#OWLpredicate RDFClosure.OWL'.unionOf RDFClosure.OWL%27-module.html#unionOf RDFClosure.OWL'.__package__ RDFClosure.OWL%27-module.html#__package__ RDFClosure.OWL'.OntologyProperty RDFClosure.OWL%27-module.html#OntologyProperty RDFClosure.OWL'.Axiom RDFClosure.OWL%27-module.html#Axiom RDFClosure.OWL'.assertionProperty RDFClosure.OWL%27-module.html#assertionProperty RDFClosure.OWL'.datatypeComplementOf RDFClosure.OWL%27-module.html#datatypeComplementOf RDFClosure.OWL'.AllDifferent RDFClosure.OWL%27-module.html#AllDifferent RDFClosure.OWL'.hasKey RDFClosure.OWL%27-module.html#hasKey RDFClosure.OWL'.cardinality RDFClosure.OWL%27-module.html#cardinality RDFClosure.OWL'.OWLsubject RDFClosure.OWL%27-module.html#OWLsubject RDFClosure.OWL'.AllDisjointClasses RDFClosure.OWL%27-module.html#AllDisjointClasses RDFClosure.OWL'.annotatedProperty RDFClosure.OWL%27-module.html#annotatedProperty RDFClosure.OWL'.IrreflexiveProperty RDFClosure.OWL%27-module.html#IrreflexiveProperty RDFClosure.OWL'.allValuesFrom RDFClosure.OWL%27-module.html#allValuesFrom RDFClosure.OWL'.hasValue RDFClosure.OWL%27-module.html#hasValue RDFClosure.OWL'.OWLNS RDFClosure.OWL%27-module.html#OWLNS RDFClosure.OWL'.NegativePropertyAssertion RDFClosure.OWL%27-module.html#NegativePropertyAssertion RDFClosure.OWL'.onProperties RDFClosure.OWL%27-module.html#onProperties RDFClosure.OWL'.sameAs RDFClosure.OWL%27-module.html#sameAs RDFClosure.OWL'.disjointClasses RDFClosure.OWL%27-module.html#disjointClasses RDFClosure.OWL'.maxCardinality RDFClosure.OWL%27-module.html#maxCardinality RDFClosure.OWL'.distinctMembers RDFClosure.OWL%27-module.html#distinctMembers RDFClosure.OWL'.Nothing RDFClosure.OWL%27-module.html#Nothing RDFClosure.OWL'.propertyChainAxiom RDFClosure.OWL%27-module.html#propertyChainAxiom RDFClosure.OWL'.Ontology RDFClosure.OWL%27-module.html#Ontology RDFClosure.OWL'.Annotation RDFClosure.OWL%27-module.html#Annotation RDFClosure.OWL'.BottomObjectProperty RDFClosure.OWL%27-module.html#BottomObjectProperty RDFClosure.OWL'.annotatedTarget RDFClosure.OWL%27-module.html#annotatedTarget RDFClosure.OWL'.versionInfo RDFClosure.OWL%27-module.html#versionInfo RDFClosure.OWL'.versionIRI RDFClosure.OWL%27-module.html#versionIRI RDFClosure.OWL'.InverseFunctionalProperty RDFClosure.OWL%27-module.html#InverseFunctionalProperty RDFClosure.OWL'.inverseOf RDFClosure.OWL%27-module.html#inverseOf RDFClosure.OWL'.disjointUnionOf RDFClosure.OWL%27-module.html#disjointUnionOf RDFClosure.OWL'.priorVersion RDFClosure.OWL%27-module.html#priorVersion RDFClosure.OWL'.onDataRange RDFClosure.OWL%27-module.html#onDataRange RDFClosure.OWL'.propertyDisjointWith RDFClosure.OWL%27-module.html#propertyDisjointWith RDFClosure.OWL'.Thing RDFClosure.OWL%27-module.html#Thing RDFClosure.OWL'.maxQualifiedCardinality RDFClosure.OWL%27-module.html#maxQualifiedCardinality RDFClosure.OWL'.members RDFClosure.OWL%27-module.html#members RDFClosure.OWL'.targetValue RDFClosure.OWL%27-module.html#targetValue RDFClosure.OWL'.onDatatype RDFClosure.OWL%27-module.html#onDatatype RDFClosure.OWL'.annotatedSource RDFClosure.OWL%27-module.html#annotatedSource RDFClosure.OWL'.OWLClass RDFClosure.OWL%27-module.html#OWLClass RDFClosure.OWL'.backwardCompatibleWith RDFClosure.OWL%27-module.html#backwardCompatibleWith RDFClosure.OWL'.TransitiveProperty RDFClosure.OWL%27-module.html#TransitiveProperty RDFClosure.OWL'.qualifiedCardinality RDFClosure.OWL%27-module.html#qualifiedCardinality RDFClosure.OWL'.AllDisjointProperties RDFClosure.OWL%27-module.html#AllDisjointProperties RDFClosure.OWL'.someValuesFrom RDFClosure.OWL%27-module.html#someValuesFrom RDFClosure.OWL'.Restriction RDFClosure.OWL%27-module.html#Restriction RDFClosure.OWL'.oneOf RDFClosure.OWL%27-module.html#oneOf RDFClosure.OWL'.SelfRestriction RDFClosure.OWL%27-module.html#SelfRestriction RDFClosure.OWL'.BottomDataProperty RDFClosure.OWL%27-module.html#BottomDataProperty RDFClosure.OWL'.ReflexiveProperty RDFClosure.OWL%27-module.html#ReflexiveProperty RDFClosure.OWL'.DataRange RDFClosure.OWL%27-module.html#DataRange RDFClosure.OWL'.hasSelf RDFClosure.OWL%27-module.html#hasSelf RDFClosure.OWL'.deprecated RDFClosure.OWL%27-module.html#deprecated RDFClosure.OWL'.FunctionalProperty RDFClosure.OWL%27-module.html#FunctionalProperty RDFClosure.OWL'.SymmetricProperty RDFClosure.OWL%27-module.html#SymmetricProperty RDFClosure.OWL'.ObjectProperty RDFClosure.OWL%27-module.html#ObjectProperty RDFClosure.OWL'.NamedIndividual RDFClosure.OWL%27-module.html#NamedIndividual RDFClosure.OWL'.differentFrom RDFClosure.OWL%27-module.html#differentFrom RDFClosure.OWL'.minQualifiedCardinality RDFClosure.OWL%27-module.html#minQualifiedCardinality RDFClosure.OWL'.minCardinality RDFClosure.OWL%27-module.html#minCardinality RDFClosure.OWL'.AsymmetricProperty RDFClosure.OWL%27-module.html#AsymmetricProperty RDFClosure.OWL'.onProperty RDFClosure.OWL%27-module.html#onProperty RDFClosure.OWL'.incompatibleWith RDFClosure.OWL%27-module.html#incompatibleWith RDFClosure.OWL'.intersectionOf RDFClosure.OWL%27-module.html#intersectionOf RDFClosure.OWL'.equivalentClass RDFClosure.OWL%27-module.html#equivalentClass RDFClosure.OWL'.targetIndividual RDFClosure.OWL%27-module.html#targetIndividual RDFClosure.OWL'.sourceIndividual RDFClosure.OWL%27-module.html#sourceIndividual RDFClosure.OWL'.withRestrictions RDFClosure.OWL%27-module.html#withRestrictions RDFClosure.OWL'.DeprecatedClass RDFClosure.OWL%27-module.html#DeprecatedClass RDFClosure.OWLRL RDFClosure.OWLRL-module.html RDFClosure.OWLRL.DatatypeProperty RDFClosure.OWLRL-module.html#DatatypeProperty RDFClosure.OWLRL.NegativePropertyAssertion RDFClosure.OWLRL-module.html#NegativePropertyAssertion RDFClosure.OWLRL.OntologyProperty RDFClosure.OWLRL-module.html#OntologyProperty RDFClosure.OWLRL.Axiom RDFClosure.OWLRL-module.html#Axiom RDFClosure.OWLRL.sourceIndividual RDFClosure.OWLRL-module.html#sourceIndividual RDFClosure.OWLRL.backwardCompatibleWith RDFClosure.OWLRL-module.html#backwardCompatibleWith RDFClosure.OWLRL.annotatedSource RDFClosure.OWLRL-module.html#annotatedSource RDFClosure.OWLRL.onProperties RDFClosure.OWLRL-module.html#onProperties RDFClosure.OWLRL.Annotation RDFClosure.OWLRL-module.html#Annotation RDFClosure.OWLRL.inverseOf RDFClosure.OWLRL-module.html#inverseOf RDFClosure.OWLRL.hasSelf RDFClosure.OWLRL-module.html#hasSelf RDFClosure.OWLRL.hasKey RDFClosure.OWLRL-module.html#hasKey RDFClosure.OWLRL.oneOf RDFClosure.OWLRL-module.html#oneOf RDFClosure.OWLRL.ReflexiveProperty RDFClosure.OWLRL-module.html#ReflexiveProperty RDFClosure.OWLRL.disjointClasses RDFClosure.OWLRL-module.html#disjointClasses RDFClosure.OWLRL.AsymmetricProperty RDFClosure.OWLRL-module.html#AsymmetricProperty RDFClosure.OWLRL.intersectionOf RDFClosure.OWLRL-module.html#intersectionOf RDFClosure.OWLRL.DeprecatedClass RDFClosure.OWLRL-module.html#DeprecatedClass RDFClosure.OWLRL.assertionProperty RDFClosure.OWLRL-module.html#assertionProperty RDFClosure.OWLRL.datatypeComplementOf RDFClosure.OWLRL-module.html#datatypeComplementOf RDFClosure.OWLRL.AllDisjointClasses RDFClosure.OWLRL-module.html#AllDisjointClasses RDFClosure.OWLRL.annotatedProperty RDFClosure.OWLRL-module.html#annotatedProperty RDFClosure.OWLRL.IrreflexiveProperty RDFClosure.OWLRL-module.html#IrreflexiveProperty RDFClosure.OWLRL.Nothing RDFClosure.OWLRL-module.html#Nothing RDFClosure.OWLRL.SelfRestriction RDFClosure.OWLRL-module.html#SelfRestriction RDFClosure.OWLRL.versionInfo RDFClosure.OWLRL-module.html#versionInfo RDFClosure.OWLRL.InverseFunctionalProperty RDFClosure.OWLRL-module.html#InverseFunctionalProperty RDFClosure.OWLRL.priorVersion RDFClosure.OWLRL-module.html#priorVersion RDFClosure.OWLRL.propertyDisjointWith RDFClosure.OWLRL-module.html#propertyDisjointWith RDFClosure.OWLRL.Thing RDFClosure.OWLRL-module.html#Thing RDFClosure.OWLRL.maxQualifiedCardinality RDFClosure.OWLRL-module.html#maxQualifiedCardinality RDFClosure.OWLRL.onClass RDFClosure.OWLRL-module.html#onClass RDFClosure.OWLRL.AnnotationProperty RDFClosure.OWLRL-module.html#AnnotationProperty RDFClosure.OWLRL.qualifiedCardinality RDFClosure.OWLRL-module.html#qualifiedCardinality RDFClosure.OWLRL.Restriction RDFClosure.OWLRL-module.html#Restriction RDFClosure.OWLRL.deprecated RDFClosure.OWLRL-module.html#deprecated RDFClosure.OWLRL.FunctionalProperty RDFClosure.OWLRL-module.html#FunctionalProperty RDFClosure.OWLRL.withRestrictions RDFClosure.OWLRL-module.html#withRestrictions RDFClosure.OWLRL.disjointWith RDFClosure.OWLRL-module.html#disjointWith RDFClosure.OWLRL.members RDFClosure.OWLRL-module.html#members RDFClosure.OWLRL.sameAs RDFClosure.OWLRL-module.html#sameAs RDFClosure.OWLRL.DeprecatedProperty RDFClosure.OWLRL-module.html#DeprecatedProperty RDFClosure.OWLRL.OWLpredicate RDFClosure.OWLRL-module.html#OWLpredicate RDFClosure.OWLRL.distinctMembers RDFClosure.OWLRL-module.html#distinctMembers RDFClosure.OWLRL.annotatedTarget RDFClosure.OWLRL-module.html#annotatedTarget RDFClosure.OWLRL.complementOf RDFClosure.OWLRL-module.html#complementOf RDFClosure.OWLRL.OWLNS RDFClosure.OWLRL-module.html#OWLNS RDFClosure.OWLRL.propertyChainAxiom RDFClosure.OWLRL-module.html#propertyChainAxiom RDFClosure.OWLRL.targetValue RDFClosure.OWLRL-module.html#targetValue RDFClosure.OWLRL.Ontology RDFClosure.OWLRL-module.html#Ontology RDFClosure.OWLRL.__author__ RDFClosure.OWLRL-module.html#__author__ RDFClosure.OWLRL.cardinality RDFClosure.OWLRL-module.html#cardinality RDFClosure.OWLRL.AllDisjointProperties RDFClosure.OWLRL-module.html#AllDisjointProperties RDFClosure.OWLRL.someValuesFrom RDFClosure.OWLRL-module.html#someValuesFrom RDFClosure.OWLRL.BottomDataProperty RDFClosure.OWLRL-module.html#BottomDataProperty RDFClosure.OWLRL.DataRange RDFClosure.OWLRL-module.html#DataRange RDFClosure.OWLRL.onDataRange RDFClosure.OWLRL-module.html#onDataRange RDFClosure.OWLRL.onDatatype RDFClosure.OWLRL-module.html#onDatatype RDFClosure.OWLRL.minCardinality RDFClosure.OWLRL-module.html#minCardinality RDFClosure.OWLRL.equivalentProperty RDFClosure.OWLRL-module.html#equivalentProperty RDFClosure.OWLRL.TopObjectProperty RDFClosure.OWLRL-module.html#TopObjectProperty RDFClosure.OWLRL.OWLRL_Annotation_properties RDFClosure.OWLRL-module.html#OWLRL_Annotation_properties RDFClosure.OWLRL.imports RDFClosure.OWLRL-module.html#imports RDFClosure.OWLRL.TopDataProperty RDFClosure.OWLRL-module.html#TopDataProperty RDFClosure.OWLRL.AllDifferent RDFClosure.OWLRL-module.html#AllDifferent RDFClosure.OWLRL.OWLsubject RDFClosure.OWLRL-module.html#OWLsubject RDFClosure.OWLRL.__license__ RDFClosure.OWLRL-module.html#__license__ RDFClosure.OWLRL.incompatibleWith RDFClosure.OWLRL-module.html#incompatibleWith RDFClosure.OWLRL.hasValue RDFClosure.OWLRL-module.html#hasValue RDFClosure.OWLRL.__package__ RDFClosure.OWLRL-module.html#__package__ RDFClosure.OWLRL.maxCardinality RDFClosure.OWLRL-module.html#maxCardinality RDFClosure.OWLRL.BottomObjectProperty RDFClosure.OWLRL-module.html#BottomObjectProperty RDFClosure.OWLRL.versionIRI RDFClosure.OWLRL-module.html#versionIRI RDFClosure.OWLRL.OWLClass RDFClosure.OWLRL-module.html#OWLClass RDFClosure.OWLRL.TransitiveProperty RDFClosure.OWLRL-module.html#TransitiveProperty RDFClosure.OWLRL.disjointUnionOf RDFClosure.OWLRL-module.html#disjointUnionOf RDFClosure.OWLRL.allValuesFrom RDFClosure.OWLRL-module.html#allValuesFrom RDFClosure.OWLRL.SymmetricProperty RDFClosure.OWLRL-module.html#SymmetricProperty RDFClosure.OWLRL.ObjectProperty RDFClosure.OWLRL-module.html#ObjectProperty RDFClosure.OWLRL.NamedIndividual RDFClosure.OWLRL-module.html#NamedIndividual RDFClosure.OWLRL.differentFrom RDFClosure.OWLRL-module.html#differentFrom RDFClosure.OWLRL.minQualifiedCardinality RDFClosure.OWLRL-module.html#minQualifiedCardinality RDFClosure.OWLRL.onProperty RDFClosure.OWLRL-module.html#onProperty RDFClosure.OWLRL.equivalentClass RDFClosure.OWLRL-module.html#equivalentClass RDFClosure.OWLRL.unionOf RDFClosure.OWLRL-module.html#unionOf RDFClosure.OWLRL.targetIndividual RDFClosure.OWLRL-module.html#targetIndividual RDFClosure.OWLRLExtras RDFClosure.OWLRLExtras-module.html RDFClosure.OWLRLExtras.DatatypeProperty RDFClosure.OWLRLExtras-module.html#DatatypeProperty RDFClosure.OWLRLExtras.OntologyProperty RDFClosure.OWLRLExtras-module.html#OntologyProperty RDFClosure.OWLRLExtras.Axiom RDFClosure.OWLRLExtras-module.html#Axiom RDFClosure.OWLRLExtras.sourceIndividual RDFClosure.OWLRLExtras-module.html#sourceIndividual RDFClosure.OWLRLExtras.backwardCompatibleWith RDFClosure.OWLRLExtras-module.html#backwardCompatibleWith RDFClosure.OWLRLExtras.annotatedSource RDFClosure.OWLRLExtras-module.html#annotatedSource RDFClosure.OWLRLExtras.Annotation RDFClosure.OWLRLExtras-module.html#Annotation RDFClosure.OWLRLExtras.inverseOf RDFClosure.OWLRLExtras-module.html#inverseOf RDFClosure.OWLRLExtras.hasSelf RDFClosure.OWLRLExtras-module.html#hasSelf RDFClosure.OWLRLExtras.hasKey RDFClosure.OWLRLExtras-module.html#hasKey RDFClosure.OWLRLExtras.onProperties RDFClosure.OWLRLExtras-module.html#onProperties RDFClosure.OWLRLExtras.OWL_RL_Datatypes RDFClosure.OWLRLExtras-module.html#OWL_RL_Datatypes RDFClosure.OWLRLExtras.oneOf RDFClosure.OWLRLExtras-module.html#oneOf RDFClosure.OWLRLExtras.ReflexiveProperty RDFClosure.OWLRLExtras-module.html#ReflexiveProperty RDFClosure.OWLRLExtras.disjointClasses RDFClosure.OWLRLExtras-module.html#disjointClasses RDFClosure.OWLRLExtras.AsymmetricProperty RDFClosure.OWLRLExtras-module.html#AsymmetricProperty RDFClosure.OWLRLExtras.intersectionOf RDFClosure.OWLRLExtras-module.html#intersectionOf RDFClosure.OWLRLExtras.DeprecatedClass RDFClosure.OWLRLExtras-module.html#DeprecatedClass RDFClosure.OWLRLExtras.domain RDFClosure.OWLRLExtras-module.html#domain RDFClosure.OWLRLExtras.versionIRI RDFClosure.OWLRLExtras-module.html#versionIRI RDFClosure.OWLRLExtras.assertionProperty RDFClosure.OWLRLExtras-module.html#assertionProperty RDFClosure.OWLRLExtras.datatypeComplementOf RDFClosure.OWLRLExtras-module.html#datatypeComplementOf RDFClosure.OWLRLExtras.AllDisjointClasses RDFClosure.OWLRLExtras-module.html#AllDisjointClasses RDFClosure.OWLRLExtras.annotatedProperty RDFClosure.OWLRLExtras-module.html#annotatedProperty RDFClosure.OWLRLExtras.IrreflexiveProperty RDFClosure.OWLRLExtras-module.html#IrreflexiveProperty RDFClosure.OWLRLExtras.NegativePropertyAssertion RDFClosure.OWLRLExtras-module.html#NegativePropertyAssertion RDFClosure.OWLRLExtras.Nothing RDFClosure.OWLRLExtras-module.html#Nothing RDFClosure.OWLRLExtras.SelfRestriction RDFClosure.OWLRLExtras-module.html#SelfRestriction RDFClosure.OWLRLExtras.Class RDFClosure.OWLRLExtras-module.html#Class RDFClosure.OWLRLExtras.ns_owl RDFClosure.OWLRLExtras-module.html#ns_owl RDFClosure.OWLRLExtras.versionInfo RDFClosure.OWLRLExtras-module.html#versionInfo RDFClosure.OWLRLExtras.subPropertyOf RDFClosure.OWLRLExtras-module.html#subPropertyOf RDFClosure.OWLRLExtras.InverseFunctionalProperty RDFClosure.OWLRLExtras-module.html#InverseFunctionalProperty RDFClosure.OWLRLExtras.priorVersion RDFClosure.OWLRLExtras-module.html#priorVersion RDFClosure.OWLRLExtras.propertyDisjointWith RDFClosure.OWLRLExtras-module.html#propertyDisjointWith RDFClosure.OWLRLExtras.Thing RDFClosure.OWLRLExtras-module.html#Thing RDFClosure.OWLRLExtras.maxQualifiedCardinality RDFClosure.OWLRLExtras-module.html#maxQualifiedCardinality RDFClosure.OWLRLExtras.members RDFClosure.OWLRLExtras-module.html#members RDFClosure.OWLRLExtras.AnnotationProperty RDFClosure.OWLRLExtras-module.html#AnnotationProperty RDFClosure.OWLRLExtras.Property RDFClosure.OWLRLExtras-module.html#Property RDFClosure.OWLRLExtras.qualifiedCardinality RDFClosure.OWLRLExtras-module.html#qualifiedCardinality RDFClosure.OWLRLExtras.Restriction RDFClosure.OWLRLExtras-module.html#Restriction RDFClosure.OWLRLExtras.deprecated RDFClosure.OWLRLExtras-module.html#deprecated RDFClosure.OWLRLExtras.FunctionalProperty RDFClosure.OWLRLExtras-module.html#FunctionalProperty RDFClosure.OWLRLExtras.withRestrictions RDFClosure.OWLRLExtras-module.html#withRestrictions RDFClosure.OWLRLExtras.disjointWith RDFClosure.OWLRLExtras-module.html#disjointWith RDFClosure.OWLRLExtras.onClass RDFClosure.OWLRLExtras-module.html#onClass RDFClosure.OWLRLExtras.sameAs RDFClosure.OWLRLExtras-module.html#sameAs RDFClosure.OWLRLExtras.DeprecatedProperty RDFClosure.OWLRLExtras-module.html#DeprecatedProperty RDFClosure.OWLRLExtras.OWLpredicate RDFClosure.OWLRLExtras-module.html#OWLpredicate RDFClosure.OWLRLExtras.distinctMembers RDFClosure.OWLRLExtras-module.html#distinctMembers RDFClosure.OWLRLExtras.annotatedTarget RDFClosure.OWLRLExtras-module.html#annotatedTarget RDFClosure.OWLRLExtras.complementOf RDFClosure.OWLRLExtras-module.html#complementOf RDFClosure.OWLRLExtras.OWLNS RDFClosure.OWLRLExtras-module.html#OWLNS RDFClosure.OWLRLExtras.propertyChainAxiom RDFClosure.OWLRLExtras-module.html#propertyChainAxiom RDFClosure.OWLRLExtras.targetValue RDFClosure.OWLRLExtras-module.html#targetValue RDFClosure.OWLRLExtras.Ontology RDFClosure.OWLRLExtras-module.html#Ontology RDFClosure.OWLRLExtras.ns_xsd RDFClosure.OWLRLExtras-module.html#ns_xsd RDFClosure.OWLRLExtras.Datatype RDFClosure.OWLRLExtras-module.html#Datatype RDFClosure.OWLRLExtras.__author__ RDFClosure.OWLRLExtras-module.html#__author__ RDFClosure.OWLRLExtras.cardinality RDFClosure.OWLRLExtras-module.html#cardinality RDFClosure.OWLRLExtras.AllDisjointProperties RDFClosure.OWLRLExtras-module.html#AllDisjointProperties RDFClosure.OWLRLExtras.someValuesFrom RDFClosure.OWLRLExtras-module.html#someValuesFrom RDFClosure.OWLRLExtras.BottomDataProperty RDFClosure.OWLRLExtras-module.html#BottomDataProperty RDFClosure.OWLRLExtras.DataRange RDFClosure.OWLRLExtras-module.html#DataRange RDFClosure.OWLRLExtras.onDataRange RDFClosure.OWLRLExtras-module.html#onDataRange RDFClosure.OWLRLExtras.rdfType RDFClosure.OWLRLExtras-module.html#rdfType RDFClosure.OWLRLExtras.onDatatype RDFClosure.OWLRLExtras-module.html#onDatatype RDFClosure.OWLRLExtras.minCardinality RDFClosure.OWLRLExtras-module.html#minCardinality RDFClosure.OWLRLExtras.subClassOf RDFClosure.OWLRLExtras-module.html#subClassOf RDFClosure.OWLRLExtras.equivalentProperty RDFClosure.OWLRLExtras-module.html#equivalentProperty RDFClosure.OWLRLExtras.TopObjectProperty RDFClosure.OWLRLExtras-module.html#TopObjectProperty RDFClosure.OWLRLExtras.OWLRL_Annotation_properties RDFClosure.OWLRLExtras-module.html#OWLRL_Annotation_properties RDFClosure.OWLRLExtras.imports RDFClosure.OWLRLExtras-module.html#imports RDFClosure.OWLRLExtras.TopDataProperty RDFClosure.OWLRLExtras-module.html#TopDataProperty RDFClosure.OWLRLExtras.AllDifferent RDFClosure.OWLRLExtras-module.html#AllDifferent RDFClosure.OWLRLExtras.OWLsubject RDFClosure.OWLRLExtras-module.html#OWLsubject RDFClosure.OWLRLExtras.__license__ RDFClosure.OWLRLExtras-module.html#__license__ RDFClosure.OWLRLExtras.incompatibleWith RDFClosure.OWLRLExtras-module.html#incompatibleWith RDFClosure.OWLRLExtras.hasValue RDFClosure.OWLRLExtras-module.html#hasValue RDFClosure.OWLRLExtras.__package__ RDFClosure.OWLRLExtras-module.html#__package__ RDFClosure.OWLRLExtras.maxCardinality RDFClosure.OWLRLExtras-module.html#maxCardinality RDFClosure.OWLRLExtras.AltXSDToPYTHON RDFClosure.OWLRLExtras-module.html#AltXSDToPYTHON RDFClosure.OWLRLExtras.BottomObjectProperty RDFClosure.OWLRLExtras-module.html#BottomObjectProperty RDFClosure.OWLRLExtras.Resource RDFClosure.OWLRLExtras-module.html#Resource RDFClosure.OWLRLExtras.OWL_Datatype_Subsumptions RDFClosure.OWLRLExtras-module.html#OWL_Datatype_Subsumptions RDFClosure.OWLRLExtras.OWLClass RDFClosure.OWLRLExtras-module.html#OWLClass RDFClosure.OWLRLExtras._strToRational RDFClosure.OWLRLExtras-module.html#_strToRational RDFClosure.OWLRLExtras.TransitiveProperty RDFClosure.OWLRLExtras-module.html#TransitiveProperty RDFClosure.OWLRLExtras.disjointUnionOf RDFClosure.OWLRLExtras-module.html#disjointUnionOf RDFClosure.OWLRLExtras.allValuesFrom RDFClosure.OWLRLExtras-module.html#allValuesFrom RDFClosure.OWLRLExtras.SymmetricProperty RDFClosure.OWLRLExtras-module.html#SymmetricProperty RDFClosure.OWLRLExtras.ObjectProperty RDFClosure.OWLRLExtras-module.html#ObjectProperty RDFClosure.OWLRLExtras.NamedIndividual RDFClosure.OWLRLExtras-module.html#NamedIndividual RDFClosure.OWLRLExtras.differentFrom RDFClosure.OWLRLExtras-module.html#differentFrom RDFClosure.OWLRLExtras.minQualifiedCardinality RDFClosure.OWLRLExtras-module.html#minQualifiedCardinality RDFClosure.OWLRLExtras.onProperty RDFClosure.OWLRLExtras-module.html#onProperty RDFClosure.OWLRLExtras.equivalentClass RDFClosure.OWLRLExtras-module.html#equivalentClass RDFClosure.OWLRLExtras.unionOf RDFClosure.OWLRLExtras-module.html#unionOf RDFClosure.OWLRLExtras.targetIndividual RDFClosure.OWLRLExtras-module.html#targetIndividual RDFClosure.RDFS' RDFClosure.RDFS%27-module.html RDFClosure.RDFS'.comment RDFClosure.RDFS%27-module.html#comment RDFClosure.RDFS'.domain RDFClosure.RDFS%27-module.html#domain RDFClosure.RDFS'.Container RDFClosure.RDFS%27-module.html#Container RDFClosure.RDFS'.LangString RDFClosure.RDFS%27-module.html#LangString RDFClosure.RDFS'.rest RDFClosure.RDFS%27-module.html#rest RDFClosure.RDFS'.Literal RDFClosure.RDFS%27-module.html#Literal RDFClosure.RDFS'.Statement RDFClosure.RDFS%27-module.html#Statement RDFClosure.RDFS'.isDefinedBy RDFClosure.RDFS%27-module.html#isDefinedBy RDFClosure.RDFS'.label RDFClosure.RDFS%27-module.html#label RDFClosure.RDFS'.subject RDFClosure.RDFS%27-module.html#subject RDFClosure.RDFS'.RDFSNS RDFClosure.RDFS%27-module.html#RDFSNS RDFClosure.RDFS'.__package__ RDFClosure.RDFS%27-module.html#__package__ RDFClosure.RDFS'.member RDFClosure.RDFS%27-module.html#member RDFClosure.RDFS'.HTMLLiteral RDFClosure.RDFS%27-module.html#HTMLLiteral RDFClosure.RDFS'.type RDFClosure.RDFS%27-module.html#type RDFClosure.RDFS'.Class RDFClosure.RDFS%27-module.html#Class RDFClosure.RDFS'.ContainerMembershipProperty RDFClosure.RDFS%27-module.html#ContainerMembershipProperty RDFClosure.RDFS'.predicate RDFClosure.RDFS%27-module.html#predicate RDFClosure.RDFS'.subPropertyOf RDFClosure.RDFS%27-module.html#subPropertyOf RDFClosure.RDFS'.Resource RDFClosure.RDFS%27-module.html#Resource RDFClosure.RDFS'.nil RDFClosure.RDFS%27-module.html#nil RDFClosure.RDFS'.Datatype RDFClosure.RDFS%27-module.html#Datatype RDFClosure.RDFS'.XMLLiteral RDFClosure.RDFS%27-module.html#XMLLiteral RDFClosure.RDFS'.object RDFClosure.RDFS%27-module.html#object RDFClosure.RDFS'.List RDFClosure.RDFS%27-module.html#List RDFClosure.RDFS'.Bag RDFClosure.RDFS%27-module.html#Bag RDFClosure.RDFS'.Property RDFClosure.RDFS%27-module.html#Property RDFClosure.RDFS'.subClassOf RDFClosure.RDFS%27-module.html#subClassOf RDFClosure.RDFS'.Seq RDFClosure.RDFS%27-module.html#Seq RDFClosure.RDFS'.RDFNS RDFClosure.RDFS%27-module.html#RDFNS RDFClosure.RDFS'.value RDFClosure.RDFS%27-module.html#value RDFClosure.RDFS'.range RDFClosure.RDFS%27-module.html#range RDFClosure.RDFS'.Alt RDFClosure.RDFS%27-module.html#Alt RDFClosure.RDFS'.seeAlso RDFClosure.RDFS%27-module.html#seeAlso RDFClosure.RDFS'.first RDFClosure.RDFS%27-module.html#first RDFClosure.RDFSClosure RDFClosure.RDFSClosure-module.html RDFClosure.RDFSClosure.__license__ RDFClosure.RDFSClosure-module.html#__license__ RDFClosure.RDFSClosure.__author__ RDFClosure.RDFSClosure-module.html#__author__ RDFClosure.RDFSClosure.__package__ RDFClosure.RDFSClosure-module.html#__package__ RDFClosure.RestrictedDatatype RDFClosure.RestrictedDatatype-module.html RDFClosure.RestrictedDatatype.DatatypeProperty RDFClosure.RestrictedDatatype-module.html#DatatypeProperty RDFClosure.RestrictedDatatype.OntologyProperty RDFClosure.RestrictedDatatype-module.html#OntologyProperty RDFClosure.RestrictedDatatype.Axiom RDFClosure.RestrictedDatatype-module.html#Axiom RDFClosure.RestrictedDatatype.LENGTH_AND_PATTERN RDFClosure.RestrictedDatatype-module.html#LENGTH_AND_PATTERN RDFClosure.RestrictedDatatype.sourceIndividual RDFClosure.RestrictedDatatype-module.html#sourceIndividual RDFClosure.RestrictedDatatype.maxQualifiedCardinality RDFClosure.RestrictedDatatype-module.html#maxQualifiedCardinality RDFClosure.RestrictedDatatype.annotatedSource RDFClosure.RestrictedDatatype-module.html#annotatedSource RDFClosure.RestrictedDatatype.Annotation RDFClosure.RestrictedDatatype-module.html#Annotation RDFClosure.RestrictedDatatype.Datatypes_per_facets RDFClosure.RestrictedDatatype-module.html#Datatypes_per_facets RDFClosure.RestrictedDatatype.inverseOf RDFClosure.RestrictedDatatype-module.html#inverseOf RDFClosure.RestrictedDatatype.MIN_MAX RDFClosure.RestrictedDatatype-module.html#MIN_MAX RDFClosure.RestrictedDatatype.hasSelf RDFClosure.RestrictedDatatype-module.html#hasSelf RDFClosure.RestrictedDatatype.hasKey RDFClosure.RestrictedDatatype-module.html#hasKey RDFClosure.RestrictedDatatype.onProperties RDFClosure.RestrictedDatatype-module.html#onProperties RDFClosure.RestrictedDatatype.oneOf RDFClosure.RestrictedDatatype-module.html#oneOf RDFClosure.RestrictedDatatype.ReflexiveProperty RDFClosure.RestrictedDatatype-module.html#ReflexiveProperty RDFClosure.RestrictedDatatype.disjointClasses RDFClosure.RestrictedDatatype-module.html#disjointClasses RDFClosure.RestrictedDatatype.LENGTH RDFClosure.RestrictedDatatype-module.html#LENGTH RDFClosure.RestrictedDatatype.AsymmetricProperty RDFClosure.RestrictedDatatype-module.html#AsymmetricProperty RDFClosure.RestrictedDatatype.intersectionOf RDFClosure.RestrictedDatatype-module.html#intersectionOf RDFClosure.RestrictedDatatype.DeprecatedClass RDFClosure.RestrictedDatatype-module.html#DeprecatedClass RDFClosure.RestrictedDatatype.versionIRI RDFClosure.RestrictedDatatype-module.html#versionIRI RDFClosure.RestrictedDatatype.assertionProperty RDFClosure.RestrictedDatatype-module.html#assertionProperty RDFClosure.RestrictedDatatype.datatypeComplementOf RDFClosure.RestrictedDatatype-module.html#datatypeComplementOf RDFClosure.RestrictedDatatype.AllDisjointClasses RDFClosure.RestrictedDatatype-module.html#AllDisjointClasses RDFClosure.RestrictedDatatype.annotatedProperty RDFClosure.RestrictedDatatype-module.html#annotatedProperty RDFClosure.RestrictedDatatype.IrreflexiveProperty RDFClosure.RestrictedDatatype-module.html#IrreflexiveProperty RDFClosure.RestrictedDatatype.NegativePropertyAssertion RDFClosure.RestrictedDatatype-module.html#NegativePropertyAssertion RDFClosure.RestrictedDatatype.Nothing RDFClosure.RestrictedDatatype-module.html#Nothing RDFClosure.RestrictedDatatype.SelfRestriction RDFClosure.RestrictedDatatype-module.html#SelfRestriction RDFClosure.RestrictedDatatype.annotatedTarget RDFClosure.RestrictedDatatype-module.html#annotatedTarget RDFClosure.RestrictedDatatype.versionInfo RDFClosure.RestrictedDatatype-module.html#versionInfo RDFClosure.RestrictedDatatype.InverseFunctionalProperty RDFClosure.RestrictedDatatype-module.html#InverseFunctionalProperty RDFClosure.RestrictedDatatype.priorVersion RDFClosure.RestrictedDatatype-module.html#priorVersion RDFClosure.RestrictedDatatype.propertyDisjointWith RDFClosure.RestrictedDatatype-module.html#propertyDisjointWith RDFClosure.RestrictedDatatype.Thing RDFClosure.RestrictedDatatype-module.html#Thing RDFClosure.RestrictedDatatype.onClass RDFClosure.RestrictedDatatype-module.html#onClass RDFClosure.RestrictedDatatype.AnnotationProperty RDFClosure.RestrictedDatatype-module.html#AnnotationProperty RDFClosure.RestrictedDatatype.qualifiedCardinality RDFClosure.RestrictedDatatype-module.html#qualifiedCardinality RDFClosure.RestrictedDatatype.Restriction RDFClosure.RestrictedDatatype-module.html#Restriction RDFClosure.RestrictedDatatype.deprecated RDFClosure.RestrictedDatatype-module.html#deprecated RDFClosure.RestrictedDatatype.FunctionalProperty RDFClosure.RestrictedDatatype-module.html#FunctionalProperty RDFClosure.RestrictedDatatype.withRestrictions RDFClosure.RestrictedDatatype-module.html#withRestrictions RDFClosure.RestrictedDatatype.disjointWith RDFClosure.RestrictedDatatype-module.html#disjointWith RDFClosure.RestrictedDatatype.members RDFClosure.RestrictedDatatype-module.html#members RDFClosure.RestrictedDatatype.sameAs RDFClosure.RestrictedDatatype-module.html#sameAs RDFClosure.RestrictedDatatype.DeprecatedProperty RDFClosure.RestrictedDatatype-module.html#DeprecatedProperty RDFClosure.RestrictedDatatype.OWLpredicate RDFClosure.RestrictedDatatype-module.html#OWLpredicate RDFClosure.RestrictedDatatype._lit_to_value RDFClosure.RestrictedDatatype-module.html#_lit_to_value RDFClosure.RestrictedDatatype.distinctMembers RDFClosure.RestrictedDatatype-module.html#distinctMembers RDFClosure.RestrictedDatatype.OWLNS RDFClosure.RestrictedDatatype-module.html#OWLNS RDFClosure.RestrictedDatatype.propertyChainAxiom RDFClosure.RestrictedDatatype-module.html#propertyChainAxiom RDFClosure.RestrictedDatatype.targetValue RDFClosure.RestrictedDatatype-module.html#targetValue RDFClosure.RestrictedDatatype.Ontology RDFClosure.RestrictedDatatype-module.html#Ontology RDFClosure.RestrictedDatatype.backwardCompatibleWith RDFClosure.RestrictedDatatype-module.html#backwardCompatibleWith RDFClosure.RestrictedDatatype.__author__ RDFClosure.RestrictedDatatype-module.html#__author__ RDFClosure.RestrictedDatatype.cardinality RDFClosure.RestrictedDatatype-module.html#cardinality RDFClosure.RestrictedDatatype.AllDisjointProperties RDFClosure.RestrictedDatatype-module.html#AllDisjointProperties RDFClosure.RestrictedDatatype.someValuesFrom RDFClosure.RestrictedDatatype-module.html#someValuesFrom RDFClosure.RestrictedDatatype.BottomDataProperty RDFClosure.RestrictedDatatype-module.html#BottomDataProperty RDFClosure.RestrictedDatatype.DataRange RDFClosure.RestrictedDatatype-module.html#DataRange RDFClosure.RestrictedDatatype.onDataRange RDFClosure.RestrictedDatatype-module.html#onDataRange RDFClosure.RestrictedDatatype.onDatatype RDFClosure.RestrictedDatatype-module.html#onDatatype RDFClosure.RestrictedDatatype.minCardinality RDFClosure.RestrictedDatatype-module.html#minCardinality RDFClosure.RestrictedDatatype.equivalentProperty RDFClosure.RestrictedDatatype-module.html#equivalentProperty RDFClosure.RestrictedDatatype.TopObjectProperty RDFClosure.RestrictedDatatype-module.html#TopObjectProperty RDFClosure.RestrictedDatatype.complementOf RDFClosure.RestrictedDatatype-module.html#complementOf RDFClosure.RestrictedDatatype.imports RDFClosure.RestrictedDatatype-module.html#imports RDFClosure.RestrictedDatatype.TopDataProperty RDFClosure.RestrictedDatatype-module.html#TopDataProperty RDFClosure.RestrictedDatatype.facetable_datatypes RDFClosure.RestrictedDatatype-module.html#facetable_datatypes RDFClosure.RestrictedDatatype.AllDifferent RDFClosure.RestrictedDatatype-module.html#AllDifferent RDFClosure.RestrictedDatatype.OWLsubject RDFClosure.RestrictedDatatype-module.html#OWLsubject RDFClosure.RestrictedDatatype.__license__ RDFClosure.RestrictedDatatype-module.html#__license__ RDFClosure.RestrictedDatatype.incompatibleWith RDFClosure.RestrictedDatatype-module.html#incompatibleWith RDFClosure.RestrictedDatatype.hasValue RDFClosure.RestrictedDatatype-module.html#hasValue RDFClosure.RestrictedDatatype.__package__ RDFClosure.RestrictedDatatype-module.html#__package__ RDFClosure.RestrictedDatatype.maxCardinality RDFClosure.RestrictedDatatype-module.html#maxCardinality RDFClosure.RestrictedDatatype.BottomObjectProperty RDFClosure.RestrictedDatatype-module.html#BottomObjectProperty RDFClosure.RestrictedDatatype.LENGTH_PATTERN_LRANGE RDFClosure.RestrictedDatatype-module.html#LENGTH_PATTERN_LRANGE RDFClosure.RestrictedDatatype.extract_faceted_datatypes RDFClosure.RestrictedDatatype-module.html#extract_faceted_datatypes RDFClosure.RestrictedDatatype.OWLClass RDFClosure.RestrictedDatatype-module.html#OWLClass RDFClosure.RestrictedDatatype.TransitiveProperty RDFClosure.RestrictedDatatype-module.html#TransitiveProperty RDFClosure.RestrictedDatatype._lang_range_check RDFClosure.RestrictedDatatype-module.html#_lang_range_check RDFClosure.RestrictedDatatype.disjointUnionOf RDFClosure.RestrictedDatatype-module.html#disjointUnionOf RDFClosure.RestrictedDatatype.allValuesFrom RDFClosure.RestrictedDatatype-module.html#allValuesFrom RDFClosure.RestrictedDatatype.SymmetricProperty RDFClosure.RestrictedDatatype-module.html#SymmetricProperty RDFClosure.RestrictedDatatype.ObjectProperty RDFClosure.RestrictedDatatype-module.html#ObjectProperty RDFClosure.RestrictedDatatype.NamedIndividual RDFClosure.RestrictedDatatype-module.html#NamedIndividual RDFClosure.RestrictedDatatype.differentFrom RDFClosure.RestrictedDatatype-module.html#differentFrom RDFClosure.RestrictedDatatype.minQualifiedCardinality RDFClosure.RestrictedDatatype-module.html#minQualifiedCardinality RDFClosure.RestrictedDatatype.onProperty RDFClosure.RestrictedDatatype-module.html#onProperty RDFClosure.RestrictedDatatype.equivalentClass RDFClosure.RestrictedDatatype-module.html#equivalentClass RDFClosure.RestrictedDatatype.unionOf RDFClosure.RestrictedDatatype-module.html#unionOf RDFClosure.RestrictedDatatype.targetIndividual RDFClosure.RestrictedDatatype-module.html#targetIndividual RDFClosure.XsdDatatypes RDFClosure.XsdDatatypes-module.html RDFClosure.XsdDatatypes.__license__ RDFClosure.XsdDatatypes-module.html#__license__ RDFClosure.XsdDatatypes.OWL_Datatype_Subsumptions RDFClosure.XsdDatatypes-module.html#OWL_Datatype_Subsumptions RDFClosure.XsdDatatypes._Common_XSD_Datatypes RDFClosure.XsdDatatypes-module.html#_Common_XSD_Datatypes RDFClosure.XsdDatatypes.RDFS_Datatype_Subsumptions RDFClosure.XsdDatatypes-module.html#RDFS_Datatype_Subsumptions RDFClosure.XsdDatatypes._Common_Datatype_Subsumptions RDFClosure.XsdDatatypes-module.html#_Common_Datatype_Subsumptions RDFClosure.XsdDatatypes.__package__ RDFClosure.XsdDatatypes-module.html#__package__ RDFClosure.XsdDatatypes.__author__ RDFClosure.XsdDatatypes-module.html#__author__ RDFClosure.XsdDatatypes.OWL_RL_Datatypes RDFClosure.XsdDatatypes-module.html#OWL_RL_Datatypes RDFClosure.XsdDatatypes.RDFS_Datatypes RDFClosure.XsdDatatypes-module.html#RDFS_Datatypes RDFClosure.Closure.Core RDFClosure.Closure.Core-class.html RDFClosure.Closure.Core.add_d_axioms RDFClosure.Closure.Core-class.html#add_d_axioms RDFClosure.Closure.Core.closure RDFClosure.Closure.Core-class.html#closure RDFClosure.Closure.Core.added_triples RDFClosure.Closure.Core-class.html#added_triples RDFClosure.Closure.Core.empty_stored_triples RDFClosure.Closure.Core-class.html#empty_stored_triples RDFClosure.Closure.Core.store_triple RDFClosure.Closure.Core-class.html#store_triple RDFClosure.Closure.Core.rdfs RDFClosure.Closure.Core-class.html#rdfs RDFClosure.Closure.Core.rules RDFClosure.Closure.Core-class.html#rules RDFClosure.Closure.Core.graph RDFClosure.Closure.Core-class.html#graph RDFClosure.Closure.Core.flush_stored_triples RDFClosure.Closure.Core-class.html#flush_stored_triples RDFClosure.Closure.Core.IMaxNum RDFClosure.Closure.Core-class.html#IMaxNum RDFClosure.Closure.Core.one_time_rules RDFClosure.Closure.Core-class.html#one_time_rules RDFClosure.Closure.Core.axioms RDFClosure.Closure.Core-class.html#axioms RDFClosure.Closure.Core.daxioms RDFClosure.Closure.Core-class.html#daxioms RDFClosure.Closure.Core.literal_proxies RDFClosure.Closure.Core-class.html#literal_proxies RDFClosure.Closure.Core.pre_process RDFClosure.Closure.Core-class.html#pre_process RDFClosure.Closure.Core.get_literal_value RDFClosure.Closure.Core-class.html#get_literal_value RDFClosure.Closure.Core.post_process RDFClosure.Closure.Core-class.html#post_process RDFClosure.Closure.Core.error_messages RDFClosure.Closure.Core-class.html#error_messages RDFClosure.Closure.Core.add_axioms RDFClosure.Closure.Core-class.html#add_axioms RDFClosure.Closure.Core.__init__ RDFClosure.Closure.Core-class.html#__init__ RDFClosure.Closure.Core.add_error RDFClosure.Closure.Core-class.html#add_error RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics-class.html RDFClosure.OWLRL.OWLRL_Semantics.restriction_typing_check RDFClosure.OWLRL.OWLRL_Semantics-class.html#restriction_typing_check RDFClosure.Closure.Core.empty_stored_triples RDFClosure.Closure.Core-class.html#empty_stored_triples RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics.one_time_rules RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics-class.html#one_time_rules RDFClosure.Closure.Core.get_literal_value RDFClosure.Closure.Core-class.html#get_literal_value RDFClosure.Closure.Core.pre_process RDFClosure.Closure.Core-class.html#pre_process RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics.add_d_axioms RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics-class.html#add_d_axioms RDFClosure.Closure.Core.store_triple RDFClosure.Closure.Core-class.html#store_triple RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics.rdfs RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics-class.html#rdfs RDFClosure.Closure.Core.daxioms RDFClosure.Closure.Core-class.html#daxioms RDFClosure.Closure.Core.graph RDFClosure.Closure.Core-class.html#graph RDFClosure.Closure.Core.flush_stored_triples RDFClosure.Closure.Core-class.html#flush_stored_triples RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics.add_axioms RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics-class.html#add_axioms RDFClosure.OWLRL.OWLRL_Semantics._get_resource_or_literal RDFClosure.OWLRL.OWLRL_Semantics-class.html#_get_resource_or_literal RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics.__init__ RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics-class.html#__init__ RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics.post_process RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics-class.html#post_process RDFClosure.OWLRL.OWLRL_Semantics._property_chain RDFClosure.OWLRL.OWLRL_Semantics-class.html#_property_chain RDFClosure.OWLRL.OWLRL_Semantics._classes RDFClosure.OWLRL.OWLRL_Semantics-class.html#_classes RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics.rules RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics-class.html#rules RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics.full_binding_triples RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics-class.html#full_binding_triples RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics.add_new_datatype RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics-class.html#add_new_datatype RDFClosure.OWLRL.OWLRL_Semantics._class_axioms RDFClosure.OWLRL.OWLRL_Semantics-class.html#_class_axioms RDFClosure.Closure.Core.error_messages RDFClosure.Closure.Core-class.html#error_messages RDFClosure.Closure.Core.literal_proxies RDFClosure.Closure.Core-class.html#literal_proxies RDFClosure.Closure.Core.axioms RDFClosure.Closure.Core-class.html#axioms RDFClosure.Closure.Core.add_error RDFClosure.Closure.Core-class.html#add_error RDFClosure.Closure.Core.closure RDFClosure.Closure.Core-class.html#closure RDFClosure.OWLRL.OWLRL_Semantics._list RDFClosure.OWLRL.OWLRL_Semantics-class.html#_list RDFClosure.OWLRL.OWLRL_Semantics._schema_vocabulary RDFClosure.OWLRL.OWLRL_Semantics-class.html#_schema_vocabulary RDFClosure.Closure.Core.IMaxNum RDFClosure.Closure.Core-class.html#IMaxNum RDFClosure.Closure.Core.added_triples RDFClosure.Closure.Core-class.html#added_triples RDFClosure.OWLRL.OWLRL_Semantics._one_time_rules_misc RDFClosure.OWLRL.OWLRL_Semantics-class.html#_one_time_rules_misc RDFClosure.OWLRL.OWLRL_Semantics._properties RDFClosure.OWLRL.OWLRL_Semantics-class.html#_properties RDFClosure.OWLRL.OWLRL_Semantics._equality RDFClosure.OWLRL.OWLRL_Semantics-class.html#_equality RDFClosure.OWLRL.OWLRL_Semantics._one_time_rules_datatypes RDFClosure.OWLRL.OWLRL_Semantics-class.html#_one_time_rules_datatypes RDFClosure.DatatypeHandling._namelessTZ RDFClosure.DatatypeHandling._namelessTZ-class.html RDFClosure.DatatypeHandling._namelessTZ.dst RDFClosure.DatatypeHandling._namelessTZ-class.html#dst RDFClosure.DatatypeHandling._namelessTZ.utcoffset RDFClosure.DatatypeHandling._namelessTZ-class.html#utcoffset RDFClosure.DatatypeHandling._namelessTZ.tzname RDFClosure.DatatypeHandling._namelessTZ-class.html#tzname RDFClosure.DatatypeHandling._namelessTZ.__init__ RDFClosure.DatatypeHandling._namelessTZ-class.html#__init__ RDFClosure.DeductiveClosure RDFClosure.DeductiveClosure-class.html RDFClosure.DeductiveClosure.axiomatic_triples RDFClosure.DeductiveClosure-class.html#axiomatic_triples RDFClosure.DeductiveClosure.datatype_axioms RDFClosure.DeductiveClosure-class.html#datatype_axioms RDFClosure.DeductiveClosure.use_improved_datatypes_conversions RDFClosure.DeductiveClosure-class.html#use_improved_datatypes_conversions RDFClosure.DeductiveClosure.rdfs_closure RDFClosure.DeductiveClosure-class.html#rdfs_closure RDFClosure.DeductiveClosure.improved_datatype_generic RDFClosure.DeductiveClosure-class.html#improved_datatype_generic RDFClosure.DeductiveClosure.__init__ RDFClosure.DeductiveClosure-class.html#__init__ RDFClosure.DeductiveClosure.closure_class RDFClosure.DeductiveClosure-class.html#closure_class RDFClosure.DeductiveClosure.expand RDFClosure.DeductiveClosure-class.html#expand RDFClosure.DeductiveClosure.use_rdflib_datatypes_conversions RDFClosure.DeductiveClosure-class.html#use_rdflib_datatypes_conversions RDFClosure.Literals.LiteralProxies RDFClosure.Literals.LiteralProxies-class.html RDFClosure.Literals.LiteralProxies.restore RDFClosure.Literals.LiteralProxies-class.html#restore RDFClosure.Literals.LiteralProxies.__init__ RDFClosure.Literals.LiteralProxies-class.html#__init__ RDFClosure.Literals.LiteralProxies._massageGraph RDFClosure.Literals.LiteralProxies-class.html#_massageGraph RDFClosure.Literals._LiteralStructure RDFClosure.Literals._LiteralStructure-class.html RDFClosure.Literals._LiteralStructure.__ne__ RDFClosure.Literals._LiteralStructure-class.html#__ne__ RDFClosure.Literals._LiteralStructure.__repr__ RDFClosure.Literals._LiteralStructure-class.html#__repr__ RDFClosure.Literals._LiteralStructure.compare_value RDFClosure.Literals._LiteralStructure-class.html#compare_value RDFClosure.Literals._LiteralStructure.__hash__ RDFClosure.Literals._LiteralStructure-class.html#__hash__ RDFClosure.Literals._LiteralStructure.__eq__ RDFClosure.Literals._LiteralStructure-class.html#__eq__ RDFClosure.Literals._LiteralStructure.__init__ RDFClosure.Literals._LiteralStructure-class.html#__init__ RDFClosure.OWLRL.OWLRL_Semantics RDFClosure.OWLRL.OWLRL_Semantics-class.html RDFClosure.OWLRL.OWLRL_Semantics.restriction_typing_check RDFClosure.OWLRL.OWLRL_Semantics-class.html#restriction_typing_check RDFClosure.Closure.Core.empty_stored_triples RDFClosure.Closure.Core-class.html#empty_stored_triples RDFClosure.OWLRL.OWLRL_Semantics.one_time_rules RDFClosure.OWLRL.OWLRL_Semantics-class.html#one_time_rules RDFClosure.Closure.Core.get_literal_value RDFClosure.Closure.Core-class.html#get_literal_value RDFClosure.OWLRL.OWLRL_Semantics.__init__ RDFClosure.OWLRL.OWLRL_Semantics-class.html#__init__ RDFClosure.OWLRL.OWLRL_Semantics.add_d_axioms RDFClosure.OWLRL.OWLRL_Semantics-class.html#add_d_axioms RDFClosure.OWLRL.OWLRL_Semantics._list RDFClosure.OWLRL.OWLRL_Semantics-class.html#_list RDFClosure.Closure.Core.rdfs RDFClosure.Closure.Core-class.html#rdfs RDFClosure.Closure.Core.daxioms RDFClosure.Closure.Core-class.html#daxioms RDFClosure.Closure.Core.graph RDFClosure.Closure.Core-class.html#graph RDFClosure.Closure.Core.flush_stored_triples RDFClosure.Closure.Core-class.html#flush_stored_triples RDFClosure.Closure.Core.axioms RDFClosure.Closure.Core-class.html#axioms RDFClosure.OWLRL.OWLRL_Semantics._get_resource_or_literal RDFClosure.OWLRL.OWLRL_Semantics-class.html#_get_resource_or_literal RDFClosure.Closure.Core.pre_process RDFClosure.Closure.Core-class.html#pre_process RDFClosure.OWLRL.OWLRL_Semantics.post_process RDFClosure.OWLRL.OWLRL_Semantics-class.html#post_process RDFClosure.OWLRL.OWLRL_Semantics._property_chain RDFClosure.OWLRL.OWLRL_Semantics-class.html#_property_chain RDFClosure.OWLRL.OWLRL_Semantics.rules RDFClosure.OWLRL.OWLRL_Semantics-class.html#rules RDFClosure.OWLRL.OWLRL_Semantics._classes RDFClosure.OWLRL.OWLRL_Semantics-class.html#_classes RDFClosure.OWLRL.OWLRL_Semantics._class_axioms RDFClosure.OWLRL.OWLRL_Semantics-class.html#_class_axioms RDFClosure.Closure.Core.error_messages RDFClosure.Closure.Core-class.html#error_messages RDFClosure.Closure.Core.literal_proxies RDFClosure.Closure.Core-class.html#literal_proxies RDFClosure.OWLRL.OWLRL_Semantics.add_axioms RDFClosure.OWLRL.OWLRL_Semantics-class.html#add_axioms RDFClosure.Closure.Core.add_error RDFClosure.Closure.Core-class.html#add_error RDFClosure.Closure.Core.closure RDFClosure.Closure.Core-class.html#closure RDFClosure.Closure.Core.store_triple RDFClosure.Closure.Core-class.html#store_triple RDFClosure.OWLRL.OWLRL_Semantics._schema_vocabulary RDFClosure.OWLRL.OWLRL_Semantics-class.html#_schema_vocabulary RDFClosure.Closure.Core.IMaxNum RDFClosure.Closure.Core-class.html#IMaxNum RDFClosure.Closure.Core.added_triples RDFClosure.Closure.Core-class.html#added_triples RDFClosure.OWLRL.OWLRL_Semantics._one_time_rules_misc RDFClosure.OWLRL.OWLRL_Semantics-class.html#_one_time_rules_misc RDFClosure.OWLRL.OWLRL_Semantics._properties RDFClosure.OWLRL.OWLRL_Semantics-class.html#_properties RDFClosure.OWLRL.OWLRL_Semantics._equality RDFClosure.OWLRL.OWLRL_Semantics-class.html#_equality RDFClosure.OWLRL.OWLRL_Semantics._one_time_rules_datatypes RDFClosure.OWLRL.OWLRL_Semantics-class.html#_one_time_rules_datatypes RDFClosure.OWLRLExtras.OWLRL_Extension RDFClosure.OWLRLExtras.OWLRL_Extension-class.html RDFClosure.OWLRLExtras.OWLRL_Extension.restriction_typing_check RDFClosure.OWLRLExtras.OWLRL_Extension-class.html#restriction_typing_check RDFClosure.Closure.Core.empty_stored_triples RDFClosure.Closure.Core-class.html#empty_stored_triples RDFClosure.OWLRLExtras.OWLRL_Extension.one_time_rules RDFClosure.OWLRLExtras.OWLRL_Extension-class.html#one_time_rules RDFClosure.Closure.Core.get_literal_value RDFClosure.Closure.Core-class.html#get_literal_value RDFClosure.OWLRLExtras.OWLRL_Extension.__init__ RDFClosure.OWLRLExtras.OWLRL_Extension-class.html#__init__ RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics.add_d_axioms RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics-class.html#add_d_axioms RDFClosure.Closure.Core.store_triple RDFClosure.Closure.Core-class.html#store_triple RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics.rdfs RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics-class.html#rdfs RDFClosure.Closure.Core.daxioms RDFClosure.Closure.Core-class.html#daxioms RDFClosure.Closure.Core.graph RDFClosure.Closure.Core-class.html#graph RDFClosure.Closure.Core.flush_stored_triples RDFClosure.Closure.Core-class.html#flush_stored_triples RDFClosure.OWLRLExtras.OWLRL_Extension._subsume_restricted_datatypes RDFClosure.OWLRLExtras.OWLRL_Extension-class.html#_subsume_restricted_datatypes RDFClosure.OWLRLExtras.OWLRL_Extension.add_axioms RDFClosure.OWLRLExtras.OWLRL_Extension-class.html#add_axioms RDFClosure.OWLRL.OWLRL_Semantics._get_resource_or_literal RDFClosure.OWLRL.OWLRL_Semantics-class.html#_get_resource_or_literal RDFClosure.Closure.Core.pre_process RDFClosure.Closure.Core-class.html#pre_process RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics.post_process RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics-class.html#post_process RDFClosure.OWLRL.OWLRL_Semantics._property_chain RDFClosure.OWLRL.OWLRL_Semantics-class.html#_property_chain RDFClosure.OWLRL.OWLRL_Semantics._classes RDFClosure.OWLRL.OWLRL_Semantics-class.html#_classes RDFClosure.OWLRLExtras.OWLRL_Extension.restricted_datatypes RDFClosure.OWLRLExtras.OWLRL_Extension-class.html#restricted_datatypes RDFClosure.OWLRLExtras.OWLRL_Extension.rules RDFClosure.OWLRLExtras.OWLRL_Extension-class.html#rules RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics.full_binding_triples RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics-class.html#full_binding_triples RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics.add_new_datatype RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics-class.html#add_new_datatype RDFClosure.OWLRL.OWLRL_Semantics._class_axioms RDFClosure.OWLRL.OWLRL_Semantics-class.html#_class_axioms RDFClosure.Closure.Core.error_messages RDFClosure.Closure.Core-class.html#error_messages RDFClosure.Closure.Core.literal_proxies RDFClosure.Closure.Core-class.html#literal_proxies RDFClosure.OWLRLExtras.OWLRL_Extension.extra_axioms RDFClosure.OWLRLExtras.OWLRL_Extension-class.html#extra_axioms RDFClosure.Closure.Core.axioms RDFClosure.Closure.Core-class.html#axioms RDFClosure.Closure.Core.add_error RDFClosure.Closure.Core-class.html#add_error RDFClosure.Closure.Core.closure RDFClosure.Closure.Core-class.html#closure RDFClosure.OWLRL.OWLRL_Semantics._list RDFClosure.OWLRL.OWLRL_Semantics-class.html#_list RDFClosure.OWLRL.OWLRL_Semantics._schema_vocabulary RDFClosure.OWLRL.OWLRL_Semantics-class.html#_schema_vocabulary RDFClosure.Closure.Core.IMaxNum RDFClosure.Closure.Core-class.html#IMaxNum RDFClosure.Closure.Core.added_triples RDFClosure.Closure.Core-class.html#added_triples RDFClosure.OWLRL.OWLRL_Semantics._one_time_rules_misc RDFClosure.OWLRL.OWLRL_Semantics-class.html#_one_time_rules_misc RDFClosure.OWLRL.OWLRL_Semantics._properties RDFClosure.OWLRL.OWLRL_Semantics-class.html#_properties RDFClosure.OWLRL.OWLRL_Semantics._equality RDFClosure.OWLRL.OWLRL_Semantics-class.html#_equality RDFClosure.OWLRL.OWLRL_Semantics._one_time_rules_datatypes RDFClosure.OWLRL.OWLRL_Semantics-class.html#_one_time_rules_datatypes RDFClosure.OWLRLExtras.OWLRL_Extension_Trimming RDFClosure.OWLRLExtras.OWLRL_Extension_Trimming-class.html RDFClosure.OWLRLExtras.OWLRL_Extension.restriction_typing_check RDFClosure.OWLRLExtras.OWLRL_Extension-class.html#restriction_typing_check RDFClosure.Closure.Core.empty_stored_triples RDFClosure.Closure.Core-class.html#empty_stored_triples RDFClosure.OWLRLExtras.OWLRL_Extension.one_time_rules RDFClosure.OWLRLExtras.OWLRL_Extension-class.html#one_time_rules RDFClosure.Closure.Core.get_literal_value RDFClosure.Closure.Core-class.html#get_literal_value RDFClosure.OWLRLExtras.OWLRL_Extension_Trimming.__init__ RDFClosure.OWLRLExtras.OWLRL_Extension_Trimming-class.html#__init__ RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics.add_d_axioms RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics-class.html#add_d_axioms RDFClosure.Closure.Core.store_triple RDFClosure.Closure.Core-class.html#store_triple RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics.rdfs RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics-class.html#rdfs RDFClosure.Closure.Core.daxioms RDFClosure.Closure.Core-class.html#daxioms RDFClosure.Closure.Core.graph RDFClosure.Closure.Core-class.html#graph RDFClosure.Closure.Core.flush_stored_triples RDFClosure.Closure.Core-class.html#flush_stored_triples RDFClosure.OWLRLExtras.OWLRL_Extension._subsume_restricted_datatypes RDFClosure.OWLRLExtras.OWLRL_Extension-class.html#_subsume_restricted_datatypes RDFClosure.OWLRLExtras.OWLRL_Extension.add_axioms RDFClosure.OWLRLExtras.OWLRL_Extension-class.html#add_axioms RDFClosure.OWLRL.OWLRL_Semantics._get_resource_or_literal RDFClosure.OWLRL.OWLRL_Semantics-class.html#_get_resource_or_literal RDFClosure.Closure.Core.pre_process RDFClosure.Closure.Core-class.html#pre_process RDFClosure.OWLRLExtras.OWLRL_Extension_Trimming.post_process RDFClosure.OWLRLExtras.OWLRL_Extension_Trimming-class.html#post_process RDFClosure.OWLRL.OWLRL_Semantics._property_chain RDFClosure.OWLRL.OWLRL_Semantics-class.html#_property_chain RDFClosure.OWLRL.OWLRL_Semantics._classes RDFClosure.OWLRL.OWLRL_Semantics-class.html#_classes RDFClosure.OWLRLExtras.OWLRL_Extension.restricted_datatypes RDFClosure.OWLRLExtras.OWLRL_Extension-class.html#restricted_datatypes RDFClosure.OWLRLExtras.OWLRL_Extension.rules RDFClosure.OWLRLExtras.OWLRL_Extension-class.html#rules RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics.full_binding_triples RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics-class.html#full_binding_triples RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics.add_new_datatype RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics-class.html#add_new_datatype RDFClosure.OWLRL.OWLRL_Semantics._class_axioms RDFClosure.OWLRL.OWLRL_Semantics-class.html#_class_axioms RDFClosure.Closure.Core.error_messages RDFClosure.Closure.Core-class.html#error_messages RDFClosure.Closure.Core.literal_proxies RDFClosure.Closure.Core-class.html#literal_proxies RDFClosure.OWLRLExtras.OWLRL_Extension.extra_axioms RDFClosure.OWLRLExtras.OWLRL_Extension-class.html#extra_axioms RDFClosure.Closure.Core.axioms RDFClosure.Closure.Core-class.html#axioms RDFClosure.Closure.Core.add_error RDFClosure.Closure.Core-class.html#add_error RDFClosure.Closure.Core.closure RDFClosure.Closure.Core-class.html#closure RDFClosure.OWLRL.OWLRL_Semantics._list RDFClosure.OWLRL.OWLRL_Semantics-class.html#_list RDFClosure.OWLRL.OWLRL_Semantics._schema_vocabulary RDFClosure.OWLRL.OWLRL_Semantics-class.html#_schema_vocabulary RDFClosure.Closure.Core.IMaxNum RDFClosure.Closure.Core-class.html#IMaxNum RDFClosure.Closure.Core.added_triples RDFClosure.Closure.Core-class.html#added_triples RDFClosure.OWLRL.OWLRL_Semantics._one_time_rules_misc RDFClosure.OWLRL.OWLRL_Semantics-class.html#_one_time_rules_misc RDFClosure.OWLRL.OWLRL_Semantics._properties RDFClosure.OWLRL.OWLRL_Semantics-class.html#_properties RDFClosure.OWLRL.OWLRL_Semantics._equality RDFClosure.OWLRL.OWLRL_Semantics-class.html#_equality RDFClosure.OWLRL.OWLRL_Semantics._one_time_rules_datatypes RDFClosure.OWLRL.OWLRL_Semantics-class.html#_one_time_rules_datatypes RDFClosure.RDFSClosure.RDFS_Semantics RDFClosure.RDFSClosure.RDFS_Semantics-class.html RDFClosure.RDFSClosure.RDFS_Semantics.add_d_axioms RDFClosure.RDFSClosure.RDFS_Semantics-class.html#add_d_axioms RDFClosure.Closure.Core.closure RDFClosure.Closure.Core-class.html#closure RDFClosure.Closure.Core.pre_process RDFClosure.Closure.Core-class.html#pre_process RDFClosure.Closure.Core.empty_stored_triples RDFClosure.Closure.Core-class.html#empty_stored_triples RDFClosure.Closure.Core.store_triple RDFClosure.Closure.Core-class.html#store_triple RDFClosure.Closure.Core.rdfs RDFClosure.Closure.Core-class.html#rdfs RDFClosure.RDFSClosure.RDFS_Semantics.rules RDFClosure.RDFSClosure.RDFS_Semantics-class.html#rules RDFClosure.Closure.Core.graph RDFClosure.Closure.Core-class.html#graph RDFClosure.Closure.Core.flush_stored_triples RDFClosure.Closure.Core-class.html#flush_stored_triples RDFClosure.Closure.Core.IMaxNum RDFClosure.Closure.Core-class.html#IMaxNum RDFClosure.RDFSClosure.RDFS_Semantics.one_time_rules RDFClosure.RDFSClosure.RDFS_Semantics-class.html#one_time_rules RDFClosure.Closure.Core.axioms RDFClosure.Closure.Core-class.html#axioms RDFClosure.Closure.Core.daxioms RDFClosure.Closure.Core-class.html#daxioms RDFClosure.Closure.Core.literal_proxies RDFClosure.Closure.Core-class.html#literal_proxies RDFClosure.Closure.Core.added_triples RDFClosure.Closure.Core-class.html#added_triples RDFClosure.Closure.Core.get_literal_value RDFClosure.Closure.Core-class.html#get_literal_value RDFClosure.Closure.Core.post_process RDFClosure.Closure.Core-class.html#post_process RDFClosure.Closure.Core.error_messages RDFClosure.Closure.Core-class.html#error_messages RDFClosure.RDFSClosure.RDFS_Semantics.add_axioms RDFClosure.RDFSClosure.RDFS_Semantics-class.html#add_axioms RDFClosure.RDFSClosure.RDFS_Semantics.__init__ RDFClosure.RDFSClosure.RDFS_Semantics-class.html#__init__ RDFClosure.Closure.Core.add_error RDFClosure.Closure.Core-class.html#add_error RDFClosure.RestrictedDatatype.RestrictedDatatype RDFClosure.RestrictedDatatype.RestrictedDatatype-class.html RDFClosure.RestrictedDatatype.RestrictedDatatype.minExclusive RDFClosure.RestrictedDatatype.RestrictedDatatype-class.html#minExclusive RDFClosure.RestrictedDatatype.RestrictedDatatype._check_min_exclusive RDFClosure.RestrictedDatatype.RestrictedDatatype-class.html#_check_min_exclusive RDFClosure.RestrictedDatatype.RestrictedDatatype._check_min_length RDFClosure.RestrictedDatatype.RestrictedDatatype-class.html#_check_min_length RDFClosure.RestrictedDatatype.RestrictedDatatype.minInclusive RDFClosure.RestrictedDatatype.RestrictedDatatype-class.html#minInclusive RDFClosure.RestrictedDatatype.RestrictedDatatype._check_length RDFClosure.RestrictedDatatype.RestrictedDatatype-class.html#_check_length RDFClosure.RestrictedDatatype.RestrictedDatatype._check_max_inclusive RDFClosure.RestrictedDatatype.RestrictedDatatype-class.html#_check_max_inclusive RDFClosure.RestrictedDatatype.RestrictedDatatype.__init__ RDFClosure.RestrictedDatatype.RestrictedDatatype-class.html#__init__ RDFClosure.RestrictedDatatype.RestrictedDatatype.pattern RDFClosure.RestrictedDatatype.RestrictedDatatype-class.html#pattern RDFClosure.RestrictedDatatype.RestrictedDatatype.base_type RDFClosure.RestrictedDatatype.RestrictedDatatype-class.html#base_type RDFClosure.RestrictedDatatype.RestrictedDatatype.check_methods RDFClosure.RestrictedDatatype.RestrictedDatatype-class.html#check_methods RDFClosure.RestrictedDatatype.RestrictedDatatype.maxExclusive RDFClosure.RestrictedDatatype.RestrictedDatatype-class.html#maxExclusive RDFClosure.RestrictedDatatype.RestrictedDatatype.checkValue RDFClosure.RestrictedDatatype.RestrictedDatatype-class.html#checkValue RDFClosure.RestrictedDatatype.RestrictedDatatype.maxInclusive RDFClosure.RestrictedDatatype.RestrictedDatatype-class.html#maxInclusive RDFClosure.RestrictedDatatype.RestrictedDatatype.minLength RDFClosure.RestrictedDatatype.RestrictedDatatype-class.html#minLength RDFClosure.RestrictedDatatype.RestrictedDatatype.maxLength RDFClosure.RestrictedDatatype.RestrictedDatatype-class.html#maxLength RDFClosure.RestrictedDatatype.RestrictedDatatype._check_max_length RDFClosure.RestrictedDatatype.RestrictedDatatype-class.html#_check_max_length RDFClosure.RestrictedDatatype.RestrictedDatatype.langRange RDFClosure.RestrictedDatatype.RestrictedDatatype-class.html#langRange RDFClosure.RestrictedDatatype.RestrictedDatatype._check_lang_range RDFClosure.RestrictedDatatype.RestrictedDatatype-class.html#_check_lang_range RDFClosure.RestrictedDatatype.RestrictedDatatype.converter RDFClosure.RestrictedDatatype.RestrictedDatatype-class.html#converter RDFClosure.RestrictedDatatype.RestrictedDatatypeCore.type_uri RDFClosure.RestrictedDatatype.RestrictedDatatypeCore-class.html#type_uri RDFClosure.RestrictedDatatype.RestrictedDatatype.datatype RDFClosure.RestrictedDatatype.RestrictedDatatype-class.html#datatype RDFClosure.RestrictedDatatype.RestrictedDatatype._check_pattern RDFClosure.RestrictedDatatype.RestrictedDatatype-class.html#_check_pattern RDFClosure.RestrictedDatatype.RestrictedDatatype.length RDFClosure.RestrictedDatatype.RestrictedDatatype-class.html#length RDFClosure.RestrictedDatatype.RestrictedDatatype._check_min_inclusive RDFClosure.RestrictedDatatype.RestrictedDatatype-class.html#_check_min_inclusive RDFClosure.RestrictedDatatype.RestrictedDatatype.toPython RDFClosure.RestrictedDatatype.RestrictedDatatype-class.html#toPython RDFClosure.RestrictedDatatype.RestrictedDatatype._check_max_exclusive RDFClosure.RestrictedDatatype.RestrictedDatatype-class.html#_check_max_exclusive RDFClosure.RestrictedDatatype.RestrictedDatatypeCore RDFClosure.RestrictedDatatype.RestrictedDatatypeCore-class.html RDFClosure.RestrictedDatatype.RestrictedDatatypeCore.toPython RDFClosure.RestrictedDatatype.RestrictedDatatypeCore-class.html#toPython RDFClosure.RestrictedDatatype.RestrictedDatatypeCore.checkValue RDFClosure.RestrictedDatatype.RestrictedDatatypeCore-class.html#checkValue RDFClosure.RestrictedDatatype.RestrictedDatatypeCore.base_type RDFClosure.RestrictedDatatype.RestrictedDatatypeCore-class.html#base_type RDFClosure.RestrictedDatatype.RestrictedDatatypeCore.__init__ RDFClosure.RestrictedDatatype.RestrictedDatatypeCore-class.html#__init__ RDFClosure.RestrictedDatatype.RestrictedDatatypeCore.type_uri RDFClosure.RestrictedDatatype.RestrictedDatatypeCore-class.html#type_uri OWL-RL-7.1.4/Doc_OLD/class-tree.html000066400000000000000000000175671504201166100166460ustar00rootroot00000000000000 Class Hierarchy
 
[hide private]
[frames] | no frames]
[ Module Hierarchy | Class Hierarchy ]

Class Hierarchy

OWL-RL-7.1.4/Doc_OLD/crarr.png000066400000000000000000000005241504201166100155160ustar00rootroot00000000000000PNG  IHDR eE,tEXtCreation TimeTue 22 Aug 2006 00:43:10 -0500` XtIME)} pHYsnu>gAMA aEPLTEðf4sW ЊrD`@bCܖX{`,lNo@xdE螊dƴ~TwvtRNS@fMIDATxc`@0&+(;; /EXؑ? n  b;'+Y#(r<"IENDB`OWL-RL-7.1.4/Doc_OLD/epydoc.css000066400000000000000000000366171504201166100157100ustar00rootroot00000000000000 /* Epydoc CSS Stylesheet * * This stylesheet can be used to customize the appearance of epydoc's * HTML output. * */ /* Default Colors & Styles * - Set the default foreground & background color with 'body'; and * link colors with 'a:link' and 'a:visited'. * - Use bold for decision list terms. * - The heading styles defined here are used for headings *within* * docstring descriptions. All headings used by epydoc itself use * either class='epydoc' or class='toc' (CSS styles for both * defined below). */ body { background: #ffffff; color: #000000; } a:link { color: #0000ff; } a:visited { color: #204080; } dt { font-weight: bold; } h1 { font-size: +140%; font-style: italic; font-weight: bold; background: #cccc99; /* #EFEBCE; #005a9c; */ color: white; margin-bottom: 0.5em; } h2 { font-size: +125%; font-style: italic; font-weight: bold; } h3 { font-size: +110%; font-style: italic; font-weight: normal; } code { font-size: 100%; } /* Page Header & Footer * - The standard page header consists of a navigation bar (with * pointers to standard pages such as 'home' and 'trees'); a * breadcrumbs list, which can be used to navigate to containing * classes or modules; options links, to show/hide private * variables and to show/hide frames; and a page title (using *

). The page title may be followed by a link to the * corresponding source code (using 'span.codelink'). * - The footer consists of a navigation bar, a timestamp, and a * pointer to epydoc's homepage. */ h1.epydoc { margin: 0; font-size: +140%; font-weight: bold; } h2.epydoc { font-size: +130%; font-weight: bold; } h3.epydoc { font-size: +115%; font-weight: bold; } td h3.epydoc { font-size: +115%; font-weight: bold; margin-bottom: 0; } table.navbar { background: #cccc99; color: #000000; border: 2px groove #c0d0d0; } table.navbar table { color: #000000; } th.navbar-select { background: #70b0ff; color: #000000; } table.navbar a { text-decoration: none; } table.navbar a:link { color: #0000ff; } table.navbar a:visited { color: #204080; } span.breadcrumbs { font-size: 85%; font-weight: bold; } span.options { font-size: 70%; } span.codelink { font-size: 85%; } td.footer { font-size: 85%; } /* Table Headers * - Each summary table and details section begins with a 'header' * row. This row contains a section title (marked by * 'span.table-header') as well as a show/hide private link * (marked by 'span.options', defined above). * - Summary tables that contain user-defined groups mark those * groups using 'group header' rows. */ td.table-header { background: #EFEBCE; color: #000000; border: 1px solid #608090; } td.table-header table { color: #000000; } td.table-header table a:link { color: #0000ff; } td.table-header table a:visited { color: #204080; } span.table-header { font-size: 120%; font-weight: bold; } th.group-header { background: #c0e0f8; color: #000000; text-align: left; font-style: italic; font-size: 115%; border: 1px solid #608090; } /* Summary Tables (functions, variables, etc) * - Each object is described by a single row of the table with * two cells. The left cell gives the object's type, and is * marked with 'code.summary-type'. The right cell gives the * object's name and a summary description. * - CSS styles for the table's header and group headers are * defined above, under 'Table Headers' */ table.summary { border-collapse: collapse; background: #e8f0f8; color: #000000; border: 1px solid #608090; margin-bottom: 0.5em; } td.summary { border: 1px solid #608090; } code.summary-type { font-size: 85%; } table.summary a:link { color: #0000ff; } table.summary a:visited { color: #204080; } /* Details Tables (functions, variables, etc) * - Each object is described in its own div. * - A single-row summary table w/ table-header is used as * a header for each details section (CSS style for table-header * is defined above, under 'Table Headers'). */ table.details { border-collapse: collapse; background: #e8f0f8; color: #000000; border: 1px solid #608090; margin: .2em 0 0 0; } table.details table { color: #000000; } table.details a:link { color: #0000ff; } table.details a:visited { color: #204080; } /* Fields */ dl.fields { margin-left: 2em; margin-top: 1em; margin-bottom: 1em; } dl.fields dd ul { margin-left: 0em; padding-left: 0em; } div.fields { margin-left: 2em; } div.fields p { margin-bottom: 0.5em; } /* Index tables (identifier index, term index, etc) * - link-index is used for indices containing lists of links * (namely, the identifier index & term index). * - index-where is used in link indices for the text indicating * the container/source for each link. * - metadata-index is used for indices containing metadata * extracted from fields (namely, the bug index & todo index). */ table.link-index { border-collapse: collapse; background: #e8f0f8; color: #000000; border: 1px solid #608090; } td.link-index { border-width: 0px; } table.link-index a:link { color: #0000ff; } table.link-index a:visited { color: #204080; } span.index-where { font-size: 70%; } table.metadata-index { border-collapse: collapse; background: #e8f0f8; color: #000000; border: 1px solid #608090; margin: .2em 0 0 0; } td.metadata-index { border-width: 1px; border-style: solid; } table.metadata-index a:link { color: #0000ff; } table.metadata-index a:visited { color: #204080; } /* Function signatures * - sig* is used for the signature in the details section. * - .summary-sig* is used for the signature in the summary * table, and when listing property accessor functions. * */ .sig-name { color: #006080; } .sig-arg { color: #008060; } .sig-default { color: #602000; } .summary-sig { font-family: monospace; } .summary-sig-name { color: #006080; font-weight: bold; } table.summary a.summary-sig-name:link { color: #006080; font-weight: bold; } table.summary a.summary-sig-name:visited { color: #006080; font-weight: bold; } .summary-sig-arg { color: #006040; } .summary-sig-default { color: #501800; } /* To render variables, classes etc. like functions */ table.summary .summary-name { color: #006080; font-weight: bold; font-family: monospace; } table.summary a.summary-name:link { color: #006080; font-weight: bold; font-family: monospace; } table.summary a.summary-name:visited { color: #006080; font-weight: bold; font-family: monospace; } /* Variable values * - In the 'variable details' sections, each varaible's value is * listed in a 'pre.variable' box. The width of this box is * restricted to 80 chars; if the value's repr is longer than * this it will be wrapped, using a backslash marked with * class 'variable-linewrap'. If the value's repr is longer * than 3 lines, the rest will be ellided; and an ellipsis * marker ('...' marked with 'variable-ellipsis') will be used. * - If the value is a string, its quote marks will be marked * with 'variable-quote'. * - If the variable is a regexp, it is syntax-highlighted using * the re* CSS classes. */ pre.variable { padding: .5em; margin: 0; background: #dce4ec; color: #000000; border: 1px solid #708890; } .variable-linewrap { color: #604000; font-weight: bold; } .variable-ellipsis { color: #604000; font-weight: bold; } .variable-quote { color: #604000; font-weight: bold; } .variable-group { color: #008000; font-weight: bold; } .variable-op { color: #604000; font-weight: bold; } .variable-string { color: #006030; } .variable-unknown { color: #a00000; font-weight: bold; } .re { color: #000000; } .re-char { color: #006030; } .re-op { color: #600000; } .re-group { color: #003060; } .re-ref { color: #404040; } /* Base tree * - Used by class pages to display the base class hierarchy. */ pre.base-tree { font-size: 80%; margin: 0; } /* Frames-based table of contents headers * - Consists of two frames: one for selecting modules; and * the other listing the contents of the selected module. * - h1.toc is used for each frame's heading * - h2.toc is used for subheadings within each frame. */ h1.toc { text-align: center; font-size: 105%; margin: 0; font-weight: bold; padding: 0; } h2.toc { font-size: 100%; font-weight: bold; margin: 0.5em 0 0 -0.3em; } /* Syntax Highlighting for Source Code * - doctest examples are displayed in a 'pre.py-doctest' block. * If the example is in a details table entry, then it will use * the colors specified by the 'table pre.py-doctest' line. * - Source code listings are displayed in a 'pre.py-src' block. * Each line is marked with 'span.py-line' (used to draw a line * down the left margin, separating the code from the line * numbers). Line numbers are displayed with 'span.py-lineno'. * The expand/collapse block toggle button is displayed with * 'a.py-toggle' (Note: the CSS style for 'a.py-toggle' should not * modify the font size of the text.) * - If a source code page is opened with an anchor, then the * corresponding code block will be highlighted. The code * block's header is highlighted with 'py-highlight-hdr'; and * the code block's body is highlighted with 'py-highlight'. * - The remaining py-* classes are used to perform syntax * highlighting (py-string for string literals, py-name for names, * etc.) */ pre.py-doctest { padding: .5em; margin: 1em; background: #e8f0f8; color: #000000; border: 1px solid #708890; } table pre.py-doctest { background: #dce4ec; color: #000000; } pre.py-src { border: 2px solid #000000; background: #f0f0f0; color: #000000; } .py-line { border-left: 2px solid #000000; margin-left: .2em; padding-left: .4em; } .py-lineno { font-style: italic; font-size: 90%; padding-left: .5em; } a.py-toggle { text-decoration: none; } div.py-highlight-hdr { border-top: 2px solid #000000; border-bottom: 2px solid #000000; background: #d8e8e8; } div.py-highlight { border-bottom: 2px solid #000000; background: #d0e0e0; } .py-prompt { color: #005050; font-weight: bold;} .py-more { color: #005050; font-weight: bold;} .py-string { color: #006030; } .py-comment { color: #003060; } .py-keyword { color: #600000; } .py-output { color: #404040; } .py-name { color: #000050; } .py-name:link { color: #000050 !important; } .py-name:visited { color: #000050 !important; } .py-number { color: #005000; } .py-defname { color: #000060; font-weight: bold; } .py-def-name { color: #000060; font-weight: bold; } .py-base-class { color: #000060; } .py-param { color: #000060; } .py-docstring { color: #006030; } .py-decorator { color: #804020; } /* Use this if you don't want links to names underlined: */ /*a.py-name { text-decoration: none; }*/ /* Graphs & Diagrams * - These CSS styles are used for graphs & diagrams generated using * Graphviz dot. 'img.graph-without-title' is used for bare * diagrams (to remove the border created by making the image * clickable). */ img.graph-without-title { border: none; } img.graph-with-title { border: 1px solid #000000; } span.graph-title { font-weight: bold; } span.graph-caption { } /* General-purpose classes * - 'p.indent-wrapped-lines' defines a paragraph whose first line * is not indented, but whose subsequent lines are. * - The 'nomargin-top' class is used to remove the top margin (e.g. * from lists). The 'nomargin' class is used to remove both the * top and bottom margin (but not the left or right margin -- * for lists, that would cause the bullets to disappear.) */ p.indent-wrapped-lines { padding: 0 0 0 7em; text-indent: -7em; margin: 0; } .nomargin-top { margin-top: 0; } .nomargin { margin-top: 0; margin-bottom: 0; } /* HTML Log */ div.log-block { padding: 0; margin: .5em 0 .5em 0; background: #e8f0f8; color: #000000; border: 1px solid #000000; } div.log-error { padding: .1em .3em .1em .3em; margin: 4px; background: #ffb0b0; color: #000000; border: 1px solid #000000; } div.log-warning { padding: .1em .3em .1em .3em; margin: 4px; background: #ffffb0; color: #000000; border: 1px solid #000000; } div.log-info { padding: .1em .3em .1em .3em; margin: 4px; background: #b0ffb0; color: #000000; border: 1px solid #000000; } h2.log-hdr { background: #70b0ff; color: #000000; margin: 0; padding: 0em 0.5em 0em 0.5em; border-bottom: 1px solid #000000; font-size: 110%; } p.log { font-weight: bold; margin: .5em 0 .5em 0; } tr.opt-changed { color: #000000; font-weight: bold; } tr.opt-default { color: #606060; } pre.log { margin: 0; padding: 0; padding-left: 1em; } OWL-RL-7.1.4/Doc_OLD/epydoc.js000066400000000000000000000245251504201166100155270ustar00rootroot00000000000000function toggle_private() { // Search for any private/public links on this page. Store // their old text in "cmd," so we will know what action to // take; and change their text to the opposite action. var cmd = "?"; var elts = document.getElementsByTagName("a"); for(var i=0; i...
"; elt.innerHTML = s; } } function toggle(id) { elt = document.getElementById(id+"-toggle"); if (elt.innerHTML == "-") collapse(id); else expand(id); return false; } function highlight(id) { var elt = document.getElementById(id+"-def"); if (elt) elt.className = "py-highlight-hdr"; var elt = document.getElementById(id+"-expanded"); if (elt) elt.className = "py-highlight"; var elt = document.getElementById(id+"-collapsed"); if (elt) elt.className = "py-highlight"; } function num_lines(s) { var n = 1; var pos = s.indexOf("\n"); while ( pos > 0) { n += 1; pos = s.indexOf("\n", pos+1); } return n; } // Collapse all blocks that mave more than `min_lines` lines. function collapse_all(min_lines) { var elts = document.getElementsByTagName("div"); for (var i=0; i 0) if (elt.id.substring(split, elt.id.length) == "-expanded") if (num_lines(elt.innerHTML) > min_lines) collapse(elt.id.substring(0, split)); } } function expandto(href) { var start = href.indexOf("#")+1; if (start != 0 && start != href.length) { if (href.substring(start, href.length) != "-") { collapse_all(4); pos = href.indexOf(".", start); while (pos != -1) { var id = href.substring(start, pos); expand(id); pos = href.indexOf(".", pos+1); } var id = href.substring(start, href.length); expand(id); highlight(id); } } } function kill_doclink(id) { var parent = document.getElementById(id); parent.removeChild(parent.childNodes.item(0)); } function auto_kill_doclink(ev) { if (!ev) var ev = window.event; if (!this.contains(ev.toElement)) { var parent = document.getElementById(this.parentID); parent.removeChild(parent.childNodes.item(0)); } } function doclink(id, name, targets_id) { var elt = document.getElementById(id); // If we already opened the box, then destroy it. // (This case should never occur, but leave it in just in case.) if (elt.childNodes.length > 1) { elt.removeChild(elt.childNodes.item(0)); } else { // The outer box: relative + inline positioning. var box1 = document.createElement("div"); box1.style.position = "relative"; box1.style.display = "inline"; box1.style.top = 0; box1.style.left = 0; // A shadow for fun var shadow = document.createElement("div"); shadow.style.position = "absolute"; shadow.style.left = "-1.3em"; shadow.style.top = "-1.3em"; shadow.style.background = "#404040"; // The inner box: absolute positioning. var box2 = document.createElement("div"); box2.style.position = "relative"; box2.style.border = "1px solid #a0a0a0"; box2.style.left = "-.2em"; box2.style.top = "-.2em"; box2.style.background = "white"; box2.style.padding = ".3em .4em .3em .4em"; box2.style.fontStyle = "normal"; box2.onmouseout=auto_kill_doclink; box2.parentID = id; // Get the targets var targets_elt = document.getElementById(targets_id); var targets = targets_elt.getAttribute("targets"); var links = ""; target_list = targets.split(","); for (var i=0; i" + target[0] + ""; } // Put it all together. elt.insertBefore(box1, elt.childNodes.item(0)); //box1.appendChild(box2); box1.appendChild(shadow); shadow.appendChild(box2); box2.innerHTML = "Which "+name+" do you want to see documentation for?" + ""; } return false; } function get_anchor() { var href = location.href; var start = href.indexOf("#")+1; if ((start != 0) && (start != href.length)) return href.substring(start, href.length); } function redirect_url(dottedName) { // Scan through each element of the "pages" list, and check // if "name" matches with any of them. for (var i=0; i-m" or "-c"; // extract the portion & compare it to dottedName. var pagename = pages[i].substring(0, pages[i].length-2); if (pagename == dottedName.substring(0,pagename.length)) { // We've found a page that matches `dottedName`; // construct its URL, using leftover `dottedName` // content to form an anchor. var pagetype = pages[i].charAt(pages[i].length-1); var url = pagename + ((pagetype=="m")?"-module.html": "-class.html"); if (dottedName.length > pagename.length) url += "#" + dottedName.substring(pagename.length+1, dottedName.length); return url; } } } OWL-RL-7.1.4/Doc_OLD/frames.html000066400000000000000000000011201504201166100160330ustar00rootroot00000000000000 API Documentation OWL-RL-7.1.4/Doc_OLD/help.html000066400000000000000000000247371504201166100155310ustar00rootroot00000000000000 Help
 
[hide private]
[frames] | no frames]

API Documentation

This document contains the API (Application Programming Interface) documentation for this project. Documentation for the Python objects defined by the project is divided into separate pages for each package, module, and class. The API documentation also includes two pages containing information about the project as a whole: a trees page, and an index page.

Object Documentation

Each Package Documentation page contains:

  • A description of the package.
  • A list of the modules and sub-packages contained by the package.
  • A summary of the classes defined by the package.
  • A summary of the functions defined by the package.
  • A summary of the variables defined by the package.
  • A detailed description of each function defined by the package.
  • A detailed description of each variable defined by the package.

Each Module Documentation page contains:

  • A description of the module.
  • A summary of the classes defined by the module.
  • A summary of the functions defined by the module.
  • A summary of the variables defined by the module.
  • A detailed description of each function defined by the module.
  • A detailed description of each variable defined by the module.

Each Class Documentation page contains:

  • A class inheritance diagram.
  • A list of known subclasses.
  • A description of the class.
  • A summary of the methods defined by the class.
  • A summary of the instance variables defined by the class.
  • A summary of the class (static) variables defined by the class.
  • A detailed description of each method defined by the class.
  • A detailed description of each instance variable defined by the class.
  • A detailed description of each class (static) variable defined by the class.

Project Documentation

The Trees page contains the module and class hierarchies:

  • The module hierarchy lists every package and module, with modules grouped into packages. At the top level, and within each package, modules and sub-packages are listed alphabetically.
  • The class hierarchy lists every class, grouped by base class. If a class has more than one base class, then it will be listed under each base class. At the top level, and under each base class, classes are listed alphabetically.

The Index page contains indices of terms and identifiers:

  • The term index lists every term indexed by any object's documentation. For each term, the index provides links to each place where the term is indexed.
  • The identifier index lists the (short) name of every package, module, class, method, function, variable, and parameter. For each identifier, the index provides a short description, and a link to its documentation.

The Table of Contents

The table of contents occupies the two frames on the left side of the window. The upper-left frame displays the project contents, and the lower-left frame displays the module contents:

Project
Contents
...
API
Documentation
Frame


Module
Contents
 
...
 

The project contents frame contains a list of all packages and modules that are defined by the project. Clicking on an entry will display its contents in the module contents frame. Clicking on a special entry, labeled "Everything," will display the contents of the entire project.

The module contents frame contains a list of every submodule, class, type, exception, function, and variable defined by a module or package. Clicking on an entry will display its documentation in the API documentation frame. Clicking on the name of the module, at the top of the frame, will display the documentation for the module itself.

The "frames" and "no frames" buttons below the top navigation bar can be used to control whether the table of contents is displayed or not.

The Navigation Bar

A navigation bar is located at the top and bottom of every page. It indicates what type of page you are currently viewing, and allows you to go to related pages. The following table describes the labels on the navigation bar. Note that not some labels (such as [Parent]) are not displayed on all pages.

Label Highlighted when... Links to...
[Parent] (never highlighted) the parent of the current package
[Package] viewing a package the package containing the current object
[Module] viewing a module the module containing the current object
[Class] viewing a class the class containing the current object
[Trees] viewing the trees page the trees page
[Index] viewing the index page the index page
[Help] viewing the help page the help page

The "show private" and "hide private" buttons below the top navigation bar can be used to control whether documentation for private objects is displayed. Private objects are usually defined as objects whose (short) names begin with a single underscore, but do not end with an underscore. For example, "_x", "__pprint", and "epydoc.epytext._tokenize" are private objects; but "re.sub", "__init__", and "type_" are not. However, if a module defines the "__all__" variable, then its contents are used to decide which objects are private.

A timestamp below the bottom navigation bar indicates when each page was last updated.

OWL-RL-7.1.4/Doc_OLD/identifier-index.html000066400000000000000000005371261504201166100200310ustar00rootroot00000000000000 Identifier Index
 
[hide private]
[frames] | no frames]

Identifier Index

[ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z _ ]

A

B

C

D

E

F

G

H

I

J

L

M

N

O

P

Q

R

S

T

U

V

W

X

_



OWL-RL-7.1.4/Doc_OLD/index.html000066400000000000000000000011201504201166100156650ustar00rootroot00000000000000 API Documentation OWL-RL-7.1.4/Doc_OLD/module-tree.html000066400000000000000000000146711504201166100170170ustar00rootroot00000000000000 Module Hierarchy
 
[hide private]
[frames] | no frames]
[ Module Hierarchy | Class Hierarchy ]

Module Hierarchy

OWL-RL-7.1.4/Doc_OLD/redirect.html000066400000000000000000000035131504201166100163670ustar00rootroot00000000000000Epydoc Redirect Page

Epydoc Auto-redirect page

When javascript is enabled, this page will redirect URLs of the form redirect.html#dotted.name to the documentation for the object with the given fully-qualified dotted name.

 

OWL-RL-7.1.4/Doc_OLD/toc-RDFClosure-module.html000066400000000000000000000054251504201166100206100ustar00rootroot00000000000000 RDFClosure

Module RDFClosure


Classes

DeductiveClosure

Functions

convert_graph
interpret_owl_imports
return_closure_class

Variables

AUTO
FULL
JSON
NONE
OWL
RDF
RDFA
RDFS
RDFXML
TURTLE
__author__
__license__
__package__
json_ld_available

[hide private] OWL-RL-7.1.4/Doc_OLD/toc-RDFClosure.AxiomaticTriples-module.html000066400000000000000000000316701504201166100240710ustar00rootroot00000000000000 AxiomaticTriples

Module AxiomaticTriples


Variables

AllDifferent
AllDisjointClasses
AllDisjointProperties
Annotation
AnnotationProperty
AsymmetricProperty
Axiom
BottomDataProperty
BottomObjectProperty
DataRange
DatatypeProperty
DeprecatedClass
DeprecatedProperty
FunctionalProperty
InverseFunctionalProperty
IrreflexiveProperty
NamedIndividual
NegativePropertyAssertion
Nothing
OWLClass
OWLNS
OWLRL_Axiomatic_Triples
OWLRL_D_Axiomatic_Triples
OWLRL_Datatypes_Disjointness
OWL_D_Axiomatic_Triples_subclasses
OWLpredicate
OWLsubject
ObjectProperty
Ontology
OntologyProperty
RDFS_Axiomatic_Triples
RDFS_D_Axiomatic_Triples
RDFS_D_Axiomatic_Triples_subclasses
RDFS_D_Axiomatic_Triples_types
ReflexiveProperty
Restriction
SelfRestriction
SymmetricProperty
Thing
TopDataProperty
TopObjectProperty
TransitiveProperty
__author__
__license__
__package__
allValuesFrom
annotatedProperty
annotatedSource
annotatedTarget
assertionProperty
backwardCompatibleWith
cardinality
complementOf
datatypeComplementOf
deprecated
differentFrom
disjointClasses
disjointUnionOf
disjointWith
distinctMembers
equivalentClass
equivalentProperty
hasKey
hasSelf
hasValue
imports
incompatibleWith
intersectionOf
inverseOf
maxCardinality
maxQualifiedCardinality
members
minCardinality
minQualifiedCardinality
onClass
onDataRange
onDatatype
onProperties
onProperty
oneOf
priorVersion
propertyChainAxiom
propertyDisjointWith
qualifiedCardinality
sameAs
someValuesFrom
sourceIndividual
targetIndividual
targetValue
unionOf
versionIRI
versionInfo
withRestrictions

[hide private] OWL-RL-7.1.4/Doc_OLD/toc-RDFClosure.Closure-module.html000066400000000000000000000031541504201166100222200ustar00rootroot00000000000000 Closure

Module Closure


Classes

Core

Variables

__author__
__license__
__package__
debugGlobal
offlineGeneration

[hide private] OWL-RL-7.1.4/Doc_OLD/toc-RDFClosure.CombinedClosure-module.html000066400000000000000000000027421504201166100236630ustar00rootroot00000000000000 CombinedClosure

Module CombinedClosure


Classes

RDFS_OWLRL_Semantics

Variables

__author__
__license__
__package__

[hide private] OWL-RL-7.1.4/Doc_OLD/toc-RDFClosure.DatatypeHandling-module.html000066400000000000000000000200111504201166100240130ustar00rootroot00000000000000 DatatypeHandling

Module DatatypeHandling


Classes

Functions

use_Alt_lexical_conversions
use_RDFLib_lexical_conversions

Variables

AltXSDToPYTHON
__author__
__license__
__package__

[hide private] OWL-RL-7.1.4/Doc_OLD/toc-RDFClosure.Literals-module.html000066400000000000000000000031001504201166100223520ustar00rootroot00000000000000 Literals

Module Literals


Classes

LiteralProxies

Variables

__author__
__license__
__package__

[hide private] OWL-RL-7.1.4/Doc_OLD/toc-RDFClosure.OWL'-module.html000066400000000000000000000232741504201166100213210ustar00rootroot00000000000000 OWL'

Module OWL'


Variables

AllDifferent
AllDisjointClasses
AllDisjointProperties
Annotation
AnnotationProperty
AsymmetricProperty
Axiom
BottomDataProperty
BottomObjectProperty
DataRange
DatatypeProperty
DeprecatedClass
DeprecatedProperty
FunctionalProperty
InverseFunctionalProperty
IrreflexiveProperty
NamedIndividual
NegativePropertyAssertion
Nothing
OWLClass
OWLNS
OWLpredicate
OWLsubject
ObjectProperty
Ontology
OntologyProperty
ReflexiveProperty
Restriction
SelfRestriction
SymmetricProperty
Thing
TopDataProperty
TopObjectProperty
TransitiveProperty
__package__
allValuesFrom
annotatedProperty
annotatedSource
annotatedTarget
assertionProperty
backwardCompatibleWith
cardinality
complementOf
datatypeComplementOf
deprecated
differentFrom
disjointClasses
disjointUnionOf
disjointWith
distinctMembers
equivalentClass
equivalentProperty
hasKey
hasSelf
hasValue
imports
incompatibleWith
intersectionOf
inverseOf
maxCardinality
maxQualifiedCardinality
members
minCardinality
minQualifiedCardinality
onClass
onDataRange
onDatatype
onProperties
onProperty
oneOf
priorVersion
propertyChainAxiom
propertyDisjointWith
qualifiedCardinality
sameAs
someValuesFrom
sourceIndividual
targetIndividual
targetValue
unionOf
versionIRI
versionInfo
withRestrictions

[hide private] OWL-RL-7.1.4/Doc_OLD/toc-RDFClosure.OWLRL-module.html000066400000000000000000000241031504201166100215000ustar00rootroot00000000000000 OWLRL

Module OWLRL


Classes

OWLRL_Semantics

Variables

AllDifferent
AllDisjointClasses
AllDisjointProperties
Annotation
AnnotationProperty
AsymmetricProperty
Axiom
BottomDataProperty
BottomObjectProperty
DataRange
DatatypeProperty
DeprecatedClass
DeprecatedProperty
FunctionalProperty
InverseFunctionalProperty
IrreflexiveProperty
NamedIndividual
NegativePropertyAssertion
Nothing
OWLClass
OWLNS
OWLRL_Annotation_properties
OWLpredicate
OWLsubject
ObjectProperty
Ontology
OntologyProperty
ReflexiveProperty
Restriction
SelfRestriction
SymmetricProperty
Thing
TopDataProperty
TopObjectProperty
TransitiveProperty
__author__
__license__
__package__
allValuesFrom
annotatedProperty
annotatedSource
annotatedTarget
assertionProperty
backwardCompatibleWith
cardinality
complementOf
datatypeComplementOf
deprecated
differentFrom
disjointClasses
disjointUnionOf
disjointWith
distinctMembers
equivalentClass
equivalentProperty
hasKey
hasSelf
hasValue
imports
incompatibleWith
intersectionOf
inverseOf
maxCardinality
maxQualifiedCardinality
members
minCardinality
minQualifiedCardinality
onClass
onDataRange
onDatatype
onProperties
onProperty
oneOf
priorVersion
propertyChainAxiom
propertyDisjointWith
qualifiedCardinality
sameAs
someValuesFrom
sourceIndividual
targetIndividual
targetValue
unionOf
versionIRI
versionInfo
withRestrictions

[hide private] OWL-RL-7.1.4/Doc_OLD/toc-RDFClosure.OWLRLExtras-module.html000066400000000000000000000303511504201166100226710ustar00rootroot00000000000000 OWLRLExtras

Module OWLRLExtras


Classes

OWLRL_Extension
OWLRL_Extension_Trimming

Functions

Variables

AllDifferent
AllDisjointClasses
AllDisjointProperties
AltXSDToPYTHON
Annotation
AnnotationProperty
AsymmetricProperty
Axiom
BottomDataProperty
BottomObjectProperty
Class
DataRange
Datatype
DatatypeProperty
DeprecatedClass
DeprecatedProperty
FunctionalProperty
InverseFunctionalProperty
IrreflexiveProperty
NamedIndividual
NegativePropertyAssertion
Nothing
OWLClass
OWLNS
OWLRL_Annotation_properties
OWL_Datatype_Subsumptions
OWL_RL_Datatypes
OWLpredicate
OWLsubject
ObjectProperty
Ontology
OntologyProperty
Property
ReflexiveProperty
Resource
Restriction
SelfRestriction
SymmetricProperty
Thing
TopDataProperty
TopObjectProperty
TransitiveProperty
__author__
__license__
__package__
allValuesFrom
annotatedProperty
annotatedSource
annotatedTarget
assertionProperty
backwardCompatibleWith
cardinality
complementOf
datatypeComplementOf
deprecated
differentFrom
disjointClasses
disjointUnionOf
disjointWith
distinctMembers
domain
equivalentClass
equivalentProperty
hasKey
hasSelf
hasValue
imports
incompatibleWith
intersectionOf
inverseOf
maxCardinality
maxQualifiedCardinality
members
minCardinality
minQualifiedCardinality
ns_owl
ns_xsd
onClass
onDataRange
onDatatype
onProperties
onProperty
oneOf
priorVersion
propertyChainAxiom
propertyDisjointWith
qualifiedCardinality
rdfType
sameAs
someValuesFrom
sourceIndividual
subClassOf
subPropertyOf
targetIndividual
targetValue
unionOf
versionIRI
versionInfo
withRestrictions

[hide private] OWL-RL-7.1.4/Doc_OLD/toc-RDFClosure.RDFS'-module.html000066400000000000000000000103771504201166100214160ustar00rootroot00000000000000 RDFS'

Module RDFS'


Variables

Alt
Bag
Class
Container
ContainerMembershipProperty
Datatype
HTMLLiteral
LangString
List
Literal
Property
RDFNS
RDFSNS
Resource
Seq
Statement
XMLLiteral
__package__
comment
domain
first
isDefinedBy
label
member
nil
object
predicate
range
rest
seeAlso
subClassOf
subPropertyOf
subject
type
value

[hide private] OWL-RL-7.1.4/Doc_OLD/toc-RDFClosure.RDFSClosure-module.html000066400000000000000000000026761504201166100227070ustar00rootroot00000000000000 RDFSClosure

Module RDFSClosure


Classes

RDFS_Semantics

Variables

__author__
__license__
__package__

[hide private] OWL-RL-7.1.4/Doc_OLD/toc-RDFClosure.RestrictedDatatype-module.html000066400000000000000000000306061504201166100244120ustar00rootroot00000000000000 RestrictedDatatype

Module RestrictedDatatype


Classes

RestrictedDatatype
RestrictedDatatypeCore

Functions

extract_faceted_datatypes

Variables

AllDifferent
AllDisjointClasses
AllDisjointProperties
Annotation
AnnotationProperty
AsymmetricProperty
Axiom
BottomDataProperty
BottomObjectProperty
DataRange
DatatypeProperty
Datatypes_per_facets
DeprecatedClass
DeprecatedProperty
FunctionalProperty
InverseFunctionalProperty
IrreflexiveProperty
LENGTH
LENGTH_AND_PATTERN
LENGTH_PATTERN_LRANGE
MIN_MAX
NamedIndividual
NegativePropertyAssertion
Nothing
OWLClass
OWLNS
OWLpredicate
OWLsubject
ObjectProperty
Ontology
OntologyProperty
ReflexiveProperty
Restriction
SelfRestriction
SymmetricProperty
Thing
TopDataProperty
TopObjectProperty
TransitiveProperty
__author__
__license__
__package__
allValuesFrom
annotatedProperty
annotatedSource
annotatedTarget
assertionProperty
backwardCompatibleWith
cardinality
complementOf
datatypeComplementOf
deprecated
differentFrom
disjointClasses
disjointUnionOf
disjointWith
distinctMembers
equivalentClass
equivalentProperty
facetable_datatypes
hasKey
hasSelf
hasValue
imports
incompatibleWith
intersectionOf
inverseOf
maxCardinality
maxQualifiedCardinality
members
minCardinality
minQualifiedCardinality
onClass
onDataRange
onDatatype
onProperties
onProperty
oneOf
priorVersion
propertyChainAxiom
propertyDisjointWith
qualifiedCardinality
sameAs
someValuesFrom
sourceIndividual
targetIndividual
targetValue
unionOf
versionIRI
versionInfo
withRestrictions

[hide private] OWL-RL-7.1.4/Doc_OLD/toc-RDFClosure.XsdDatatypes-module.html000066400000000000000000000042001504201166100232120ustar00rootroot00000000000000 XsdDatatypes

Module XsdDatatypes


Variables

OWL_Datatype_Subsumptions
OWL_RL_Datatypes
RDFS_Datatype_Subsumptions
RDFS_Datatypes
__author__
__license__
__package__

[hide private] OWL-RL-7.1.4/Doc_OLD/toc-everything.html000066400000000000000000002432201504201166100175360ustar00rootroot00000000000000 Everything

Everything


All Classes

RDFClosure.Closure.Core
RDFClosure.CombinedClosure.RDFS_OWLRL_Semantics
RDFClosure.DeductiveClosure
RDFClosure.Literals.LiteralProxies
RDFClosure.OWLRL.OWLRL_Semantics
RDFClosure.OWLRLExtras.OWLRL_Extension
RDFClosure.OWLRLExtras.OWLRL_Extension_Trimming
RDFClosure.RDFSClosure.RDFS_Semantics
RDFClosure.RestrictedDatatype.RestrictedDatatype
RDFClosure.RestrictedDatatype.RestrictedDatatypeCore

All Functions

RDFClosure.DatatypeHandling.use_Alt_lexical_conversions
RDFClosure.DatatypeHandling.use_RDFLib_lexical_conversions
RDFClosure.RestrictedDatatype.extract_faceted_datatypes
RDFClosure.convert_graph
RDFClosure.interpret_owl_imports
RDFClosure.return_closure_class

All Variables

RDFClosure.AUTO
RDFClosure.AxiomaticTriples.AllDifferent
RDFClosure.AxiomaticTriples.AllDisjointClasses
RDFClosure.AxiomaticTriples.AllDisjointProperties
RDFClosure.AxiomaticTriples.Annotation
RDFClosure.AxiomaticTriples.AnnotationProperty
RDFClosure.AxiomaticTriples.AsymmetricProperty
RDFClosure.AxiomaticTriples.Axiom
RDFClosure.AxiomaticTriples.BottomDataProperty
RDFClosure.AxiomaticTriples.BottomObjectProperty
RDFClosure.AxiomaticTriples.DataRange
RDFClosure.AxiomaticTriples.DatatypeProperty
RDFClosure.AxiomaticTriples.DeprecatedClass
RDFClosure.AxiomaticTriples.DeprecatedProperty
RDFClosure.AxiomaticTriples.FunctionalProperty
RDFClosure.AxiomaticTriples.InverseFunctionalProperty
RDFClosure.AxiomaticTriples.IrreflexiveProperty
RDFClosure.AxiomaticTriples.NamedIndividual
RDFClosure.AxiomaticTriples.NegativePropertyAssertion
RDFClosure.AxiomaticTriples.Nothing
RDFClosure.AxiomaticTriples.OWLClass
RDFClosure.AxiomaticTriples.OWLNS
RDFClosure.AxiomaticTriples.OWLRL_Axiomatic_Triples
RDFClosure.AxiomaticTriples.OWLRL_D_Axiomatic_Triples
RDFClosure.AxiomaticTriples.OWLRL_Datatypes_Disjointness
RDFClosure.AxiomaticTriples.OWL_D_Axiomatic_Triples_subclasses
RDFClosure.AxiomaticTriples.OWLpredicate
RDFClosure.AxiomaticTriples.OWLsubject
RDFClosure.AxiomaticTriples.ObjectProperty
RDFClosure.AxiomaticTriples.Ontology
RDFClosure.AxiomaticTriples.OntologyProperty
RDFClosure.AxiomaticTriples.RDFS_Axiomatic_Triples
RDFClosure.AxiomaticTriples.RDFS_D_Axiomatic_Triples
RDFClosure.AxiomaticTriples.RDFS_D_Axiomatic_Triples_subclasses
RDFClosure.AxiomaticTriples.RDFS_D_Axiomatic_Triples_types
RDFClosure.AxiomaticTriples.ReflexiveProperty
RDFClosure.AxiomaticTriples.Restriction
RDFClosure.AxiomaticTriples.SelfRestriction
RDFClosure.AxiomaticTriples.SymmetricProperty
RDFClosure.AxiomaticTriples.Thing
RDFClosure.AxiomaticTriples.TopDataProperty
RDFClosure.AxiomaticTriples.TopObjectProperty
RDFClosure.AxiomaticTriples.TransitiveProperty
RDFClosure.AxiomaticTriples.__author__
RDFClosure.AxiomaticTriples.__license__
RDFClosure.AxiomaticTriples.__package__
RDFClosure.AxiomaticTriples.allValuesFrom
RDFClosure.AxiomaticTriples.annotatedProperty
RDFClosure.AxiomaticTriples.annotatedSource
RDFClosure.AxiomaticTriples.annotatedTarget
RDFClosure.AxiomaticTriples.assertionProperty
RDFClosure.AxiomaticTriples.backwardCompatibleWith
RDFClosure.AxiomaticTriples.cardinality
RDFClosure.AxiomaticTriples.complementOf
RDFClosure.AxiomaticTriples.datatypeComplementOf
RDFClosure.AxiomaticTriples.deprecated
RDFClosure.AxiomaticTriples.differentFrom
RDFClosure.AxiomaticTriples.disjointClasses
RDFClosure.AxiomaticTriples.disjointUnionOf
RDFClosure.AxiomaticTriples.disjointWith
RDFClosure.AxiomaticTriples.distinctMembers
RDFClosure.AxiomaticTriples.equivalentClass
RDFClosure.AxiomaticTriples.equivalentProperty
RDFClosure.AxiomaticTriples.hasKey
RDFClosure.AxiomaticTriples.hasSelf
RDFClosure.AxiomaticTriples.hasValue
RDFClosure.AxiomaticTriples.imports
RDFClosure.AxiomaticTriples.incompatibleWith
RDFClosure.AxiomaticTriples.intersectionOf
RDFClosure.AxiomaticTriples.inverseOf
RDFClosure.AxiomaticTriples.maxCardinality
RDFClosure.AxiomaticTriples.maxQualifiedCardinality
RDFClosure.AxiomaticTriples.members
RDFClosure.AxiomaticTriples.minCardinality
RDFClosure.AxiomaticTriples.minQualifiedCardinality
RDFClosure.AxiomaticTriples.onClass
RDFClosure.AxiomaticTriples.onDataRange
RDFClosure.AxiomaticTriples.onDatatype
RDFClosure.AxiomaticTriples.onProperties
RDFClosure.AxiomaticTriples.onProperty
RDFClosure.AxiomaticTriples.oneOf
RDFClosure.AxiomaticTriples.priorVersion
RDFClosure.AxiomaticTriples.propertyChainAxiom
RDFClosure.AxiomaticTriples.propertyDisjointWith
RDFClosure.AxiomaticTriples.qualifiedCardinality
RDFClosure.AxiomaticTriples.sameAs
RDFClosure.AxiomaticTriples.someValuesFrom
RDFClosure.AxiomaticTriples.sourceIndividual
RDFClosure.AxiomaticTriples.targetIndividual
RDFClosure.AxiomaticTriples.targetValue
RDFClosure.AxiomaticTriples.unionOf
RDFClosure.AxiomaticTriples.versionIRI
RDFClosure.AxiomaticTriples.versionInfo
RDFClosure.AxiomaticTriples.withRestrictions
RDFClosure.Closure.__author__
RDFClosure.Closure.__license__
RDFClosure.Closure.__package__
RDFClosure.Closure.debugGlobal
RDFClosure.Closure.offlineGeneration
RDFClosure.CombinedClosure.__author__
RDFClosure.CombinedClosure.__license__
RDFClosure.CombinedClosure.__package__
RDFClosure.DatatypeHandling.AltXSDToPYTHON
RDFClosure.DatatypeHandling.__author__
RDFClosure.DatatypeHandling.__license__
RDFClosure.DatatypeHandling.__package__
RDFClosure.FULL
RDFClosure.JSON
RDFClosure.Literals.__author__
RDFClosure.Literals.__license__
RDFClosure.Literals.__package__
RDFClosure.NONE
RDFClosure.OWL
RDFClosure.OWL'.AllDifferent
RDFClosure.OWL'.AllDisjointClasses
RDFClosure.OWL'.AllDisjointProperties
RDFClosure.OWL'.Annotation
RDFClosure.OWL'.AnnotationProperty
RDFClosure.OWL'.AsymmetricProperty
RDFClosure.OWL'.Axiom
RDFClosure.OWL'.BottomDataProperty
RDFClosure.OWL'.BottomObjectProperty
RDFClosure.OWL'.DataRange
RDFClosure.OWL'.DatatypeProperty
RDFClosure.OWL'.DeprecatedClass
RDFClosure.OWL'.DeprecatedProperty
RDFClosure.OWL'.FunctionalProperty
RDFClosure.OWL'.InverseFunctionalProperty
RDFClosure.OWL'.IrreflexiveProperty
RDFClosure.OWL'.NamedIndividual
RDFClosure.OWL'.NegativePropertyAssertion
RDFClosure.OWL'.Nothing
RDFClosure.OWL'.OWLClass
RDFClosure.OWL'.OWLNS
RDFClosure.OWL'.OWLpredicate
RDFClosure.OWL'.OWLsubject
RDFClosure.OWL'.ObjectProperty
RDFClosure.OWL'.Ontology
RDFClosure.OWL'.OntologyProperty
RDFClosure.OWL'.ReflexiveProperty
RDFClosure.OWL'.Restriction
RDFClosure.OWL'.SelfRestriction
RDFClosure.OWL'.SymmetricProperty
RDFClosure.OWL'.Thing
RDFClosure.OWL'.TopDataProperty
RDFClosure.OWL'.TopObjectProperty
RDFClosure.OWL'.TransitiveProperty
RDFClosure.OWL'.__package__
RDFClosure.OWL'.allValuesFrom
RDFClosure.OWL'.annotatedProperty
RDFClosure.OWL'.annotatedSource
RDFClosure.OWL'.annotatedTarget
RDFClosure.OWL'.assertionProperty
RDFClosure.OWL'.backwardCompatibleWith
RDFClosure.OWL'.cardinality
RDFClosure.OWL'.complementOf
RDFClosure.OWL'.datatypeComplementOf
RDFClosure.OWL'.deprecated
RDFClosure.OWL'.differentFrom
RDFClosure.OWL'.disjointClasses
RDFClosure.OWL'.disjointUnionOf
RDFClosure.OWL'.disjointWith
RDFClosure.OWL'.distinctMembers
RDFClosure.OWL'.equivalentClass
RDFClosure.OWL'.equivalentProperty
RDFClosure.OWL'.hasKey
RDFClosure.OWL'.hasSelf
RDFClosure.OWL'.hasValue
RDFClosure.OWL'.imports
RDFClosure.OWL'.incompatibleWith
RDFClosure.OWL'.intersectionOf
RDFClosure.OWL'.inverseOf
RDFClosure.OWL'.maxCardinality
RDFClosure.OWL'.maxQualifiedCardinality
RDFClosure.OWL'.members
RDFClosure.OWL'.minCardinality
RDFClosure.OWL'.minQualifiedCardinality
RDFClosure.OWL'.onClass
RDFClosure.OWL'.onDataRange
RDFClosure.OWL'.onDatatype
RDFClosure.OWL'.onProperties
RDFClosure.OWL'.onProperty
RDFClosure.OWL'.oneOf
RDFClosure.OWL'.priorVersion
RDFClosure.OWL'.propertyChainAxiom
RDFClosure.OWL'.propertyDisjointWith
RDFClosure.OWL'.qualifiedCardinality
RDFClosure.OWL'.sameAs
RDFClosure.OWL'.someValuesFrom
RDFClosure.OWL'.sourceIndividual
RDFClosure.OWL'.targetIndividual
RDFClosure.OWL'.targetValue
RDFClosure.OWL'.unionOf
RDFClosure.OWL'.versionIRI
RDFClosure.OWL'.versionInfo
RDFClosure.OWL'.withRestrictions
RDFClosure.OWLRL.AllDifferent
RDFClosure.OWLRL.AllDisjointClasses
RDFClosure.OWLRL.AllDisjointProperties
RDFClosure.OWLRL.Annotation
RDFClosure.OWLRL.AnnotationProperty
RDFClosure.OWLRL.AsymmetricProperty
RDFClosure.OWLRL.Axiom
RDFClosure.OWLRL.BottomDataProperty
RDFClosure.OWLRL.BottomObjectProperty
RDFClosure.OWLRL.DataRange
RDFClosure.OWLRL.DatatypeProperty
RDFClosure.OWLRL.DeprecatedClass
RDFClosure.OWLRL.DeprecatedProperty
RDFClosure.OWLRL.FunctionalProperty
RDFClosure.OWLRL.InverseFunctionalProperty
RDFClosure.OWLRL.IrreflexiveProperty
RDFClosure.OWLRL.NamedIndividual
RDFClosure.OWLRL.NegativePropertyAssertion
RDFClosure.OWLRL.Nothing
RDFClosure.OWLRL.OWLClass
RDFClosure.OWLRL.OWLNS
RDFClosure.OWLRL.OWLRL_Annotation_properties
RDFClosure.OWLRL.OWLpredicate
RDFClosure.OWLRL.OWLsubject
RDFClosure.OWLRL.ObjectProperty
RDFClosure.OWLRL.Ontology
RDFClosure.OWLRL.OntologyProperty
RDFClosure.OWLRL.ReflexiveProperty
RDFClosure.OWLRL.Restriction
RDFClosure.OWLRL.SelfRestriction
RDFClosure.OWLRL.SymmetricProperty
RDFClosure.OWLRL.Thing
RDFClosure.OWLRL.TopDataProperty
RDFClosure.OWLRL.TopObjectProperty
RDFClosure.OWLRL.TransitiveProperty
RDFClosure.OWLRL.__author__
RDFClosure.OWLRL.__license__
RDFClosure.OWLRL.__package__
RDFClosure.OWLRL.allValuesFrom
RDFClosure.OWLRL.annotatedProperty
RDFClosure.OWLRL.annotatedSource
RDFClosure.OWLRL.annotatedTarget
RDFClosure.OWLRL.assertionProperty
RDFClosure.OWLRL.backwardCompatibleWith
RDFClosure.OWLRL.cardinality
RDFClosure.OWLRL.complementOf
RDFClosure.OWLRL.datatypeComplementOf
RDFClosure.OWLRL.deprecated
RDFClosure.OWLRL.differentFrom
RDFClosure.OWLRL.disjointClasses
RDFClosure.OWLRL.disjointUnionOf
RDFClosure.OWLRL.disjointWith
RDFClosure.OWLRL.distinctMembers
RDFClosure.OWLRL.equivalentClass
RDFClosure.OWLRL.equivalentProperty
RDFClosure.OWLRL.hasKey
RDFClosure.OWLRL.hasSelf
RDFClosure.OWLRL.hasValue
RDFClosure.OWLRL.imports
RDFClosure.OWLRL.incompatibleWith
RDFClosure.OWLRL.intersectionOf
RDFClosure.OWLRL.inverseOf
RDFClosure.OWLRL.maxCardinality
RDFClosure.OWLRL.maxQualifiedCardinality
RDFClosure.OWLRL.members
RDFClosure.OWLRL.minCardinality
RDFClosure.OWLRL.minQualifiedCardinality
RDFClosure.OWLRL.onClass
RDFClosure.OWLRL.onDataRange
RDFClosure.OWLRL.onDatatype
RDFClosure.OWLRL.onProperties
RDFClosure.OWLRL.onProperty
RDFClosure.OWLRL.oneOf
RDFClosure.OWLRL.priorVersion
RDFClosure.OWLRL.propertyChainAxiom
RDFClosure.OWLRL.propertyDisjointWith
RDFClosure.OWLRL.qualifiedCardinality
RDFClosure.OWLRL.sameAs
RDFClosure.OWLRL.someValuesFrom
RDFClosure.OWLRL.sourceIndividual
RDFClosure.OWLRL.targetIndividual
RDFClosure.OWLRL.targetValue
RDFClosure.OWLRL.unionOf
RDFClosure.OWLRL.versionIRI
RDFClosure.OWLRL.versionInfo
RDFClosure.OWLRL.withRestrictions
RDFClosure.OWLRLExtras.AllDifferent
RDFClosure.OWLRLExtras.AllDisjointClasses
RDFClosure.OWLRLExtras.AllDisjointProperties
RDFClosure.OWLRLExtras.AltXSDToPYTHON
RDFClosure.OWLRLExtras.Annotation
RDFClosure.OWLRLExtras.AnnotationProperty
RDFClosure.OWLRLExtras.AsymmetricProperty
RDFClosure.OWLRLExtras.Axiom
RDFClosure.OWLRLExtras.BottomDataProperty
RDFClosure.OWLRLExtras.BottomObjectProperty
RDFClosure.OWLRLExtras.Class
RDFClosure.OWLRLExtras.DataRange
RDFClosure.OWLRLExtras.Datatype
RDFClosure.OWLRLExtras.DatatypeProperty
RDFClosure.OWLRLExtras.DeprecatedClass
RDFClosure.OWLRLExtras.DeprecatedProperty
RDFClosure.OWLRLExtras.FunctionalProperty
RDFClosure.OWLRLExtras.InverseFunctionalProperty
RDFClosure.OWLRLExtras.IrreflexiveProperty
RDFClosure.OWLRLExtras.NamedIndividual
RDFClosure.OWLRLExtras.NegativePropertyAssertion
RDFClosure.OWLRLExtras.Nothing
RDFClosure.OWLRLExtras.OWLClass
RDFClosure.OWLRLExtras.OWLNS
RDFClosure.OWLRLExtras.OWLRL_Annotation_properties
RDFClosure.OWLRLExtras.OWL_Datatype_Subsumptions
RDFClosure.OWLRLExtras.OWL_RL_Datatypes
RDFClosure.OWLRLExtras.OWLpredicate
RDFClosure.OWLRLExtras.OWLsubject
RDFClosure.OWLRLExtras.ObjectProperty
RDFClosure.OWLRLExtras.Ontology
RDFClosure.OWLRLExtras.OntologyProperty
RDFClosure.OWLRLExtras.Property
RDFClosure.OWLRLExtras.ReflexiveProperty
RDFClosure.OWLRLExtras.Resource
RDFClosure.OWLRLExtras.Restriction
RDFClosure.OWLRLExtras.SelfRestriction
RDFClosure.OWLRLExtras.SymmetricProperty
RDFClosure.OWLRLExtras.Thing
RDFClosure.OWLRLExtras.TopDataProperty
RDFClosure.OWLRLExtras.TopObjectProperty
RDFClosure.OWLRLExtras.TransitiveProperty
RDFClosure.OWLRLExtras.__author__
RDFClosure.OWLRLExtras.__license__
RDFClosure.OWLRLExtras.__package__
RDFClosure.OWLRLExtras.allValuesFrom
RDFClosure.OWLRLExtras.annotatedProperty
RDFClosure.OWLRLExtras.annotatedSource
RDFClosure.OWLRLExtras.annotatedTarget
RDFClosure.OWLRLExtras.assertionProperty
RDFClosure.OWLRLExtras.backwardCompatibleWith
RDFClosure.OWLRLExtras.cardinality
RDFClosure.OWLRLExtras.complementOf
RDFClosure.OWLRLExtras.datatypeComplementOf
RDFClosure.OWLRLExtras.deprecated
RDFClosure.OWLRLExtras.differentFrom
RDFClosure.OWLRLExtras.disjointClasses
RDFClosure.OWLRLExtras.disjointUnionOf
RDFClosure.OWLRLExtras.disjointWith
RDFClosure.OWLRLExtras.distinctMembers
RDFClosure.OWLRLExtras.domain
RDFClosure.OWLRLExtras.equivalentClass
RDFClosure.OWLRLExtras.equivalentProperty
RDFClosure.OWLRLExtras.hasKey
RDFClosure.OWLRLExtras.hasSelf
RDFClosure.OWLRLExtras.hasValue
RDFClosure.OWLRLExtras.imports
RDFClosure.OWLRLExtras.incompatibleWith
RDFClosure.OWLRLExtras.intersectionOf
RDFClosure.OWLRLExtras.inverseOf
RDFClosure.OWLRLExtras.maxCardinality
RDFClosure.OWLRLExtras.maxQualifiedCardinality
RDFClosure.OWLRLExtras.members
RDFClosure.OWLRLExtras.minCardinality
RDFClosure.OWLRLExtras.minQualifiedCardinality
RDFClosure.OWLRLExtras.ns_owl
RDFClosure.OWLRLExtras.ns_xsd
RDFClosure.OWLRLExtras.onClass
RDFClosure.OWLRLExtras.onDataRange
RDFClosure.OWLRLExtras.onDatatype
RDFClosure.OWLRLExtras.onProperties
RDFClosure.OWLRLExtras.onProperty
RDFClosure.OWLRLExtras.oneOf
RDFClosure.OWLRLExtras.priorVersion
RDFClosure.OWLRLExtras.propertyChainAxiom
RDFClosure.OWLRLExtras.propertyDisjointWith
RDFClosure.OWLRLExtras.qualifiedCardinality
RDFClosure.OWLRLExtras.rdfType
RDFClosure.OWLRLExtras.sameAs
RDFClosure.OWLRLExtras.someValuesFrom
RDFClosure.OWLRLExtras.sourceIndividual
RDFClosure.OWLRLExtras.subClassOf
RDFClosure.OWLRLExtras.subPropertyOf
RDFClosure.OWLRLExtras.targetIndividual
RDFClosure.OWLRLExtras.targetValue
RDFClosure.OWLRLExtras.unionOf
RDFClosure.OWLRLExtras.versionIRI
RDFClosure.OWLRLExtras.versionInfo
RDFClosure.OWLRLExtras.withRestrictions
RDFClosure.RDF
RDFClosure.RDFA
RDFClosure.RDFS
RDFClosure.RDFS'.Alt
RDFClosure.RDFS'.Bag
RDFClosure.RDFS'.Class
RDFClosure.RDFS'.Container
RDFClosure.RDFS'.ContainerMembershipProperty
RDFClosure.RDFS'.Datatype
RDFClosure.RDFS'.HTMLLiteral
RDFClosure.RDFS'.LangString
RDFClosure.RDFS'.List
RDFClosure.RDFS'.Literal
RDFClosure.RDFS'.Property
RDFClosure.RDFS'.RDFNS
RDFClosure.RDFS'.RDFSNS
RDFClosure.RDFS'.Resource
RDFClosure.RDFS'.Seq
RDFClosure.RDFS'.Statement
RDFClosure.RDFS'.XMLLiteral
RDFClosure.RDFS'.__package__
RDFClosure.RDFS'.comment
RDFClosure.RDFS'.domain
RDFClosure.RDFS'.first
RDFClosure.RDFS'.isDefinedBy
RDFClosure.RDFS'.label
RDFClosure.RDFS'.member
RDFClosure.RDFS'.nil
RDFClosure.RDFS'.object
RDFClosure.RDFS'.predicate
RDFClosure.RDFS'.range
RDFClosure.RDFS'.rest
RDFClosure.RDFS'.seeAlso
RDFClosure.RDFS'.subClassOf
RDFClosure.RDFS'.subPropertyOf
RDFClosure.RDFS'.subject
RDFClosure.RDFS'.type
RDFClosure.RDFS'.value
RDFClosure.RDFSClosure.__author__
RDFClosure.RDFSClosure.__license__
RDFClosure.RDFSClosure.__package__
RDFClosure.RDFXML
RDFClosure.RestrictedDatatype.AllDifferent
RDFClosure.RestrictedDatatype.AllDisjointClasses
RDFClosure.RestrictedDatatype.AllDisjointProperties
RDFClosure.RestrictedDatatype.Annotation
RDFClosure.RestrictedDatatype.AnnotationProperty
RDFClosure.RestrictedDatatype.AsymmetricProperty
RDFClosure.RestrictedDatatype.Axiom
RDFClosure.RestrictedDatatype.BottomDataProperty
RDFClosure.RestrictedDatatype.BottomObjectProperty
RDFClosure.RestrictedDatatype.DataRange
RDFClosure.RestrictedDatatype.DatatypeProperty
RDFClosure.RestrictedDatatype.Datatypes_per_facets
RDFClosure.RestrictedDatatype.DeprecatedClass
RDFClosure.RestrictedDatatype.DeprecatedProperty
RDFClosure.RestrictedDatatype.FunctionalProperty
RDFClosure.RestrictedDatatype.InverseFunctionalProperty
RDFClosure.RestrictedDatatype.IrreflexiveProperty
RDFClosure.RestrictedDatatype.LENGTH
RDFClosure.RestrictedDatatype.LENGTH_AND_PATTERN
RDFClosure.RestrictedDatatype.LENGTH_PATTERN_LRANGE
RDFClosure.RestrictedDatatype.MIN_MAX
RDFClosure.RestrictedDatatype.NamedIndividual
RDFClosure.RestrictedDatatype.NegativePropertyAssertion
RDFClosure.RestrictedDatatype.Nothing
RDFClosure.RestrictedDatatype.OWLClass
RDFClosure.RestrictedDatatype.OWLNS
RDFClosure.RestrictedDatatype.OWLpredicate
RDFClosure.RestrictedDatatype.OWLsubject
RDFClosure.RestrictedDatatype.ObjectProperty
RDFClosure.RestrictedDatatype.Ontology
RDFClosure.RestrictedDatatype.OntologyProperty
RDFClosure.RestrictedDatatype.ReflexiveProperty
RDFClosure.RestrictedDatatype.Restriction
RDFClosure.RestrictedDatatype.SelfRestriction
RDFClosure.RestrictedDatatype.SymmetricProperty
RDFClosure.RestrictedDatatype.Thing
RDFClosure.RestrictedDatatype.TopDataProperty
RDFClosure.RestrictedDatatype.TopObjectProperty
RDFClosure.RestrictedDatatype.TransitiveProperty
RDFClosure.RestrictedDatatype.__author__
RDFClosure.RestrictedDatatype.__license__
RDFClosure.RestrictedDatatype.__package__
RDFClosure.RestrictedDatatype.allValuesFrom
RDFClosure.RestrictedDatatype.annotatedProperty
RDFClosure.RestrictedDatatype.annotatedSource
RDFClosure.RestrictedDatatype.annotatedTarget
RDFClosure.RestrictedDatatype.assertionProperty
RDFClosure.RestrictedDatatype.backwardCompatibleWith
RDFClosure.RestrictedDatatype.cardinality
RDFClosure.RestrictedDatatype.complementOf
RDFClosure.RestrictedDatatype.datatypeComplementOf
RDFClosure.RestrictedDatatype.deprecated
RDFClosure.RestrictedDatatype.differentFrom
RDFClosure.RestrictedDatatype.disjointClasses
RDFClosure.RestrictedDatatype.disjointUnionOf
RDFClosure.RestrictedDatatype.disjointWith
RDFClosure.RestrictedDatatype.distinctMembers
RDFClosure.RestrictedDatatype.equivalentClass
RDFClosure.RestrictedDatatype.equivalentProperty
RDFClosure.RestrictedDatatype.facetable_datatypes
RDFClosure.RestrictedDatatype.hasKey
RDFClosure.RestrictedDatatype.hasSelf
RDFClosure.RestrictedDatatype.hasValue
RDFClosure.RestrictedDatatype.imports
RDFClosure.RestrictedDatatype.incompatibleWith
RDFClosure.RestrictedDatatype.intersectionOf
RDFClosure.RestrictedDatatype.inverseOf
RDFClosure.RestrictedDatatype.maxCardinality
RDFClosure.RestrictedDatatype.maxQualifiedCardinality
RDFClosure.RestrictedDatatype.members
RDFClosure.RestrictedDatatype.minCardinality
RDFClosure.RestrictedDatatype.minQualifiedCardinality
RDFClosure.RestrictedDatatype.onClass
RDFClosure.RestrictedDatatype.onDataRange
RDFClosure.RestrictedDatatype.onDatatype
RDFClosure.RestrictedDatatype.onProperties
RDFClosure.RestrictedDatatype.onProperty
RDFClosure.RestrictedDatatype.oneOf
RDFClosure.RestrictedDatatype.priorVersion
RDFClosure.RestrictedDatatype.propertyChainAxiom
RDFClosure.RestrictedDatatype.propertyDisjointWith
RDFClosure.RestrictedDatatype.qualifiedCardinality
RDFClosure.RestrictedDatatype.sameAs
RDFClosure.RestrictedDatatype.someValuesFrom
RDFClosure.RestrictedDatatype.sourceIndividual
RDFClosure.RestrictedDatatype.targetIndividual
RDFClosure.RestrictedDatatype.targetValue
RDFClosure.RestrictedDatatype.unionOf
RDFClosure.RestrictedDatatype.versionIRI
RDFClosure.RestrictedDatatype.versionInfo
RDFClosure.RestrictedDatatype.withRestrictions
RDFClosure.TURTLE
RDFClosure.XsdDatatypes.OWL_Datatype_Subsumptions
RDFClosure.XsdDatatypes.OWL_RL_Datatypes
RDFClosure.XsdDatatypes.RDFS_Datatype_Subsumptions
RDFClosure.XsdDatatypes.RDFS_Datatypes
RDFClosure.XsdDatatypes.__author__
RDFClosure.XsdDatatypes.__license__
RDFClosure.XsdDatatypes.__package__
RDFClosure.__author__
RDFClosure.__license__
RDFClosure.__package__
RDFClosure.json_ld_available

[hide private] OWL-RL-7.1.4/Doc_OLD/toc.html000066400000000000000000000074031504201166100153550ustar00rootroot00000000000000 Table of Contents

Table of Contents


Everything

Modules

RDFClosure
RDFClosure.AxiomaticTriples
RDFClosure.Closure
RDFClosure.CombinedClosure
RDFClosure.DatatypeHandling
RDFClosure.Literals
RDFClosure.OWL'
RDFClosure.OWLRL
RDFClosure.OWLRLExtras
RDFClosure.RDFS'
RDFClosure.RDFSClosure
RDFClosure.RestrictedDatatype
RDFClosure.XsdDatatypes

[hide private] OWL-RL-7.1.4/LICENSE.txt000066400000000000000000000033321504201166100143170ustar00rootroot00000000000000W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE License By obtaining and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions. Permission to copy, modify, and distribute this work, with or without modification, for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the work or portions thereof, including modifications: 1. The full text of this NOTICE in a location viewable to users of the redistributed or derivative work. 2. Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, the W3C Software and Document Short Notice should be included. 3. Notice of any changes or modifications, through a copyright statement on the new code or document such as "This software or document includes material copied from or derived from [title and URI of the W3C document]. Copyright © [YEAR] W3C® (MIT, ERCIM, Keio, Beihang)." Disclaimers THIS WORK IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENT WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENT. The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the work without specific, written prior permission. Title to copyright in this work will at all times remain with copyright holders. OWL-RL-7.1.4/MANIFEST.in000066400000000000000000000001341504201166100142270ustar00rootroot00000000000000include *.txt *.md *.rst include test/relatives.ttl recursive-include docs *.txt *.md *.rst OWL-RL-7.1.4/OWL-RL.png000066400000000000000000001256051504201166100141660ustar00rootroot00000000000000PNG  IHDRߊiCCPICC profile(}=H@ߦT :Yq*BZu04$).kŪ "%~Zxq}wШ046ɄͭWhİ,cNR_.γjb@@$eioOo}(+*9I$~όA/K!W Bwo䄗I»@8ǎ<W';붦;!+i ~Fߔo5os>U88Fξ[SrtjbKGDC pHYs B(xtIME!n~ IDATxw\U_sFe("( '8PskieNkfe2v},\7$ `<D8~>=39}3o                                                      F& 'b^*2MEW17ܕ rp7p8W#v\꟰--y=Q *^U\UbgFW9WW}h=E A'.FWMXЕsxqpn p5P |0sC)y H Bp]P Aqƙ/ 5р*` 2쒓Jx- H v0u/yOp3{1^ Y}..q H眧)BZAq!:2A$k#T&{,!8K֑&0vsƀdp~Z!/ithoQYjMIe?p1s @?@z a8˹Hw4~iB fR Gl{MS"|{c$ :AX6R\(Ák8+A)~ݕd d( cEc*NdB-2O ߎKE2 ANmLw9(11>7̉B4 PIs th>G0 w,B\'"K} :A`?WM=dP8>E :A0QNu/`EV3[mT~@IltN8dLAD<ڮN`Op&m [AC%d  , |Z(c/$,[G H C?ӊIBl~*LA߈?C&(r~ wN @& ڊwV=hDld "t]y]Uj8"kV ]\_@tTzm\-B62m> A' C9ncd –'aMm#H 'h: !k6JI0M8\2Р8:Fs{G< t6 _%vEO]VD5ֆ܉JĪq90D;S@9"t&jLGĜh Q-.w,ANX?F7Е,AG8p#KDkAM !1}I8@I 1"glr₸d "t:Ea99A@ȿѸd :?;0wEP5tª{@AiqCL@$T0|CR9x+83|@ = LN?"P'Ѣ({XFX~*k [y' D^T(G (B'dCu\nmg1AYxms~bc j 8[.тoݻ A%bI_P`]Oof_¸ D ts*MǷDKBMD *܆Gφg',u%49fŎЁn4q}ߝuVK ZN܋cba vQH\+.b$wMy A'dG1(1{;1'SzخS @1q:U?Hf H DEt9iJ.N>|խuĄ 0@-u⺼磗FS'AN$V>nߜzd 0uz*OdWM‚=Imu v`3y%$lv@p+21mu[_T)$ \2AN#ƀؚycwRV#/ }ftBNĘ}ʁ#AD3VkthqL^[A :A\W>0V%өN [D7 tN8ac^mcl/ H u*8Vw9h+~b@ Y thHaQتڧ>`edq H FE Q{,rA-*.A4% KAN7~( [%D~:fc  9$8g4/\ĥ\).GvQ uFtWpqV¯ yvG'ث4?AZl=nA$o;vǻfcK?^3-W!0 r.#{CT_s?'#z1=F()GF& qS\τX$Uvܶŗ?e!Z:(1yf !Th+bܛ8HNip>#K$ u0/l6z5 6Qԫ#3G@htTC3tfNKǓƕ|޵AAޞtrZ>帘WSJqx J 4"V>5=&wǸtuk47hsMT@3FGxeϻ Q܉뀚܉š 3#5:v|kyIdGjPgDSE`|:a|XM8Lj-L& 7q>RK7; oWdVN4jr'%~.xe3f# rΤW}x!Ҥc$eelPXGq*>^/ ?%oձwn7Umt  l B-6[T%S݉:*5a_,몱Y_)eMn9P Gx fKn~Iwƣ{G~G,DzE'tf _3+^]@oou,#_7t&cbittS\:YM~ӞIZkcǜ 3FD{G !Ngckq!VrPvafc1x|+bw:Ѭ)E\Z.7?<:x>9AG:o^ݰVJ  %ɳcՔc8yx%n*֜|}{;&@h>aP;q*pogԺU78KF}˷r5Wkk*q$2U[\фj޲wwo $-A s%t$sєT7l/w̤c~?=7C̀<*K95;>ؔX(%*Pw|9LЏ1muS9$3/2ф4Ay^jau> C޿Z"',d0~fANrc-3$mxwd9nc[U79ۿV_ߠ@%(1gyA)Y8$M.4A v 7[&:y9F/7{'A/,S2KF;{]W/r H BքhЬn4K^>5* /M%ݪ:s"%qdppnKF&w– ZST/| ɚ-ޮ?sŚ q ?wcc3n80z6t}X姮K *C_@e}-lsUvE>GG!(j炢r+Ŕ #z~\AjP s~sRXt'IeOS`E!WC? ]p?ISAH..mPp8Jiv(@-€#BxESrT.0WQg+(XD0ql?řZ {3s+ 4;_NJ4\th[hog2&Gbo`'Zn2MT0aL3k ӽ:96NewM٣F\v g!)0`E-6D:oYH|  ]5>D .n|' F($bH>_gS0!0K^#V=Sʰw C~] ]>^gx/8~Ԃ._&o X߯\ 5jYk =!2aQ/B$>߫7YDݡpjKBzNcN$3Д2l!ލBmm l͞aުpZ(-\PEVl^Nnˋ؉ 7pw!~& :!IheDlLaLg/@'!c k%zIK+bMق)r`Q4Z, +o!8oF.AqW:ѦѯK,:,a:* A#*;S!*pid "=aϑ2jWyu0m=CB<ErUEv DގX;CXl̇@GzX0x二\N4ww e`Cz\U:\gHE;f 78mj&b6K%4g٨3h+vj~Хa%YQBʨI4W4b$ -Gcf 󶁓SނsIW%(0=1eژNP s՟=c6Aؒs{h~oV,'_1_5M{Je-+ѹc fEIOCE.lzs7kW|88y++6t.XV#NkŠ 3EDڥwz񗏐 7Qdht+gʛ=_<-*_dž_sNT@[RmOrQ"Dß Y t+ ό#v{<>nw&ϽԬ Yg═ug?0V& vJHre^eW<%hv؝K$6_ l&„"Y5( g Rɑ,S\S:pc#6 W~ɽbI17Y7O \HD{1̰NtQ6[>5ziʨ`wB"b^l)Xg}a,^nsw[sHK.<Ù'ȡÓ X ` ̩P}`yҩ^l`2/-Wڭ>|v $_ZCE<M7wx L [5^0պq8⡁wcv}ϔ[{1 =K-m7ch۹3٩Ԃ %iEQEARdW!2YЛԄX2t7 9j/G@) Â۹3 ^r=^+,bm:Z>ΨÑS}_9zdخ#&Ǵ)d(<9LXT0C_g1w  oE^1+"H*H ؖ00 ލޞA퓚ErFE~ 9b46h۫pKd llKQj0* Ps;)gVmV]y oGO6wA~a6gZkaDž}*q2+r*;L;MEM|a|u F>jɩfs;0߄2 Ǵ{6s ֜>E:q]>ͪC;Hې1`P'i4 sxk< y IDATkn/00X Ѥxv)Rծ_:La¬Y oϞqf{^,FEbqSyS0FNm]<$DG"UvYY0xs^xv#0\6d.GlL5%.wwSg1/&v^E)^~ڛ{cuAx'vu@Ύ\퍪G~q=,8!Sm5m^۷&Q:O {LhrE\**rdU:PWoD{%g%:gG{tJk`őzn' : :EAbǽ_h/6D<P*\))Dni%+P^M`pwCg7GvtE׎9UzZL5:>ڐآvtw?Ãbp}Os+p)mFg{b 1/Լ c/f;vǻNƎ gQ~(~A>Q`Dpoh7:WtS;<X9W(Rhlɜ5xe>}jZ>p4 Y0,w(7#P_ uP,V~sպ]Rθc?Cu=:࣯3QVk?dD-.N3UALO^ewcTb㾳,dEJLc0gE-J&N$BǨB%AoMAf_(8x. XdƔQkB0º!YV[͗QZrӘܝp-]1x:GAO!ved؈=jt }F[e.grymcCﻦT†߲n^98jEQI4ãt-{ǐkƍغc{ÊQx9~<;>*3+o9t ؐ/~Mæl-W SݘFst﹀PSoh_}GFJe+&ja`xl}6ci :,buw`L ɿON\/(g%A4Kq2Euw&,q1:VK;'{W@8"異Bl;v e#=eQZ)1m91\v/dzlLx:a:>仧q%ڢjB`WwC.ݟc&kWQ8}נ5=<ozn'/<$"V$7:j]=Ap֖=io> jyAaq{VfJ3b0O:I4i\..FҥBL)c*n(^xxJdGUspdU\q:JjP\[ ڤq ےNaދ -r==CqG%זbQ2Oi7 naiǀF5&EG&d8y⻟ˠmGEV{`~H+귴xeϻ6ˊjAceAǭf MK*y[>zbw3MrvمMo7JUz# ~"]puuZ#((6>7]\-Go2Pq|N^bXׁxnG?lZz״n#a:ײ Qr9c{܄Ǭ(waFc`gĈa WbhhWybr >;?'A'AQPjǎتx:t7bHÉxX1m\G Ðj|}t58u% ;Nf(ww{OF`p%Co3*AI17v8witۂ 'k?ţg?yHr4>_^cw3;D =#4W(p6+ ӲSCqE: nx) _Og]53^ woS7@!YE!ڵBAIfVn{6m=֥Xpg9FFip` hZ582 pR3ziC-~q$64I\!(&3> [?4?mj= Wh+1髹u3?46S݉|i!Ldq]=;R3DqZJvuwƣ{G--4RHЉG`<ժ4v9,robI1>س<3o;a펕CΖ+=}"/|hŽ >tsg3WHx7z >,&yI?ȜUaKqfܵ,gR|;Ifs` :QX"]/=ia{$E]P1cu D hxV&'sxieR*⍧{ֈ,n"8qqdΜ6+BJ!Xx/~ٟ [E!0<;eQz$ݘ'9XsK8aeoN㌭;>P6`X鏱=$^{=)]%/ OA@kʹR\W>9m?͊^dEq x84xG?&"ZsY/ٛMr?Ucc-F+6;hdgςJh%j c{pwltی˸'ޡ5մynKذAm1{?JG A"Jw]I;nXH6O+ġdu4)oAXT/Z-V!5ql^r_hdpaK*3+Ky|D=,.goѹш' lsrH;K_4AF˿? FQ+78I-2Ep7zFlC8yaj뮔/X8fEs킇h5v`EcƐnwܴN~ hls>x}[#| n\R2%=rF l9/ؾM흝g@xun0/Ѣb_L>xj2 Mo|ul☉5xi&kq3&vj%{k5(淴ݸ'p,;1_z$}pgh,&KEfꁇv At* GA,K^JQɨ] 3֭ſ lk ,^bM7>f^_;N5;^KSSKiuúZ]?!Mnv@R$$h$O[s- =ҩ];8pp冀ǰLHϣښKe҃|=], ZztvAHȅt61<ٓ2ˋۤy8͚OH[vZй(EdI4a~ٗoULAY]_.P+TЛ  M("@^&Q1 $1=\p%χI&ٝ9}\c 'iK-JoTͥF_W'2-yir($=P:Zѩk~L;kC]U ڹ&GGWtrtY~܅l`ɘͽ3rdE J*$n.e5:Z;\gg˒yD*f6P̳U\#e%5O_!"&.KAהӽ0;,DZ6>.%WtVo|kqbU `.5J'UV7lPۉ Zzv&n uhV+ H\QG 25p[u;g*ީM";OD` [5,|Ҫ*!.%vfj%2:96%ӾmnoSb+|,DG& ju\%I}SkѶF̘f>iBhӱ&/iRw&-CJPtV^_ MC%ouql5I|^<쭼+}-$x5Z92iΎ&O!h:"ɏl]釸g&zx`tCU +6q6o<Sڃ玙pw,l>m:{\N=Ak߉;Oj99Yn*0+H PI}nNYe‚ru B"zcݴwfKrhs@:;N4=I;%_ 5Zv'%cc0\)lLa ,R3r<*^jΎcX8y#IU^$\*ϔ\fr T Fn Th M3Pfׁeq+f1|؞p^>} @@1AUמZ/%٬rL䯐lYE?YTxP{r/'nMnZE\4AdP Ǩ'˿7 XAђI^Z1/lW~TY֢V)bյj;g%-#HGZ5w8yB}ȩ۬g}HooN>; IDATTJQ~}XH a0vel%fnOxd=0&E8wsp8$J?<3g͒b0a?^+ݯyz ˾<JoZR/>Ebj8DutiыTPW0zcn-u8SZBXD_ 0sky/-=<6f71 \WZWiGZخ _W G˩?,9GRa*vö=&&q8?#@U߾9 O nRCcvwF"4вug/r]sGZ_2cbkF*;2B&-={)XƘEE&a,=<=6" cp2 3ҴS^ WPmxhZ_ J+r9UH)JChx;y]s%ē.HEeeۘU?ؾ? '"36[KV̐I?b;i[3 V A2iM GzkAibqE=}'|3kjZE5=Iuљ/ O7 ܝ*-ʫ(|F=5 Ό^d}ln\}` Lg;|6VFZVyt&̚pҘό=}/o##}B8)Ȫ13 0l6msA[5c+ W 맿g3/Z}{ܫߋX1c &Gל._]tNŸx\Tú^Vc͎8uB/ 獛ͩiUr'70 8!vvꘃzR9S68!S-k.o9LQ퀧=i}&4E\**rdU:PWoD{%g%:gG{tY+</ix(#6>ƺCm6=Ѣ+Eh6/5{wa0#??GjVcx4F7bn%rkPT^jݟMJC7qOG8__h)P4?d·qiXmuqwpKt ܠR^<Os+p)M|ۿ_A~ɚ_6vw',AW똤fcK?^3Z~?C q' s b MѼHU.r}-h. Ѭ6jz|P :'hĜxx&]~ 8ƌּ)wmc\'ĹgUh^DxO 7ӱE_Q^kU+M^]ݛu=:࣯3QVk{9dD-.NW xu{}|m A8Iث%5ظ,) 5-v-uGUtwNH $@;R) (("~*?X@EŊ 6PQP齄PJh{6^=s7!dK$*?et۱-B_3j @FlP4ޟ;UTؘ| ~‚[kGw{bzKoo,X7osEb霞;IWZ_/a06Lx3GusOW(ũLlޟ-{J֙ajq͹ߝy+KTbaYzl95ghj^־U_.=&GCzV ZZrnzI|-Go0Ua O#1{VńǦ}p&C(zcoĬ Nb} _.ܓ׀Cg b!!,ۃذ.]T_߇}b~kj {ߜ^!xnn/L #(?Ưϰ7 IrLENQMji~.1a\ 'G8^J&r֡Fj:`x6hXI`7u8^3qᡐ=`Jwx*on6j.mC;cx6_\ <$1N#1LS{VlQ{XK ;[uW,hcIQ3}KE2j?|h?P%ό:=oTX)Ew-uuI|Rl2 U'<31t VmJYrʠQ5FW驐K0? Bt``5x?s/ڪ#>M{EL^ 9E5vgX:GPx{ ZgD~U.R5j%rhfj(>yp4^|?ڄM& uhNjN|h5FC-g{(]?k37ʵF kc TxwĊЏ1$gT)z ϯ=>@oI=2. rN"@˾-]+*>ׁF;xr`N0x,7~J_hKxG(^24+N_`+{[SlvX>s&GD/tlcSj#9;sP1:UaP7ddW`KuPb' 2 9"\*˄bBx=@qm9>:}㗃u8<7# ۬^/XpRXUaX,r M E} ʢ h%!pa=XڅJ(t`زr$" Ъ_E*Y _9v('~:ɓQ/'tYݧ ;!mH//R7 +Ȱη-T$᥵ .NK)s54:~8~LGA)\=CN)p 5| qw~{>vj9ԼKdj{)a0ynWN8 ŢĄ 6f1[voJnZ'gN0odB.ێeZVoKԩ |@wITz@蜤#z$zF; ŬSѵխO%3|q_ | <޹x,Oèu&QңJ _oZxC?︈775?V:»KTMLkߜƙe\y#1=˓H-8[(6rj++T}7nw]1>np߿JrT%ې˶֡M,x3lOO g SjK+2xw4Bn DN0%u8 G>K̛za=#D] aHKќ8Ѿ}Ĉ.T,{:P_>bmf>SEHPIH*ع9*l:`=df/Hm@z/~ye:wf>[9w;֧MDD!*ޱ.o9_vۑ22M.]6@t"I!<{k7(f _goܫ4oD9hϋΉALB'CP?KQxG7<tf= f#45m9=g:ZVW`᫧.ߜpip|=qrsfK-->~r};Yx/e )P5‰X: xG)'4(6r -c8ZubHh/s,>!y, ?|մ/>-7; ]>{ܜz0&}h1B[׌GcI*ځxU39S {i1*;zւ1cTOr)}a2@&=Ix0Si2sˁB6m(dvJ_ |͙D!`H0jxh>,| t[)q `9X(t9!i" GTˬm/O e@GKog o:D ]1.6b./}Q8qt䴩$όƈ^)>J՘Wr4떶\73ГMĄ<ѫeX^-`:nǥju~И]AQ.\/qYN$ ~DE:&;r'r'ne*+¡l{`ptB61}s]-Ÿݚ%v.dW qA6xy+2 KOc~W/zS1X xMRLvd9]B ]A~vvO/9cɼPgqD.cڲ(6[.T X}m{9Et`zFf\+֋)䨏lhc\I~>^! !*g%5/.!ly3[XaY=/r >~6H8vhɌbxa':S2vV.c(xڼg詐Ї~5f@O\Vy?ud6171Vn +QT8[yvYm۰8qiJe<6hk{p' 0)+@d算 5O+f!%O"t):Y'$v %p>=`uώ4,SRNBh]DT`ƒGt - E4 }"؆4vj r+_>t@g cwz3Y,>NhzAo *q@^T:"5u҄IpPx9)v)ìnYRRhn:3\k jyI\/P9nYx!b̪Fxkl}a;vf_Z,/w]aJyŀ(ډJG$t), ҩq5>(<(FvIYڍRlk[\!QJGҮU/;}zc#,>sCEʆtFYblR\ʭb.k I.Pk>u<2h9J9x7 сQOgeg[**I8oSÇʪҲj˘$^2ͼCf-B!0%\a0uf^Ӌ88^7xFJb(DG"LT>80gApvkYC*X}iW7%lvAoR}&CgsMB`R5kJʑLf.Fh8/p*8NY BgEl}=&rW^˫}!TS=*^2x1 ̔uTw!ƒ1(EBXx֯ҧ]Yݧ~#=א ~lm=S>X9Нl!h7QsaNk-t{TPVFAէ><}/@!ӗKֶv,!R$mr:+SYuuXesthgͷ B[F{ hznq[K,F/n0-9ƺC_hǺwlv2 u?[Gu2ee 8zQ_*7ksR[- I$t' t^Պ޽ #6T0 XL}:7]B&^q)?ƐkB*x3J,x #S'&BտnYV+XeI&HNc$t o q IDATSZTfw X!tY !IP8v{eS] yU2GFVۍ-BASaPBI f 2&zjߨ:sm%>A+㺛@|`lZ 3H5ŊOl&_mO~ST ⰌQ%NA~h8U Amdjxhؖs6[RɦnSXx{eSK5ih(m7EId02ϋ eiZ8̽x)̐ʃ yqa%ghP!BV.᭼P5ڿ̋n*=N^x>,l̆3 ;o^ۆj@a5 =b;WFee' 5%g.j@X-B0E}P`x3:H'_ʩܭ?-CX{i;ƃ&73 m'[{FU<^ў-?[J_S O9Y0@j}Q8!\ A\Q\x6J m[LǸ~q;ɤ\xj3Qw'@w+΄_؁sׅ±cdM1ݴwu0ڰHF$ ~g7.jl:`e}]^f6BXn&ڣr{Q%t)o-tŧgn<8BfκCBʹwݨwӪVA.!4%fj-vU@\goSN9|2omoYW oؓ(Zsжm &;,ӏ ԢDt=\4-fshle{fNofrk3=ܾʫuoXeNhZ?5~?xJxaB&dO*8jڔdr֐e+/47!ݞ 7 ݲ}8tLN 5X`6 eW I r Ӧe<{^}':EX=w\yi1c-4}PwT,*"5ѯxB'WDIp%Ot/g4MzmQZR/OCoKG0yp?QZd6,M? HԂ7mޫc+o*R guྗvUg{[3M=Q9XBw 3GcGDqpra%H:3A)蜕y3,~'Ҧ/V_a`tL ~ 5ɸbQ)?̢_G`zU};<~Qxhrc!`V\ i(cJ'BEfN-ccNsH4چ4 A^guz^UU+1$)Ui6D>O$7:ԤȮh߼gd-~YAC_נIr~ EJ-Q_5/oӊ s,_ӖmE׽Db֣-+Ɓg7n ac!g< k4@#;moS & ژz#UXwUAK?uk@$T 9GEpRHh야^a"HjZE+T,|c+6';PH1w[<Ź8}ɗuȮAx>Ho6 6 o݋7s0Z= 3nAi{XQhٻk %o|d&lXb.:k1G|vݧ˿8GoY[e 1ho(Pk-5#UH48O#rZӪջ@ _ETB.N9БmpB@¹@y u|a1Ow \jp<ӷc˅PCD;u$G6ժ (QcT$  F _FiU߭7TN~h  HZ,l{~zz{!r~[,fAj})\I}.#1+@wόܷvA˾-sB$>)D^kFV A5*#U&[PDHMZmE,~<ḝ! X9ӄNټ֙p8qR1ިby(HuDxO(~MSkiGѻzWV ƶ3f]rG˧`@d4NZj]%5e$? 7DppFY&C W"Hg5!.]+f})}jD oB)p0-]ŮMf(X̙[S'hױPIp׈g7t l{Zy$K(FEͭ%gVYg\~`+YIWEB;4P,IdG3M~K?:˹i,!&/큡=;4JX|< ƦxxrAsVuO23;j7X,<^4>rE2WL{Aj0YEfG `&n6y;$}c;{*&ܢ-beW.'2}fQ㝥\>y{$>Shmg^kFh%ʈcq\O٭G/ ~O5]=xtj7jQU] NwOO} G`蜕Ъ%[O\Uh0y6aA^mC}!\ZGjej\W!HըI>J{ˡ՛Q5R{\k:o |d\ vRZ :̰6_}Uo/|Qd^Y q'-rHg(B8)%R}; z"A&>H0![_. U2OJ;/ڜ)k <6=ZKt[ T HP9ؑmq**$h=C1eh3+~%|:R>gdE$`hVPIkAǁf&6;g8u;;=4mNK˾܍@ =,mqB } .đBAN]gי. ˁt^u49hF{l={y^<ǰ ߊ %`7љÁLc: ʜ!]~jR@j>2|~Ҷ&|ߌ'"CPn#0uCU$^/*P|+\)Z,N)^,'qߎݤSD^Z=hfݣ^Zsj]{$tU2q$&2xr<ߧQa: ԨPQZ`1A84qonL d}c0[MLkߜƙeIq݅WWO@swᶀ}Hp?fM5;`i2'UdN";;%[xi"1I?b`gy;nͨ1V >CA|i T}kYӫg݄CGN7O[lkEo4$/B"^ JPL.u+v9~y7K:_NB8p1)}s‹vAzL}S2BҤIPF 6m>?4WjQF]yH<JA 07m4 WurBU2_GMT~ߕjss Fm+amxcC T<^!׳[HE2 ZS]9Oz$SqZ;<{2&]$sVIv9%sI7--qFXF\YS $^XkP6'bptp hɂ՛TvA.[RN%>M$Ёh˨jHEcNwq#`?ip6qQ$ΧgДDOBI9C;G/Rlm[~ߗ.E!XXPdn4xcC*F=MXnRoH@<Yj@5iCS݆H*VwQg*E!rz*zPΒgLP_6B2_>:"vH,y+1걟w0&Agi\5 ƍ\󿉄n Ve9viy }W֟L)f׳V>&ro8mdb[q)#~^މP-{a/^J7ndRkɝLeqP8I8^*ʒ@\vo~!-X؈Z\gqJA뼼,_bZ `#R?̹M]RG#0upZڇopkSڣ{B^8:`Q3D2jYPde2OS%]EBov!y]W~c,4n%P|\?I;Gz:u~l(!LyjLX+~9uKq.ЫsJByP=(n6?MeWK|^J~ Xt(4+`Z~hM!~Mf//7(;mw<8+f[BnAi}MtE||T*ù (..ǜi ܓ{4 8!JO=!(CKK$ +/0oGc:ewtir8uӖmGiUFO< g]+*^ M1ݫy >QzuidQ˥`8%kV? Ngk3%vJ8|(('31ㅝPwJZ&A{)/z(C6Z,EBo, EiFI%_yQ^lokP\YScĀ7a,xcѱ-yNQ _];bYp7$e{?N,5@;[D͞{) ]ZTbлqA: hQFBm'tQwJ(3qY+4g_"&±:[YHίu#ja_o"C}Ү)ϥ44[KR 17䑗Ն;ZHWjlʢ}\L tv=VlBר-r(5ax-Kˮ>eò;!jΠ4X@.6g(}~@@)r&a{.)buǺgfoO XvyFzf6-tW$vK푹\nNrQD8<ڰyO] vݱiU\g ]ڞgbF"PY܀ 2_Q us=J$6 K X5,m 2_pAކo `DjJo{tZ ]?"7!tԉhqg;E[Yߊ;~mm$S}?%zyL|mxxr-o;s9pJi:К ^O혿vc`: .뒄~nRP(v"6YmDqƇNב]+-'vcW Ċelm}IXvbՖ 1rzGI\)WlHD+]C ٕ؞סm+c֊]OS ]|2qlM<1>Ufw{TZ" N\veU^ߝOD]ͷkPꛠELMB0 ӖmǍcE1w&{nZ;U:m %A=t6H1 IפmxΕ{DdRJQE4> Y8{';1չ sELy7\/.SVA.94%ԟ񡌠nRZ}o[-s;&XAVtiB?`{G蛢hVzڣCN\e-t}?I9BhZ?5~_yJxa+MĦU4nצ$sY+@+!: A\QE4Lqw۝Ր<SUkv}`w UvH{"Ach:'桃)YzZ-P]ɞ<. : %(!EqѬФ Ƥxe+7UcXEtՇIOO{ش pL ϚS x2`yF|+c?O#<խs t8`N|/fTX vD|g:Ϲ+-# [橔1eh 8`ـ4e7ڳ5Nf(B兎b F3Na_sTxf 턏$sAo1 <\S7]'Ei.1rT򼻼ĝL@6npю0v!"cm`WQ\ow]Fq}Caݧ C\'?\>ц HAZ?.|  ܆˅7/ЂM'putTsǶp}<Yiwkʒ1xqo0V=.{p Ӛà/^uK⏭trO)+z@ .sZ ؊ɼSBQbh@8(,KHCFv Ն[ֆb齽w k/GwfL>G@p9>XERUKẩ@ANIwI$tKU`("7 1}H|Ģ[_7~v>'GOAѐHV Z$+Ğ>2uiX6:ozn,۰ScCf N]u;G(fŲ",j@yj<(ݲgxhEցrMFpXr_Xu72N' 0|MQSS9V!GI%UF1glJf:j=;l; 8FXVʿ-D[j5Jrt2ߵ}߮7"HYW,9Jbkd Uڦ iw(0~pOxmػ78ģ3;ģ+@nn‘ST}xG ɥ<>O0~t@hõno~8BI֦G{aRoRz){Bv=t]>)4^"DbwZďi^"7wr ABLU() ^}Et]BAq5<W8v8<=+!$7ѳxjv!@N]tDb샦R"sN;Ub޹%#dQEBoxtk-j5٨.FGNWy(T>xD QWpƢQdd-#Pռ> ৕àpuf <. 㭟H8 DDMdO~-|CS!_qgyh;^we_vh͡V?{>,Sq3u36T68+>"@rRt%} cXa u!nX H^~&8o'@)(0^^ū7Hb@yWbӅo.=*HSk'So3bS{ʁMS!ןXЊ@o #'Be$.D .K5-ܻ.m.)P"Jir]4&^vv2Ҙ炖o lt'R@sрF9{eu !( RA ETbZKkVj]ݭ[.*v."TEHPI6yE;#Λayg.Ev_&/PG]'ε&bnf3۬wݷ>*S} .V~xJ=ֽ]4FئS]XsEݙ@rAl QX#WAcuf Z7k?)%F0I! "\/\ 9}GkQ`-T/|Ӗ tN"mݯ:8Km\ݠVRUyh=XUa{0@!͛B(C3L$nRw`kƬ_ gHG{J+䎜eAWmhz# ֎w6Ь! ;MSϝ-E  j]evYS_ӶDm(#Ѳ?8׶n[7B;}Oo͹46{}o=L9ٽ ԱsNDYH@U ?SӚ| ༯r}sVAȍkڷt뷟ԷkRBI:Xt[~Vp~14%&{)U\q. u˨o`~pGa .m/'קrwYC*`w^;95Խf8wn-"ss=zh μt-2ou7=NDPpOcqn~sZ`=[zI4ץb.aa95;c9ǰ1ó:^v}&wքڗ'{ ɞ v>]G fy_0C`mSZC]UDDN ɳg> +mO;$j&cG{14`C}8]NDX"PX̚PsS}6 ؐkpe5:}ƼACV?iW{v:QT!jkWWΊBtMK<qv:}<_z\;ԜhnO6y7ycu;CgE gzRmv;gv?q,V 1|`F߸R'ƥ_:љr|n4?ywnOKh>[R8h n׀XiKB@'ؖ@T:;pj{O%_w}g#=q>돧Jcfڔf+zŗ܉(:Xtn7<;TӧGְ0ЉO8?X] 5ܷP-% t"(Ey~!2@}薚%aBz_D ( fMޞԄYVbr oq]NYaaEj p7ĕ/\ yݎp{떚[jBqCbv:QLƏ\Y-%Qk*k6$V@'""eAo<SC/e><:zw5c3rYïck~rA]-!U£(ޜ[F/2F9@'b+y$$Džܫw/QF1 q"MYNDQ| ~sO㋮ow==d vyg@'檠ndK?jEy'3u-WeO qxpvbQїJW+Oy3jrND姾Мq/>0]R qi=D' 銸o_ ' zuڄA_ qx@'=zC]y?݉ &_ ]"@ t"z|xY]gԡYM #OJ<1Љ(X.6]z\U?+B J}>@ul?G t"Y}1(X̗ߍ(~,zbzA`Y"`bxzt~I飰jgzZYӿ)"R˖&:~Cx }0'֣ˑS0ۿ֜labQgt04 | D¿l\vO'߽ƜG("Ul[:a -S'V6I g'}8wzi+%*w#~n[YH\x5kEd/ۓ@=m@.w%v;8M|sF?dpg\%9V$:1Љ 9w q n]GU^|r,2=3Y̜NyíJ$ :1Y r4WWH!ݮF#Gs =rG8t\ RFfx JƐ>iiC.t&wՀU`@':u6 XF+tv+a.?L`*.HRKqY%} ZelVj 7K@Dv ˮ&2)\wA;hŔ@}̎ۿK$s6Nܳ4@`ت@'Nx\IN,m\uo>?q~|Cl#[Dԉ(*$tu{s2l-)ʆR̋2s/U@'w~+Am6'wC+ﰪgUo$a6. Q lwD#UgvPg"wJ t \jP;9џ/`ic낼UwaX8 MBv ]^=vr&u'!Z2Hsn߫&*:f$i2(nfjE[RGAdnQ0f"]EBNqkD?,J tnOJP'hdnd%#SWm U/ @ؘHԹ4Fu,1)vB=oyQ4 @ +{Y a-Vf[,EVhUއRVbL8Cؿ-c %vCT9qNo^QϺ0ՠ(Wg^+yְ:u+ʂL eoŗۍb9qNb+CUbf˨Y b4~%TPsM^#",1Љ%+&^p~+9+򕸼%,9C']e:7*@`EY yݸ|#:֫/aU^w^X b8JKOPH\WBt9qNAjYe5(L6K^i)KA tv?M/S9 Gͯs@'ٺg.aE:$'Yb+׎II_[z"J ou (@K,7@Y@Gq{5,1Љ[PPoBr%t/o@'rrWhYN'Er/$@'`*e_0tvBc}@'`WTL UYu}ˊwN黜(V}wIb?X{$V%G39o s5yI:B tc]\@nM#Q@\ iK7bѩp_;&Ο4쵀\A>(~V @ |-_N'b?+ $Q;z*a ??e\NԶpWT-j& PLWz; e*%xOr&D t VQ"b\ TԅR[~!bE6'E Ѕ9ފ-֬3[1Љ>l*4 (cGH ߿UT F>B i,md bNW-kABh6=iG=*V5઒akD tch?(dh8:1 9գUx?u'ZD t"j]_RW<6/jSsjS Pum#iE=RW3&""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""K[IENDB`OWL-RL-7.1.4/OWL-RL.svg000066400000000000000000000416171504201166100142010ustar00rootroot00000000000000 OWL-RL-7.1.4/PKG-INFO000077500000000000000000000055011504201166100135740ustar00rootroot00000000000000Metadata-Version: 1.2 Name: owlrl Version: 7.1.2 Summary: OWL-RL and RDFS based RDF Closure inferencing Home-page: https://github.com/RDFLib/OWL-RL/ Author: Ivan Herman Author-email: ivan@ivan-herman.net Maintainer: Nicholas Car Maintainer-email: nick@kurrawong.ai License: LICENSE.txt Download-URL: https://github.com/RDFLib/OWL-RL/archive/v5.2.2.tar.gz Description: |Original Author DOI| .. |Original Author DOI| image:: https://zenodo.org/badge/9385/RDFLib/OWL-RL.svg :target: http://dx.doi.org/10.5281/zenodo.14543 OWL-RL ====== A simple implementation of the OWL2 RL Profile, as well as a basic RDFS inference, on top of RDFLib. Based mechanical forward chaining. The distribution contains: **OWL-RL**: the Python library. You should copy the directory somewhere into your :code:`PYTHONPATH`. Alternatively, you can also run the :code:`python setup.py install` script in the directory. * :code:`scripts/RDFConvertService`: can be used as a CGI script to invoke the library. It may have to be adapted to the local server setup. * :code:`scripts/owlrl`: script that can be run locally on to transform a file into RDF (on the standard output). Run the script with :code:`-h` to get the available flags. The package requires Python version 3.5 or higher; it depends on `RDFLib`_; version 4.2.2 or higher is required. If you need the python 2.7.x compatible version, see the @/py2 branch in this repository. .. _RDFLib: https://github.com/RDFLib For the details on RDFS, see the `RDF Semanics Specification`_; for OWL 2 RL, see the `OWL 2 Profile specification`_. .. _RDF Semanics Specification: http://www.w3.org/TR/rdf11-mt/ .. _OWL 2 Profile specification: http://www.w3.org/TR/owl2-profiles/#Reasoning_in_OWL_2_RL_and_RDF_Graphs_using_Rules View the **OWL-RL documentation** online: http://owl-rl.readthedocs.io/ Keywords: Linked Data,Semantic Web,Python,triples,inferencing,RDF,OWL,OWL-RL,owlrl,RDFS Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Topic :: Utilities Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: W3C License Classifier: Natural Language :: English Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3 :: Only Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Operating System :: OS Independent OWL-RL-7.1.4/README.rst000066400000000000000000000057361504201166100141750ustar00rootroot00000000000000|Original Author DOI| |PyPI badge| |OWL-RL Logo| .. |Original Author DOI| image:: https://zenodo.org/badge/9385/RDFLib/OWL-RL.svg :target: http://dx.doi.org/10.5281/zenodo.14543 .. |PyPI badge| image:: https://badge.fury.io/py/owlrl.svg :target: https://badge.fury.io/py/owlrl .. |OWL-RL Logo| image:: https://raw.githubusercontent.com/RDFLib/OWL-RL/master/OWL-RL.png :width: 250 :target: http://owl-rl.readthedocs.io/ OWL-RL ====== A simple implementation of the OWL2 RL Profile, as well as a basic RDFS inference, on top of RDFLib, based on forward chaining. This package is a Python library that also contains a couple of scripts: * `scripts/RDFConvertService`: a CGI script to invoke the library. It may have to be adapted to the local server setup. * `scripts/owlrl`: a script that can be run locally on to transform a file into RDF (on the standard output). Run the script with `-h` to get the available flags. Installation ------------ This package requires RDFLib 7.1.3 as its only dependency and it can be installed from the Python Package index in the usual way: :: pip install owlrl or :: poetry add owlrl Use --- This package can run inference according to RDFS and/or OWL-RL. For details on RDFS, see the `RDF Semantics Specification`_; for OWL 2 RL, see the `OWL 2 Profile specification`_. .. _RDF Semantics Specification: http://www.w3.org/TR/rdf11-mt/ .. _OWL 2 Profile specification: http://www.w3.org/TR/owl2-profiles/#Reasoning_in_OWL_2_RL_and_RDF_Graphs_using_Rules View the **OWL-RL documentation** online: http://owl-rl.readthedocs.io/ License ------- This software is released under the W3C© SOFTWARE NOTICE AND LICENSE. See `LICENSE.txt `_. Support & Contacts ------------------ For general "how do I..." queries, please use https://stackoverflow.com and tag your question with ``rdflib``. Existing questions: * https://stackoverflow.com/questions/tagged/rdflib If you want to contact the rdflib maintainers, please do so via: * the rdflib-dev mailing list: https://groups.google.com/group/rdflib-dev * the chat, which is available at `gitter `_ or via matrix `#RDFLib_rdflib:gitter.im `_ Development ----------- Changes ~~~~~~~ To view the changelog for this software library, see `CHANGELOG.rst `_. Release Procedure ~~~~~~~~~~~~~~~~~ * update all the version numbers * pyproject.toml * README.rst * remove the current ``dist/`` dir * build the new distribution * test the metadata rendering * test push it to PyPI * actually push it to PyPI :: rm -vf dist/* poetry build bsdtar -xvf dist/owlrl-*.whl -O '*/METADATA' | view - bsdtar -xvf dist/owlrl-*.tar.gz -O '*/PKG-INFO' | view - poetry publish --dry-run poetry publish -u __token__ -p * commit the version update * tag it * push the commits & tag to GitHub * make a GitHub release * reuse the CHANGELOG entry for the release OWL-RL-7.1.4/docs/000077500000000000000000000000001504201166100134235ustar00rootroot00000000000000OWL-RL-7.1.4/docs/Makefile000066400000000000000000000011101504201166100150540ustar00rootroot00000000000000# Minimal makefile for Sphinx documentation # # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build SOURCEDIR = source BUILDDIR = build # Put it first so that "make" without argument is like "make help". help: @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) .PHONY: help Makefile # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). %: Makefile @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)OWL-RL-7.1.4/docs/make.bat000066400000000000000000000013641504201166100150340ustar00rootroot00000000000000@ECHO OFF pushd %~dp0 REM Command file for Sphinx documentation if "%SPHINXBUILD%" == "" ( set SPHINXBUILD=sphinx-build ) set SOURCEDIR=source set BUILDDIR=build if "%1" == "" goto help %SPHINXBUILD% >NUL 2>NUL if errorlevel 9009 ( echo. echo.The 'sphinx-build' command was not found. Make sure you have Sphinx echo.installed, then set the SPHINXBUILD environment variable to point echo.to the full path of the 'sphinx-build' executable. Alternatively you echo.may add the Sphinx directory to PATH. echo. echo.If you don't have Sphinx installed, grab it from echo.http://sphinx-doc.org/ exit /b 1 ) %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% goto end :help %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% :end popd OWL-RL-7.1.4/docs/source/000077500000000000000000000000001504201166100147235ustar00rootroot00000000000000OWL-RL-7.1.4/docs/source/AxiomaticTriples.rst000066400000000000000000000003261504201166100207370ustar00rootroot00000000000000AxiomaticTriples ================ .. automodule:: owlrl.AxiomaticTriples :members: :undoc-members: :inherited-members: :show-inheritance: .. seealso:: View the source code :ref:`AxiomaticTriples`.OWL-RL-7.1.4/docs/source/AxiomaticTriples_source.rst000066400000000000000000000002011504201166100223070ustar00rootroot00000000000000.. _AxiomaticTriples: AxiomaticTriples.py ------------------- .. literalinclude:: ../../owlrl/AxiomaticTriples.py :linenos:OWL-RL-7.1.4/docs/source/Closure.rst000066400000000000000000000002001504201166100170610ustar00rootroot00000000000000Closure ======= .. automodule:: owlrl.Closure :members: :undoc-members: :inherited-members: :show-inheritance: OWL-RL-7.1.4/docs/source/CombinedClosure.rst000066400000000000000000000002301504201166100205250ustar00rootroot00000000000000CombinedClosure =============== .. automodule:: owlrl.CombinedClosure :members: :undoc-members: :inherited-members: :show-inheritance: OWL-RL-7.1.4/docs/source/DatatypeHandling.rst000066400000000000000000000052761504201166100207070ustar00rootroot00000000000000DatatypeHandling ================ .. automodule:: owlrl.DatatypeHandling :members: :undoc-members: :inherited-members: :show-inheritance: AltXSDToPYTHON Table -------------------- .. note:: The code below is not extracted automatically from the source code. If there are any errors, please make a pull request or an issue: https://github.com/RDFLib/OWL-RL .. code-block:: python AltXSDToPYTHON = { XSD.language: lambda v: _strToVal_Regexp(v, _re_language), XSD.NMTOKEN: lambda v: _strToVal_Regexp(v, _re_NMTOKEN, re.U), XSD.Name: lambda v: _strToVal_Regexp(v, _re_NMTOKEN, re.U, _re_Name_ex), XSD.NCName: lambda v: _strToVal_Regexp(v, _re_NCName, re.U, _re_NCName_ex), XSD.token: _strToToken, RDF.plainLiteral: _strToPlainLiteral, XSD.boolean: _strToBool, XSD.decimal: _strToDecimal, XSD.anyURI: _strToAnyURI, XSD.base64Binary: _strToBase64Binary, XSD.double: _strToDouble, XSD.float: _strToFloat, XSD.byte: lambda v: _strToBoundNumeral(v, _limits_byte, int), XSD.int: lambda v: _strToBoundNumeral(v, _limits_int, int), XSD.long: lambda v: _strToBoundNumeral(v, _limits_long, int), XSD.positiveInteger: lambda v: _strToBoundNumeral(v, _limits_positiveInteger, int), XSD.nonPositiveInteger: lambda v: _strToBoundNumeral(v, _limits_nonPositiveInteger, int), XSD.negativeInteger: lambda v: _strToBoundNumeral(v, _limits_negativeInteger, int), XSD.nonNegativeInteger: lambda v: _strToBoundNumeral(v, _limits_nonNegativeInteger, int), XSD.short: lambda v: _strToBoundNumeral(v, _limits_short, int), XSD.unsignedByte: lambda v: _strToBoundNumeral(v, _limits_unsignedByte, int), XSD.unsignedShort: lambda v: _strToBoundNumeral(v, _limits_unsignedShort, int), XSD.unsignedInt: lambda v: _strToBoundNumeral(v, _limits_unsignedInt, int), XSD.unsignedLong: lambda v: _strToBoundNumeral(v, _limits_unsignedLong, int), XSD.hexBinary: _strToHexBinary, XSD.dateTime: lambda v: _strToDateTimeAndStamp(v, False), XSD.dateTimeStamp: lambda v: _strToDateTimeAndStamp(v, True), RDF.XMLLiteral: _strToXMLLiteral, XSD.integer: int, XSD.string: lambda v: v, RDF.HTML: lambda v: v, XSD.normalizedString: lambda v: _strToVal_Regexp(v, _re_token), # These are RDFS specific... XSD.time: _strToTime, XSD.date: _strToDate, XSD.gYearMonth: _strTogYearMonth, XSD.gYear: _strTogYear, XSD.gMonthDay: _strTogMonthDay, XSD.gDay: _strTogDay, XSD.gMonth: _strTogMonth, } .. seealso:: View the source code :ref:`DatatypeHandling`.OWL-RL-7.1.4/docs/source/DatatypeHandling_source.rst000066400000000000000000000002011504201166100222460ustar00rootroot00000000000000.. _DatatypeHandling: DatatypeHandling.py ------------------- .. literalinclude:: ../../owlrl/DatatypeHandling.py :linenos:OWL-RL-7.1.4/docs/source/OWLRL.rst000066400000000000000000000001721504201166100163540ustar00rootroot00000000000000OWLRL ===== .. automodule:: owlrl.OWLRL :members: :undoc-members: :inherited-members: :show-inheritance: OWL-RL-7.1.4/docs/source/OWLRLExtras.rst000066400000000000000000000002771504201166100175510ustar00rootroot00000000000000OWLRLExtras =========== .. automodule:: owlrl.OWLRLExtras :members: :undoc-members: :inherited-members: :show-inheritance: .. autofunction:: owlrl.OWLRLExtras._strToRationalOWL-RL-7.1.4/docs/source/RDFSClosure.rst000066400000000000000000000002141504201166100175450ustar00rootroot00000000000000RDFSClosure =========== .. automodule:: owlrl.RDFSClosure :members: :undoc-members: :inherited-members: :show-inheritance: OWL-RL-7.1.4/docs/source/RestrictedDatatype.rst000066400000000000000000000003331504201166100212600ustar00rootroot00000000000000RestrictedDatatype ================== .. automodule:: owlrl.RestrictedDatatype :members: :undoc-members: :inherited-members: :show-inheritance: .. autofunction:: owlrl.RestrictedDatatype._lit_to_valueOWL-RL-7.1.4/docs/source/XsdDatatypes.rst000066400000000000000000000003051504201166100200700ustar00rootroot00000000000000XsdDatatypes ============ .. automodule:: owlrl.XsdDatatypes :members: :undoc-members: :inherited-members: :show-inheritance: .. seealso:: View the source code :ref:`XsdDatatypes`OWL-RL-7.1.4/docs/source/XsdDatatypes_source.rst000066400000000000000000000001621504201166100214510ustar00rootroot00000000000000.. _XsdDatatypes: XsdDatatypes.py --------------- .. literalinclude:: ../../owlrl/XsdDatatypes.py :linenos: OWL-RL-7.1.4/docs/source/_static/000077500000000000000000000000001504201166100163515ustar00rootroot00000000000000OWL-RL-7.1.4/docs/source/_static/.gitkeep000066400000000000000000000000001504201166100177700ustar00rootroot00000000000000OWL-RL-7.1.4/docs/source/conf.py000066400000000000000000000134231504201166100162250ustar00rootroot00000000000000# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path setup -------------------------------------------------------------- # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # import os import sys sys.path.insert(0, os.path.abspath("../..")) # -- Project information ----------------------------------------------------- project = "OWL-RL" copyright = "2020, RDFlib developers" author = "RDFlib developers" # The short X.Y version version = "" # The full version, including alpha/beta/rc tags release = "5.2.2" # -- General configuration --------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. # # needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ "sphinx.ext.autodoc", "sphinx.ext.intersphinx", "sphinx.ext.viewcode", "sphinx.ext.autosummary", ] # generate classes and add to the toctree. See owlrl.rst for example usage. # autodoc_default_flags = ['members'] autosummary_generate = True # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: # # source_suffix = ['.rst', '.md'] source_suffix = ".rst" # The master toctree document. master_doc = "index" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command lihttps://rdflib.readthedocs.io/en/stable/ne for these cases. language = "en" # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This pattern also affects html_static_path and html_extra_path. exclude_patterns = [] # The name of the Pygments (syntax highlighting) style to use. pygments_style = None # -- Options for HTML output ------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # html_theme = "sphinx_rtd_theme" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. # # html_theme_options = {} # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ["_static"] # Custom sidebar templates, must be a dictionary that maps document names # to template names. # # The default sidebars (for documents that don't match any pattern) are # defined by theme itself. Builtin themes are using these templates by # default: ``['localtoc.html', 'relations.html', 'sourcelink.html', # 'searchbox.html']``. # # html_sidebars = {} html_logo = "../../OWL-RL.png" # -- Options for HTMLHelp output --------------------------------------------- # Output file base name for HTML help builder. htmlhelp_basename = "OWL-RLdoc" # -- Options for LaTeX output ------------------------------------------------ latex_elements = { # The paper size ('letterpaper' or 'a4paper'). # # 'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). # # 'pointsize': '10pt', # Additional stuff for the LaTeX preamble. # # 'preamble': '', # Latex figure (float) alignment # # 'figure_align': 'htbp', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ ( master_doc, "OWL-RL.tex", "OWL-RL Documentation", "CSIRO Land and Water", "manual", ), ] # -- Options for manual page output ------------------------------------------ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [(master_doc, "owl-rl", "OWL-RL Documentation", [author], 1)] # -- Options for Texinfo output ---------------------------------------------- # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ ( master_doc, "OWL-RL", "OWL-RL Documentation", author, "OWL-RL", "One line description of project.", "Miscellaneous", ), ] # -- Options for Epub output ------------------------------------------------- # Bibliographic Dublin Core info. epub_title = project # The unique identifier of the text. This can be a ISBN number # or the project homepage. # # epub_identifier = '' # A unique identification for the text. # # epub_uid = '' # A list of files that should not be packed into the epub file. epub_exclude_files = ["search.html"] # -- Extension configuration ------------------------------------------------- # -- Options for intersphinx extension --------------------------------------- # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = { "python": ("https://docs.python.org/", None), "rdflib": ("https://rdflib.readthedocs.io/en/stable/", None) } OWL-RL-7.1.4/docs/source/index.rst000066400000000000000000000014541504201166100165700ustar00rootroot00000000000000.. OWL-RL documentation master file, created by sphinx-quickstart on Tue Nov 20 10:29:01 2018. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. ==================== OWL-RL Documentation ==================== .. include:: ../../README.rst .. toctree:: :maxdepth: 2 :caption: Getting Started installation usage indices_and_tables .. toctree:: :maxdepth: 2 :caption: Modules stubs/owlrl.__index__ stubs/owlrl.DeductiveClosure AxiomaticTriples Closure CombinedClosure DatatypeHandling OWLRL OWLRLExtras RDFSClosure RestrictedDatatype XsdDatatypes .. toctree:: :maxdepth: 1 :caption: Reference Source AxiomaticTriples_source DatatypeHandling_source XsdDatatypes_sourceOWL-RL-7.1.4/docs/source/indices_and_tables.rst000066400000000000000000000001341504201166100212450ustar00rootroot00000000000000 Indices and tables ================== * :ref:`genindex` * :ref:`modindex` * :ref:`search` OWL-RL-7.1.4/docs/source/installation.rst000066400000000000000000000000521504201166100201530ustar00rootroot00000000000000Installation ============ *Coming soon.* OWL-RL-7.1.4/docs/source/stubs/000077500000000000000000000000001504201166100160635ustar00rootroot00000000000000OWL-RL-7.1.4/docs/source/stubs/owlrl.DeductiveClosure.rst000066400000000000000000000012071504201166100232240ustar00rootroot00000000000000owlrl.DeductiveClosure ====================== .. currentmodule:: owlrl .. autoclass:: DeductiveClosure .. automethod:: __init__ .. automethod:: expand .. automethod:: use_improved_datatypes_conversions .. automethod:: use_rdflib_datatypes_conversions .. autoattribute:: improved_datatype_generic .. rubric:: Methods .. autosummary:: ~DeductiveClosure.__init__ ~DeductiveClosure.expand ~DeductiveClosure.use_improved_datatypes_conversions ~DeductiveClosure.use_rdflib_datatypes_conversions .. rubric:: Attributes .. autosummary:: improved_datatype_generic OWL-RL-7.1.4/docs/source/stubs/owlrl.__index__.rst000066400000000000000000000004411504201166100216550ustar00rootroot00000000000000owlrl ===== .. automodule:: owlrl .. rubric:: Functions .. autofunction:: convert_graph .. autofunction:: interpret_owl_imports .. autofunction:: return_closure_class .. rubric:: Classes .. autosummary:: DeductiveClosure OWL-RL-7.1.4/docs/source/usage.rst000066400000000000000000000001361504201166100165610ustar00rootroot00000000000000Usage ===== *Coming soon.* .. note:: Refer to :class:`owlrl` for package entry details, etc.OWL-RL-7.1.4/epydoc.css000077500000000000000000000373141504201166100145030ustar00rootroot00000000000000 /* Epydoc CSS Stylesheet * * This stylesheet can be used to customize the appearance of epydoc's * HTML output. * */ /* Default Colors & Styles * - Set the default foreground & background color with 'body'; and * link colors with 'a:link' and 'a:visited'. * - Use bold for decision list terms. * - The heading styles defined here are used for headings *within* * docstring descriptions. All headings used by epydoc itself use * either class='epydoc' or class='toc' (CSS styles for both * defined below). */ body { background: #ffffff; color: #000000; } a:link { color: #0000ff; } a:visited { color: #204080; } dt { font-weight: bold; } h1 { font-size: +140%; font-style: italic; font-weight: bold; background: #cccc99; /* #EFEBCE; #005a9c; */ color: white; margin-bottom: 0.5em; } h2 { font-size: +125%; font-style: italic; font-weight: bold; } h3 { font-size: +110%; font-style: italic; font-weight: normal; } code { font-size: 100%; } /* Page Header & Footer * - The standard page header consists of a navigation bar (with * pointers to standard pages such as 'home' and 'trees'); a * breadcrumbs list, which can be used to navigate to containing * classes or modules; options links, to show/hide private * variables and to show/hide frames; and a page title (using *

). The page title may be followed by a link to the * corresponding source code (using 'span.codelink'). * - The footer consists of a navigation bar, a timestamp, and a * pointer to epydoc's homepage. */ h1.epydoc { margin: 0; font-size: +140%; font-weight: bold; } h2.epydoc { font-size: +130%; font-weight: bold; } h3.epydoc { font-size: +115%; font-weight: bold; } td h3.epydoc { font-size: +115%; font-weight: bold; margin-bottom: 0; } table.navbar { background: #cccc99; color: #000000; border: 2px groove #c0d0d0; } table.navbar table { color: #000000; } th.navbar-select { background: #70b0ff; color: #000000; } table.navbar a { text-decoration: none; } table.navbar a:link { color: #0000ff; } table.navbar a:visited { color: #204080; } span.breadcrumbs { font-size: 85%; font-weight: bold; } span.options { font-size: 70%; } span.codelink { font-size: 85%; } td.footer { font-size: 85%; } /* Table Headers * - Each summary table and details section begins with a 'header' * row. This row contains a section title (marked by * 'span.table-header') as well as a show/hide private link * (marked by 'span.options', defined above). * - Summary tables that contain user-defined groups mark those * groups using 'group header' rows. */ td.table-header { background: #EFEBCE; color: #000000; border: 1px solid #608090; } td.table-header table { color: #000000; } td.table-header table a:link { color: #0000ff; } td.table-header table a:visited { color: #204080; } span.table-header { font-size: 120%; font-weight: bold; } th.group-header { background: #c0e0f8; color: #000000; text-align: left; font-style: italic; font-size: 115%; border: 1px solid #608090; } /* Summary Tables (functions, variables, etc) * - Each object is described by a single row of the table with * two cells. The left cell gives the object's type, and is * marked with 'code.summary-type'. The right cell gives the * object's name and a summary description. * - CSS styles for the table's header and group headers are * defined above, under 'Table Headers' */ table.summary { border-collapse: collapse; background: #e8f0f8; color: #000000; border: 1px solid #608090; margin-bottom: 0.5em; } td.summary { border: 1px solid #608090; } code.summary-type { font-size: 85%; } table.summary a:link { color: #0000ff; } table.summary a:visited { color: #204080; } /* Details Tables (functions, variables, etc) * - Each object is described in its own div. * - A single-row summary table w/ table-header is used as * a header for each details section (CSS style for table-header * is defined above, under 'Table Headers'). */ table.details { border-collapse: collapse; background: #e8f0f8; color: #000000; border: 1px solid #608090; margin: .2em 0 0 0; } table.details table { color: #000000; } table.details a:link { color: #0000ff; } table.details a:visited { color: #204080; } /* Fields */ dl.fields { margin-left: 2em; margin-top: 1em; margin-bottom: 1em; } dl.fields dd ul { margin-left: 0em; padding-left: 0em; } div.fields { margin-left: 2em; } div.fields p { margin-bottom: 0.5em; } /* Index tables (identifier index, term index, etc) * - link-index is used for indices containing lists of links * (namely, the identifier index & term index). * - index-where is used in link indices for the text indicating * the container/source for each link. * - metadata-index is used for indices containing metadata * extracted from fields (namely, the bug index & todo index). */ table.link-index { border-collapse: collapse; background: #e8f0f8; color: #000000; border: 1px solid #608090; } td.link-index { border-width: 0px; } table.link-index a:link { color: #0000ff; } table.link-index a:visited { color: #204080; } span.index-where { font-size: 70%; } table.metadata-index { border-collapse: collapse; background: #e8f0f8; color: #000000; border: 1px solid #608090; margin: .2em 0 0 0; } td.metadata-index { border-width: 1px; border-style: solid; } table.metadata-index a:link { color: #0000ff; } table.metadata-index a:visited { color: #204080; } /* Function signatures * - sig* is used for the signature in the details section. * - .summary-sig* is used for the signature in the summary * table, and when listing property accessor functions. * */ .sig-name { color: #006080; } .sig-arg { color: #008060; } .sig-default { color: #602000; } .summary-sig { font-family: monospace; } .summary-sig-name { color: #006080; font-weight: bold; } table.summary a.summary-sig-name:link { color: #006080; font-weight: bold; } table.summary a.summary-sig-name:visited { color: #006080; font-weight: bold; } .summary-sig-arg { color: #006040; } .summary-sig-default { color: #501800; } /* To render variables, classes etc. like functions */ table.summary .summary-name { color: #006080; font-weight: bold; font-family: monospace; } table.summary a.summary-name:link { color: #006080; font-weight: bold; font-family: monospace; } table.summary a.summary-name:visited { color: #006080; font-weight: bold; font-family: monospace; } /* Variable values * - In the 'variable details' sections, each varaible's value is * listed in a 'pre.variable' box. The width of this box is * restricted to 80 chars; if the value's repr is longer than * this it will be wrapped, using a backslash marked with * class 'variable-linewrap'. If the value's repr is longer * than 3 lines, the rest will be ellided; and an ellipsis * marker ('...' marked with 'variable-ellipsis') will be used. * - If the value is a string, its quote marks will be marked * with 'variable-quote'. * - If the variable is a regexp, it is syntax-highlighted using * the re* CSS classes. */ pre.variable { padding: .5em; margin: 0; background: #dce4ec; color: #000000; border: 1px solid #708890; } .variable-linewrap { color: #604000; font-weight: bold; } .variable-ellipsis { color: #604000; font-weight: bold; } .variable-quote { color: #604000; font-weight: bold; } .variable-group { color: #008000; font-weight: bold; } .variable-op { color: #604000; font-weight: bold; } .variable-string { color: #006030; } .variable-unknown { color: #a00000; font-weight: bold; } .re { color: #000000; } .re-char { color: #006030; } .re-op { color: #600000; } .re-group { color: #003060; } .re-ref { color: #404040; } /* Base tree * - Used by class pages to display the base class hierarchy. */ pre.base-tree { font-size: 80%; margin: 0; } /* Frames-based table of contents headers * - Consists of two frames: one for selecting modules; and * the other listing the contents of the selected module. * - h1.toc is used for each frame's heading * - h2.toc is used for subheadings within each frame. */ h1.toc { text-align: center; font-size: 105%; margin: 0; font-weight: bold; padding: 0; } h2.toc { font-size: 100%; font-weight: bold; margin: 0.5em 0 0 -0.3em; } /* Syntax Highlighting for Source Code * - doctest examples are displayed in a 'pre.py-doctest' block. * If the example is in a details table entry, then it will use * the colors specified by the 'table pre.py-doctest' line. * - Source code listings are displayed in a 'pre.py-src' block. * Each line is marked with 'span.py-line' (used to draw a line * down the left margin, separating the code from the line * numbers). Line numbers are displayed with 'span.py-lineno'. * The expand/collapse block toggle button is displayed with * 'a.py-toggle' (Note: the CSS style for 'a.py-toggle' should not * modify the font size of the text.) * - If a source code page is opened with an anchor, then the * corresponding code block will be highlighted. The code * block's header is highlighted with 'py-highlight-hdr'; and * the code block's body is highlighted with 'py-highlight'. * - The remaining py-* classes are used to perform syntax * highlighting (py-string for string literals, py-name for names, * etc.) */ pre.py-doctest { padding: .5em; margin: 1em; background: #e8f0f8; color: #000000; border: 1px solid #708890; } table pre.py-doctest { background: #dce4ec; color: #000000; } pre.py-src { border: 2px solid #000000; background: #f0f0f0; color: #000000; } .py-line { border-left: 2px solid #000000; margin-left: .2em; padding-left: .4em; } .py-lineno { font-style: italic; font-size: 90%; padding-left: .5em; } a.py-toggle { text-decoration: none; } div.py-highlight-hdr { border-top: 2px solid #000000; border-bottom: 2px solid #000000; background: #d8e8e8; } div.py-highlight { border-bottom: 2px solid #000000; background: #d0e0e0; } .py-prompt { color: #005050; font-weight: bold;} .py-more { color: #005050; font-weight: bold;} .py-string { color: #006030; } .py-comment { color: #003060; } .py-keyword { color: #600000; } .py-output { color: #404040; } .py-name { color: #000050; } .py-name:link { color: #000050 !important; } .py-name:visited { color: #000050 !important; } .py-number { color: #005000; } .py-defname { color: #000060; font-weight: bold; } .py-def-name { color: #000060; font-weight: bold; } .py-base-class { color: #000060; } .py-param { color: #000060; } .py-docstring { color: #006030; } .py-decorator { color: #804020; } /* Use this if you don't want links to names underlined: */ /*a.py-name { text-decoration: none; }*/ /* Graphs & Diagrams * - These CSS styles are used for graphs & diagrams generated using * Graphviz dot. 'img.graph-without-title' is used for bare * diagrams (to remove the border created by making the image * clickable). */ img.graph-without-title { border: none; } img.graph-with-title { border: 1px solid #000000; } span.graph-title { font-weight: bold; } span.graph-caption { } /* General-purpose classes * - 'p.indent-wrapped-lines' defines a paragraph whose first line * is not indented, but whose subsequent lines are. * - The 'nomargin-top' class is used to remove the top margin (e.g. * from lists). The 'nomargin' class is used to remove both the * top and bottom margin (but not the left or right margin -- * for lists, that would cause the bullets to disappear.) */ p.indent-wrapped-lines { padding: 0 0 0 7em; text-indent: -7em; margin: 0; } .nomargin-top { margin-top: 0; } .nomargin { margin-top: 0; margin-bottom: 0; } /* HTML Log */ div.log-block { padding: 0; margin: .5em 0 .5em 0; background: #e8f0f8; color: #000000; border: 1px solid #000000; } div.log-error { padding: .1em .3em .1em .3em; margin: 4px; background: #ffb0b0; color: #000000; border: 1px solid #000000; } div.log-warning { padding: .1em .3em .1em .3em; margin: 4px; background: #ffffb0; color: #000000; border: 1px solid #000000; } div.log-info { padding: .1em .3em .1em .3em; margin: 4px; background: #b0ffb0; color: #000000; border: 1px solid #000000; } h2.log-hdr { background: #70b0ff; color: #000000; margin: 0; padding: 0em 0.5em 0em 0.5em; border-bottom: 1px solid #000000; font-size: 110%; } p.log { font-weight: bold; margin: .5em 0 .5em 0; } tr.opt-changed { color: #000000; font-weight: bold; } tr.opt-default { color: #606060; } pre.log { margin: 0; padding: 0; padding-left: 1em; } OWL-RL-7.1.4/owlrl/000077500000000000000000000000001504201166100136325ustar00rootroot00000000000000OWL-RL-7.1.4/owlrl/AxiomaticTriples.py000077500000000000000000000645711504201166100175050ustar00rootroot00000000000000# -*- coding: utf-8 -*- # """ Axiomatic triples to be (possibly) added to the final graph. **Requires**: `RDFLib`_, 4.0.0 and higher. .. _RDFLib: https://github.com/RDFLib/rdflib **License**: This software is available for use under the `W3C Software License`_. .. _W3C Software License: http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 **Organization**: `World Wide Web Consortium`_ .. _World Wide Web Consortium: http://www.w3.org **Author**: `Ivan Herman`_ .. _Ivan Herman: http://www.w3.org/People/Ivan/ """ __author__ = "Ivan Herman" __contact__ = "Ivan Herman, ivan@w3.org" __license__ = "W3C® SOFTWARE NOTICE AND LICENSE, http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231" from rdflib.namespace import OWL, RDF, RDFS, XSD # Simple RDF axiomatic triples (typing of subject, predicate, first, rest, etc) _Simple_RDF_axiomatic_triples = [ (RDF.type, RDF.type, RDF.Property), (RDF.subject, RDF.type, RDF.Property), (RDF.predicate, RDF.type, RDF.Property), (RDF.object, RDF.type, RDF.Property), (RDF.first, RDF.type, RDF.Property), (RDF.rest, RDF.type, RDF.Property), (RDF.value, RDF.type, RDF.Property), (RDF.nil, RDF.type, RDF.List), ] # RDFS axiomatic triples (domain and range, as well as class setting for a number of RDFS symbols) _RDFS_axiomatic_triples = [ (RDF.type, RDFS.domain, RDFS.Resource), (RDFS.domain, RDFS.domain, RDF.Property), (RDFS.range, RDFS.domain, RDF.Property), (RDFS.subPropertyOf, RDFS.domain, RDF.Property), (RDFS.subClassOf, RDFS.domain, RDFS.Class), (RDF.subject, RDFS.domain, RDF.Statement), (RDF.predicate, RDFS.domain, RDF.Statement), (RDF.object, RDFS.domain, RDF.Statement), (RDFS.member, RDFS.domain, RDFS.Resource), (RDF.first, RDFS.domain, RDF.List), (RDF.rest, RDFS.domain, RDF.List), (RDFS.seeAlso, RDFS.domain, RDFS.Resource), (RDFS.isDefinedBy, RDFS.domain, RDFS.Resource), (RDFS.comment, RDFS.domain, RDFS.Resource), (RDFS.label, RDFS.domain, RDFS.Resource), (RDF.value, RDFS.domain, RDFS.Resource), (RDF.Property, RDF.type, RDFS.Class), (RDF.type, RDFS.range, RDFS.Class), (RDFS.domain, RDFS.range, RDFS.Class), (RDFS.range, RDFS.range, RDFS.Class), (RDFS.subPropertyOf, RDFS.range, RDF.Property), (RDFS.subClassOf, RDFS.range, RDFS.Class), (RDF.subject, RDFS.range, RDFS.Resource), (RDF.predicate, RDFS.range, RDFS.Resource), (RDF.object, RDFS.range, RDFS.Resource), (RDFS.member, RDFS.range, RDFS.Resource), (RDF.first, RDFS.range, RDFS.Resource), (RDF.rest, RDFS.range, RDF.List), (RDFS.seeAlso, RDFS.range, RDFS.Resource), (RDFS.isDefinedBy, RDFS.range, RDFS.Resource), (RDFS.comment, RDFS.range, RDFS.Literal), (RDFS.label, RDFS.range, RDFS.Literal), (RDF.value, RDFS.range, RDFS.Resource), (RDF.Alt, RDFS.subClassOf, RDFS.Container), (RDF.Bag, RDFS.subClassOf, RDFS.Container), (RDF.Seq, RDFS.subClassOf, RDFS.Container), (RDFS.ContainerMembershipProperty, RDFS.subClassOf, RDF.Property), (RDFS.isDefinedBy, RDFS.subPropertyOf, RDFS.seeAlso), (RDF.XMLLiteral, RDF.type, RDFS.Datatype), (RDF.XMLLiteral, RDFS.subClassOf, RDFS.Literal), (RDFS.Datatype, RDFS.subClassOf, RDFS.Class), # rdfs valid triples; these would be inferred by the RDFS expansion, but it may make things # a bit faster to add these upfront (RDFS.Resource, RDF.type, RDFS.Class), (RDFS.Class, RDF.type, RDFS.Class), (RDFS.Literal, RDF.type, RDFS.Class), (RDF.XMLLiteral, RDF.type, RDFS.Class), (RDFS.Datatype, RDF.type, RDFS.Class), (RDF.Seq, RDF.type, RDFS.Class), (RDF.Bag, RDF.type, RDFS.Class), (RDF.Alt, RDF.type, RDFS.Class), (RDFS.Container, RDF.type, RDFS.Class), (RDF.List, RDF.type, RDFS.Class), (RDFS.ContainerMembershipProperty, RDF.type, RDFS.Class), (RDF.Property, RDF.type, RDFS.Class), (RDF.Statement, RDF.type, RDFS.Class), (RDFS.domain, RDF.type, RDF.Property), (RDFS.range, RDF.type, RDF.Property), (RDFS.subPropertyOf, RDF.type, RDF.Property), (RDFS.subClassOf, RDF.type, RDF.Property), (RDFS.member, RDF.type, RDF.Property), (RDFS.seeAlso, RDF.type, RDF.Property), (RDFS.isDefinedBy, RDF.type, RDF.Property), (RDFS.comment, RDF.type, RDF.Property), (RDFS.label, RDF.type, RDF.Property), ] # RDFS Axiomatic Triples all together RDFS_Axiomatic_Triples = _Simple_RDF_axiomatic_triples + _RDFS_axiomatic_triples # RDFS D-entailement triples, ie, possible subclassing of various datatypes RDFS_D_Axiomatic_Triples_subclasses = [ # See http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#built-in-datatypes (XSD.decimal, RDFS.subClassOf, RDFS.Literal), (XSD.integer, RDFS.subClassOf, XSD.decimal), (XSD.long, RDFS.subClassOf, XSD.integer), (XSD.int, RDFS.subClassOf, XSD.long), (XSD.short, RDFS.subClassOf, XSD.int), (XSD.byte, RDFS.subClassOf, XSD.short), (XSD.nonNegativeInteger, RDFS.subClassOf, XSD.integer), (XSD.positiveInteger, RDFS.subClassOf, XSD.nonNegativeInteger), (XSD.unsignedLong, RDFS.subClassOf, XSD.nonNegativeInteger), (XSD.unsignedInt, RDFS.subClassOf, XSD.unsignedLong), (XSD.unsignedShort, RDFS.subClassOf, XSD.unsignedInt), (XSD.unsignedByte, RDFS.subClassOf, XSD.unsignedShort), (XSD.nonPositiveInteger, RDFS.subClassOf, XSD.integer), (XSD.negativeInteger, RDFS.subClassOf, XSD.nonPositiveInteger), (XSD.normalizedString, RDFS.subClassOf, XSD.string), (XSD.token, RDFS.subClassOf, XSD.normalizedString), (XSD.language, RDFS.subClassOf, XSD.token), (XSD.Name, RDFS.subClassOf, XSD.token), (XSD.NMTOKEN, RDFS.subClassOf, XSD.token), (XSD.NCName, RDFS.subClassOf, XSD.Name), (XSD.dateTimeStamp, RDFS.subClassOf, XSD.dateTime), ] # RDFS_D_Axiomatic_Triples_types = [ (XSD.integer, RDF.type, RDFS.Datatype), (XSD.decimal, RDF.type, RDFS.Datatype), (XSD.nonPositiveInteger, RDF.type, RDFS.Datatype), (XSD.nonPositiveInteger, RDF.type, RDFS.Datatype), (XSD.positiveInteger, RDF.type, RDFS.Datatype), (XSD.positiveInteger, RDF.type, RDFS.Datatype), (XSD.long, RDF.type, RDFS.Datatype), (XSD.int, RDF.type, RDFS.Datatype), (XSD.short, RDF.type, RDFS.Datatype), (XSD.byte, RDF.type, RDFS.Datatype), (XSD.unsignedLong, RDF.type, RDFS.Datatype), (XSD.unsignedInt, RDF.type, RDFS.Datatype), (XSD.unsignedShort, RDF.type, RDFS.Datatype), (XSD.unsignedByte, RDF.type, RDFS.Datatype), (XSD.float, RDF.type, RDFS.Datatype), (XSD.double, RDF.type, RDFS.Datatype), (XSD.string, RDF.type, RDFS.Datatype), (XSD.normalizedString, RDF.type, RDFS.Datatype), (XSD.token, RDF.type, RDFS.Datatype), (XSD.language, RDF.type, RDFS.Datatype), (XSD.Name, RDF.type, RDFS.Datatype), (XSD.NCName, RDF.type, RDFS.Datatype), (XSD.NMTOKEN, RDF.type, RDFS.Datatype), (XSD.boolean, RDF.type, RDFS.Datatype), (XSD.hexBinary, RDF.type, RDFS.Datatype), (XSD.base64Binary, RDF.type, RDFS.Datatype), (XSD.anyURI, RDF.type, RDFS.Datatype), (XSD.dateTimeStamp, RDF.type, RDFS.Datatype), (XSD.dateTime, RDF.type, RDFS.Datatype), (RDFS.Literal, RDF.type, RDFS.Datatype), (RDF.XMLLiteral, RDF.type, RDFS.Datatype), ] RDFS_D_Axiomatic_Triples = ( RDFS_D_Axiomatic_Triples_types + RDFS_D_Axiomatic_Triples_subclasses ) # OWL Class axiomatic triples: definition of special classes _OWL_axiomatic_triples_Classes = [ (OWL.AllDifferent, RDF.type, RDFS.Class), (OWL.AllDifferent, RDFS.subClassOf, RDFS.Resource), (OWL.AllDisjointClasses, RDF.type, RDFS.Class), (OWL.AllDisjointClasses, RDFS.subClassOf, RDFS.Resource), (OWL.AllDisjointProperties, RDF.type, RDFS.Class), (OWL.AllDisjointProperties, RDFS.subClassOf, RDFS.Resource), (OWL.Annotation, RDF.type, RDFS.Class), (OWL.Annotation, RDFS.subClassOf, RDFS.Resource), (OWL.AnnotationProperty, RDF.type, RDFS.Class), (OWL.AnnotationProperty, RDFS.subClassOf, RDF.Property), (OWL.AsymmetricProperty, RDF.type, RDFS.Class), (OWL.AsymmetricProperty, RDFS.subClassOf, RDF.Property), (OWL.Class, RDF.type, RDFS.Class), (OWL.Class, OWL.equivalentClass, RDFS.Class), # (OWL.DataRange, RDF.type, RDFS.Class), # (OWL.DataRange, OWL.equivalentClass, RDFS.Datatype), (RDFS.Datatype, RDF.type, RDFS.Class), (OWL.DatatypeProperty, RDF.type, RDFS.Class), (OWL.DatatypeProperty, RDFS.subClassOf, RDF.Property), (OWL.DeprecatedClass, RDF.type, RDFS.Class), (OWL.DeprecatedClass, RDFS.subClassOf, RDFS.Class), (OWL.DeprecatedProperty, RDF.type, RDFS.Class), (OWL.DeprecatedProperty, RDFS.subClassOf, RDF.Property), (OWL.FunctionalProperty, RDF.type, RDFS.Class), (OWL.FunctionalProperty, RDFS.subClassOf, RDF.Property), (OWL.InverseFunctionalProperty, RDF.type, RDFS.Class), (OWL.InverseFunctionalProperty, RDFS.subClassOf, RDF.Property), (OWL.IrreflexiveProperty, RDF.type, RDFS.Class), (OWL.IrreflexiveProperty, RDFS.subClassOf, RDF.Property), (RDFS.Literal, RDF.type, RDFS.Datatype), # (OWL.NamedIndividual, RDF.type, RDFS.Class), # (OWL.NamedIndividual, OWL.equivalentClass, RDFS.Resource), (OWL.NegativePropertyAssertion, RDF.type, RDFS.Class), (OWL.NegativePropertyAssertion, RDFS.subClassOf, RDFS.Resource), (OWL.Nothing, RDF.type, RDFS.Class), (OWL.Nothing, RDFS.subClassOf, OWL.Thing), (OWL.ObjectProperty, RDF.type, RDFS.Class), (OWL.ObjectProperty, OWL.equivalentClass, RDF.Property), (OWL.Ontology, RDF.type, RDFS.Class), (OWL.Ontology, RDFS.subClassOf, RDFS.Resource), (OWL.OntologyProperty, RDF.type, RDFS.Class), (OWL.OntologyProperty, RDFS.subClassOf, RDF.Property), (RDF.Property, RDF.type, RDFS.Class), (OWL.ReflexiveProperty, RDF.type, RDFS.Class), (OWL.ReflexiveProperty, RDFS.subClassOf, RDF.Property), (OWL.Restriction, RDF.type, RDFS.Class), (OWL.Restriction, RDFS.subClassOf, RDFS.Class), (OWL.SymmetricProperty, RDF.type, RDFS.Class), (OWL.SymmetricProperty, RDFS.subClassOf, RDF.Property), (OWL.Thing, RDF.type, RDFS.Class), (OWL.Thing, RDFS.subClassOf, RDFS.Resource), (OWL.TransitiveProperty, RDF.type, RDFS.Class), (OWL.TransitiveProperty, RDFS.subClassOf, RDF.Property), # OWL valid triples; some of these would be inferred by the OWL RL expansion, but it may make things # a bit faster to add these upfront (OWL.AllDisjointProperties, RDF.type, OWL.Class), (OWL.AllDisjointClasses, RDF.type, OWL.Class), (OWL.AllDisjointProperties, RDF.type, OWL.Class), (OWL.Annotation, RDF.type, OWL.Class), (OWL.AsymmetricProperty, RDF.type, OWL.Class), (OWL.Axiom, RDF.type, OWL.Class), (OWL.DataRange, RDF.type, OWL.Class), (RDFS.Datatype, RDF.type, OWL.Class), (OWL.DatatypeProperty, RDF.type, OWL.Class), (OWL.DeprecatedClass, RDF.type, OWL.Class), (OWL.DeprecatedClass, RDFS.subClassOf, OWL.Class), (OWL.DeprecatedProperty, RDF.type, OWL.Class), (OWL.FunctionalProperty, RDF.type, OWL.Class), (OWL.InverseFunctionalProperty, RDF.type, OWL.Class), (OWL.IrreflexiveProperty, RDF.type, OWL.Class), (OWL.NamedIndividual, RDF.type, OWL.Class), (OWL.NegativePropertyAssertion, RDF.type, OWL.Class), (OWL.Nothing, RDF.type, OWL.Class), (OWL.ObjectProperty, RDF.type, OWL.Class), (OWL.Ontology, RDF.type, OWL.Class), (OWL.OntologyProperty, RDF.type, OWL.Class), (RDF.Property, RDF.type, OWL.Class), (OWL.ReflexiveProperty, RDF.type, OWL.Class), (OWL.Restriction, RDF.type, OWL.Class), (OWL.Restriction, RDFS.subClassOf, OWL.Class), # (OWL.SelfRestriction, RDF.type, OWL.Class), (OWL.SymmetricProperty, RDF.type, OWL.Class), (OWL.Thing, RDF.type, OWL.Class), (OWL.TransitiveProperty, RDF.type, OWL.Class), ] # OWL Property axiomatic triples: definition of domains and ranges _OWL_axiomatic_triples_Properties = [ (OWL.allValuesFrom, RDF.type, RDF.Property), (OWL.allValuesFrom, RDFS.domain, OWL.Restriction), (OWL.allValuesFrom, RDFS.range, RDFS.Class), (OWL.assertionProperty, RDF.type, RDF.Property), (OWL.assertionProperty, RDFS.domain, OWL.NegativePropertyAssertion), (OWL.assertionProperty, RDFS.range, RDF.Property), (OWL.backwardCompatibleWith, RDF.type, OWL.OntologyProperty), (OWL.backwardCompatibleWith, RDF.type, OWL.AnnotationProperty), (OWL.backwardCompatibleWith, RDFS.domain, OWL.Ontology), (OWL.backwardCompatibleWith, RDFS.range, OWL.Ontology), # (OWL.bottomDataProperty, RDF.type, RDFS.DatatypeProperty), # (OWL.bottomObjectProperty, RDF.type, OWL.ObjectProperty), # (OWL.cardinality, RDF.type, RDF.Property), # (OWL.cardinality, RDFS.domain, OWL.Restriction), # (OWL.cardinality, RDFS.range, XSD.nonNegativeInteger), (RDFS.comment, RDF.type, OWL.AnnotationProperty), (RDFS.comment, RDFS.domain, RDFS.Resource), (RDFS.comment, RDFS.range, RDFS.Literal), (OWL.complementOf, RDF.type, RDF.Property), (OWL.complementOf, RDFS.domain, RDFS.Class), (OWL.complementOf, RDFS.range, RDFS.Class), # (OWL.datatypeComplementOf, RDF.type, RDF.Property), # (OWL.datatypeComplementOf, RDFS.domain, RDFS.Datatype), # (OWL.datatypeComplementOf, RDFS.range, RDFS.Datatype), (OWL.deprecated, RDF.type, OWL.AnnotationProperty), (OWL.deprecated, RDFS.domain, RDFS.Resource), (OWL.deprecated, RDFS.range, RDFS.Resource), (OWL.differentFrom, RDF.type, RDF.Property), (OWL.differentFrom, RDFS.domain, RDFS.Resource), (OWL.differentFrom, RDFS.range, RDFS.Resource), # (OWL.disjointUnionOf, RDF.type, RDF.Property), # (OWL.disjointUnionOf, RDFS.domain, RDFS.Class), # (OWL.disjointUnionOf, RDFS.range, RDF.List), (OWL.disjointWith, RDF.type, RDF.Property), (OWL.disjointWith, RDFS.domain, RDFS.Class), (OWL.disjointWith, RDFS.range, RDFS.Class), (OWL.distinctMembers, RDF.type, RDF.Property), (OWL.distinctMembers, RDFS.domain, OWL.AllDifferent), (OWL.distinctMembers, RDFS.range, RDF.List), (OWL.equivalentClass, RDF.type, RDF.Property), (OWL.equivalentClass, RDFS.domain, RDFS.Class), (OWL.equivalentClass, RDFS.range, RDFS.Class), (OWL.equivalentProperty, RDF.type, RDF.Property), (OWL.equivalentProperty, RDFS.domain, RDF.Property), (OWL.equivalentProperty, RDFS.range, RDF.Property), (OWL.hasKey, RDF.type, RDF.Property), (OWL.hasKey, RDFS.domain, RDFS.Class), (OWL.hasKey, RDFS.range, RDF.List), (OWL.hasValue, RDF.type, RDF.Property), (OWL.hasValue, RDFS.domain, OWL.Restriction), (OWL.hasValue, RDFS.range, RDFS.Resource), (OWL.imports, RDF.type, OWL.OntologyProperty), (OWL.imports, RDFS.domain, OWL.Ontology), (OWL.imports, RDFS.range, OWL.Ontology), (OWL.incompatibleWith, RDF.type, OWL.OntologyProperty), (OWL.incompatibleWith, RDF.type, OWL.AnnotationProperty), (OWL.incompatibleWith, RDFS.domain, OWL.Ontology), (OWL.incompatibleWith, RDFS.range, OWL.Ontology), (OWL.intersectionOf, RDF.type, RDF.Property), (OWL.intersectionOf, RDFS.domain, RDFS.Class), (OWL.intersectionOf, RDFS.range, RDF.List), (OWL.inverseOf, RDF.type, RDF.Property), (OWL.inverseOf, RDFS.domain, RDF.Property), (OWL.inverseOf, RDFS.range, RDF.Property), (RDFS.isDefinedBy, RDF.type, OWL.AnnotationProperty), (RDFS.isDefinedBy, RDFS.domain, RDFS.Resource), (RDFS.isDefinedBy, RDFS.range, RDFS.Resource), (RDFS.label, RDF.type, OWL.AnnotationProperty), (RDFS.label, RDFS.domain, RDFS.Resource), (RDFS.label, RDFS.range, RDFS.Literal), (OWL.maxCardinality, RDF.type, RDF.Property), (OWL.maxCardinality, RDFS.domain, OWL.Restriction), (OWL.maxCardinality, RDFS.range, XSD.nonNegativeInteger), (OWL.maxQualifiedCardinality, RDF.type, RDF.Property), (OWL.maxQualifiedCardinality, RDFS.domain, OWL.Restriction), (OWL.maxQualifiedCardinality, RDFS.range, XSD.nonNegativeInteger), (OWL.members, RDF.type, RDF.Property), (OWL.members, RDFS.domain, RDFS.Resource), (OWL.members, RDFS.range, RDF.List), # (OWL.minCardinality, RDF.type, RDF.Property), # (OWL.minCardinality, RDFS.domain, OWL.Restriction), # (OWL.minCardinality, RDFS.range, XSD.nonNegativeInteger), # (OWL.minQualifiedCardinality, RDF.type, RDF.Property), # (OWL.minQualifiedCardinality, RDFS.domain, OWL.Restriction), # (OWL.minQualifiedCardinality, RDFS.range, XSD.nonNegativeInteger), # (OWL.annotatedTarget, RDF.type, RDF.Property), # (OWL.annotatedTarget, RDFS.domain, RDFS.Resource), # (OWL.annotatedTarget, RDFS.range, RDFS.Resource), (OWL.onClass, RDF.type, RDF.Property), (OWL.onClass, RDFS.domain, OWL.Restriction), (OWL.onClass, RDFS.range, RDFS.Class), # (OWL.onDataRange, RDF.type, RDF.Property), # (OWL.onDataRange, RDFS.domain, OWL.Restriction), # (OWL.onDataRange, RDFS.range, RDFS.Datatype), (OWL.onDatatype, RDF.type, RDF.Property), (OWL.onDatatype, RDFS.domain, RDFS.Datatype), (OWL.onDatatype, RDFS.range, RDFS.Datatype), (OWL.oneOf, RDF.type, RDF.Property), (OWL.oneOf, RDFS.domain, RDFS.Class), (OWL.oneOf, RDFS.range, RDF.List), (OWL.onProperty, RDF.type, RDF.Property), (OWL.onProperty, RDFS.domain, OWL.Restriction), (OWL.onProperty, RDFS.range, RDF.Property), # (OWL.onProperties, RDF.type, RDF.Property), # (OWL.onProperties, RDFS.domain, OWL.Restriction), # (OWL.onProperties, RDFS.range, RDF.List), # (OWL.annotatedProperty, RDF.type, RDF.Property), # (OWL.annotatedProperty, RDFS.domain, RDFS.Resource), # (OWL.annotatedProperty, RDFS.range, RDF.Property), (OWL.priorVersion, RDF.type, OWL.OntologyProperty), (OWL.priorVersion, RDF.type, OWL.AnnotationProperty), (OWL.priorVersion, RDFS.domain, OWL.Ontology), (OWL.priorVersion, RDFS.range, OWL.Ontology), (OWL.propertyChainAxiom, RDF.type, RDF.Property), (OWL.propertyChainAxiom, RDFS.domain, RDF.Property), (OWL.propertyChainAxiom, RDFS.range, RDF.List), # (OWL.propertyDisjointWith, RDF.type, RDF.Property), # (OWL.propertyDisjointWith, RDFS.domain, RDF.Property), # (OWL.propertyDisjointWith, RDFS.range, RDF.Property), # # (OWL.qualifiedCardinality, RDF.type, RDF.Property), # (OWL.qualifiedCardinality, RDFS.domain, OWL.Restriction), # (OWL.qualifiedCardinality, RDFS.range, XSD.nonNegativeInteger), (OWL.sameAs, RDF.type, RDF.Property), (OWL.sameAs, RDFS.domain, RDFS.Resource), (OWL.sameAs, RDFS.range, RDFS.Resource), (RDFS.seeAlso, RDF.type, OWL.AnnotationProperty), (RDFS.seeAlso, RDFS.domain, RDFS.Resource), (RDFS.seeAlso, RDFS.range, RDFS.Resource), (OWL.someValuesFrom, RDF.type, RDF.Property), (OWL.someValuesFrom, RDFS.domain, OWL.Restriction), (OWL.someValuesFrom, RDFS.range, RDFS.Class), (OWL.sourceIndividual, RDF.type, RDF.Property), (OWL.sourceIndividual, RDFS.domain, OWL.NegativePropertyAssertion), (OWL.sourceIndividual, RDFS.range, RDFS.Resource), # # (OWL.annotatedSource, RDF.type, RDF.Property), # (OWL.annotatedSource, RDFS.domain, RDFS.Resource), # (OWL.annotatedSource, RDFS.range, RDFS.Resource), # (OWL.targetIndividual, RDF.type, RDF.Property), (OWL.targetIndividual, RDFS.domain, OWL.NegativePropertyAssertion), (OWL.targetIndividual, RDFS.range, RDFS.Resource), (OWL.targetValue, RDF.type, RDF.Property), (OWL.targetValue, RDFS.domain, OWL.NegativePropertyAssertion), (OWL.targetValue, RDFS.range, RDFS.Literal), # (OWL.topDataProperty, RDF.type, RDFS.DatatypeProperty), # (OWL.topDataProperty, RDFS.domain, RDFS.Resource), # (OWL.topDataProperty, RDFS.range, RDFS.Literal), # # (OWL.topObjectProperty, RDF.type, OWL.ObjectProperty), # (OWL.topObjectProperty, RDFS.domain, RDFS.Resource), # (OWL.topObjectProperty, RDFS.range, RDFS.Resource), (OWL.unionOf, RDF.type, RDF.Property), (OWL.unionOf, RDFS.domain, RDFS.Class), (OWL.unionOf, RDFS.range, RDF.List), (OWL.versionInfo, RDF.type, OWL.AnnotationProperty), (OWL.versionInfo, RDFS.domain, RDFS.Resource), (OWL.versionInfo, RDFS.range, RDFS.Resource), (OWL.versionIRI, RDF.type, OWL.AnnotationProperty), (OWL.versionIRI, RDFS.domain, RDFS.Resource), (OWL.versionIRI, RDFS.range, RDFS.Resource), (OWL.withRestrictions, RDF.type, RDF.Property), (OWL.withRestrictions, RDFS.domain, RDFS.Datatype), (OWL.withRestrictions, RDFS.range, RDF.List), # some OWL valid triples; these would be inferred by the OWL RL expansion, but it may make things # a bit faster to add these upfront (OWL.allValuesFrom, RDFS.range, OWL.Class), (OWL.complementOf, RDFS.domain, OWL.Class), (OWL.complementOf, RDFS.range, OWL.Class), # (OWL.datatypeComplementOf, domain, OWL.DataRange), # (OWL.datatypeComplementOf, range, OWL.DataRange), (OWL.disjointUnionOf, RDFS.domain, OWL.Class), (OWL.disjointWith, RDFS.domain, OWL.Class), (OWL.disjointWith, RDFS.range, OWL.Class), (OWL.equivalentClass, RDFS.domain, OWL.Class), (OWL.equivalentClass, RDFS.range, OWL.Class), (OWL.hasKey, RDFS.domain, OWL.Class), (OWL.intersectionOf, RDFS.domain, OWL.Class), (OWL.onClass, RDFS.range, OWL.Class), # (OWL.onDataRange, RDFS.range, OWL.DataRange), (OWL.onDatatype, RDFS.domain, OWL.DataRange), (OWL.onDatatype, RDFS.range, OWL.DataRange), (OWL.oneOf, RDFS.domain, OWL.Class), (OWL.someValuesFrom, RDFS.range, OWL.Class), (OWL.unionOf, RDFS.range, OWL.Class), # (OWL.withRestrictions, RDFS.domain, OWL.DataRange) ] # OWL RL axiomatic triples: combination of the RDFS triples plus the OWL specific ones OWLRL_Axiomatic_Triples = ( _OWL_axiomatic_triples_Classes + _OWL_axiomatic_triples_Properties ) # Note that this is not used anywhere. But I encoded it once and I did not want to remove it...:-) _OWL_axiomatic_triples_Facets = [ # langPattern (XSD.length, RDF.type, RDF.Property), (XSD.maxExclusive, RDF.type, RDF.Property), (XSD.maxInclusive, RDF.type, RDF.Property), (XSD.maxLength, RDF.type, RDF.Property), (XSD.minExclusive, RDF.type, RDF.Property), (XSD.minInclusive, RDF.type, RDF.Property), (XSD.minLength, RDF.type, RDF.Property), (XSD.pattern, RDF.type, RDF.Property), (XSD.length, RDFS.domain, RDFS.Resource), (XSD.maxExclusive, RDFS.domain, RDFS.Resource), (XSD.maxInclusive, RDFS.domain, RDFS.Resource), (XSD.maxLength, RDFS.domain, RDFS.Resource), (XSD.minExclusive, RDFS.domain, RDFS.Resource), (XSD.minInclusive, RDFS.domain, RDFS.Resource), (XSD.minLength, RDFS.domain, RDFS.Resource), (XSD.pattern, RDFS.domain, RDFS.Resource), (XSD.length, RDFS.domain, RDFS.Resource), (XSD.maxExclusive, RDFS.range, RDFS.Literal), (XSD.maxInclusive, RDFS.range, RDFS.Literal), (XSD.maxLength, RDFS.range, RDFS.Literal), (XSD.minExclusive, RDFS.range, RDFS.Literal), (XSD.minInclusive, RDFS.range, RDFS.Literal), (XSD.minLength, RDFS.range, RDFS.Literal), (XSD.pattern, RDFS.range, RDFS.Literal), ] # OWL D-entailment triples (additionally to the RDFS ones), ie, possible subclassing of various extra datatypes _OWL_D_Axiomatic_Triples_types = [(RDF.PlainLiteral, RDF.type, RDFS.Datatype)] # OWL_D_Axiomatic_Triples_subclasses = [ (XSD.string, RDFS.subClassOf, RDF.PlainLiteral), (XSD.normalizedString, RDFS.subClassOf, RDF.PlainLiteral), (XSD.token, RDFS.subClassOf, RDF.PlainLiteral), (XSD.Name, RDFS.subClassOf, RDF.PlainLiteral), (XSD.NCName, RDFS.subClassOf, RDF.PlainLiteral), (XSD.NMTOKEN, RDFS.subClassOf, RDF.PlainLiteral), ] # OWLRL_Datatypes_Disjointness = [ (XSD.anyURI, OWL.disjointWith, XSD.base64Binary), (XSD.anyURI, OWL.disjointWith, XSD.boolean), (XSD.anyURI, OWL.disjointWith, XSD.dateTime), (XSD.anyURI, OWL.disjointWith, XSD.decimal), (XSD.anyURI, OWL.disjointWith, XSD.double), (XSD.anyURI, OWL.disjointWith, XSD.float), (XSD.anyURI, OWL.disjointWith, XSD.hexBinary), (XSD.anyURI, OWL.disjointWith, XSD.string), (XSD.anyURI, OWL.disjointWith, RDF.PlainLiteral), (XSD.anyURI, OWL.disjointWith, RDF.XMLLiteral), (XSD.base64Binary, OWL.disjointWith, XSD.boolean), (XSD.base64Binary, OWL.disjointWith, XSD.dateTime), (XSD.base64Binary, OWL.disjointWith, XSD.decimal), (XSD.base64Binary, OWL.disjointWith, XSD.double), (XSD.base64Binary, OWL.disjointWith, XSD.float), (XSD.base64Binary, OWL.disjointWith, XSD.hexBinary), (XSD.base64Binary, OWL.disjointWith, XSD.string), (XSD.base64Binary, OWL.disjointWith, RDF.PlainLiteral), (XSD.base64Binary, OWL.disjointWith, RDF.XMLLiteral), (XSD.boolean, OWL.disjointWith, XSD.dateTime), (XSD.boolean, OWL.disjointWith, XSD.decimal), (XSD.boolean, OWL.disjointWith, XSD.double), (XSD.boolean, OWL.disjointWith, XSD.float), (XSD.boolean, OWL.disjointWith, XSD.hexBinary), (XSD.boolean, OWL.disjointWith, XSD.string), (XSD.boolean, OWL.disjointWith, RDF.PlainLiteral), (XSD.boolean, OWL.disjointWith, RDF.XMLLiteral), (XSD.dateTime, OWL.disjointWith, XSD.decimal), (XSD.dateTime, OWL.disjointWith, XSD.double), (XSD.dateTime, OWL.disjointWith, XSD.float), (XSD.dateTime, OWL.disjointWith, XSD.hexBinary), (XSD.dateTime, OWL.disjointWith, XSD.string), (XSD.dateTime, OWL.disjointWith, RDF.PlainLiteral), (XSD.dateTime, OWL.disjointWith, RDF.XMLLiteral), (XSD.decimal, OWL.disjointWith, XSD.double), (XSD.decimal, OWL.disjointWith, XSD.float), (XSD.decimal, OWL.disjointWith, XSD.hexBinary), (XSD.decimal, OWL.disjointWith, XSD.string), (XSD.decimal, OWL.disjointWith, RDF.PlainLiteral), (XSD.decimal, OWL.disjointWith, RDF.XMLLiteral), (XSD.double, OWL.disjointWith, XSD.float), (XSD.double, OWL.disjointWith, XSD.hexBinary), (XSD.double, OWL.disjointWith, XSD.string), (XSD.double, OWL.disjointWith, RDF.PlainLiteral), (XSD.double, OWL.disjointWith, RDF.XMLLiteral), (XSD.float, OWL.disjointWith, XSD.hexBinary), (XSD.float, OWL.disjointWith, XSD.string), (XSD.float, OWL.disjointWith, RDF.PlainLiteral), (XSD.float, OWL.disjointWith, RDF.XMLLiteral), (XSD.hexBinary, OWL.disjointWith, XSD.string), (XSD.hexBinary, OWL.disjointWith, RDF.PlainLiteral), (XSD.hexBinary, OWL.disjointWith, RDF.XMLLiteral), (XSD.string, OWL.disjointWith, RDF.XMLLiteral), ] # OWL RL D Axiomatic triples: combination of the RDFS ones, plus some extra statements on ranges and domains, plus # some OWL specific datatypes OWLRL_D_Axiomatic_Triples = ( RDFS_D_Axiomatic_Triples + _OWL_D_Axiomatic_Triples_types + OWL_D_Axiomatic_Triples_subclasses + OWLRL_Datatypes_Disjointness ) OWL-RL-7.1.4/owlrl/Closure.py000077500000000000000000000306211504201166100156250ustar00rootroot00000000000000# -*- coding: utf-8 -*- # """ The generic superclasses for various rule based semantics and the possible extensions. **Requires**: `RDFLib`_, 4.0.0 and higher. .. _RDFLib: https://github.com/RDFLib/rdflib **License**: This software is available for use under the `W3C Software License`_. .. _W3C Software License: http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 **Organization**: `World Wide Web Consortium`_ .. _World Wide Web Consortium: http://www.w3.org **Author**: `Ivan Herman`_ .. _Ivan Herman: http://www.w3.org/People/Ivan/ """ __author__ = "Ivan Herman" __contact__ = "Ivan Herman, ivan@w3.org" __license__ = "W3C® SOFTWARE NOTICE AND LICENSE, http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231" from typing import Union import rdflib from rdflib.namespace import RDF from rdflib import BNode, Literal, Graph, Dataset from .Namespaces import ERRNS try: from rdflib.graph import ConjunctiveGraph except ImportError: ConjunctiveGraph = Dataset debugGlobal = False offlineGeneration = False ###################################################################################################### # noinspection PyMethodMayBeStatic,PyPep8Naming,PyPep8Naming class Core: """ Core of the semantics management, dealing with the RDFS and other Semantic triples. The only reason to have it in a separate class is for an easier maintainability. This is a common superclass only. In the present module, it is subclassed by a :class:`.RDFSClosure.RDFS_Semantics` class and a :class:`.OWLRL.OWLRL_Semantics` classes. There are some methods that are implemented in the subclasses only, ie, this class cannot be used by itself! :param graph: The RDF graph to be extended. :type graph: :class:`rdflib.graph.Graph` :param axioms: Whether axioms should be added or not. :type axioms: bool :param daxioms: Whether datatype axioms should be added or not. :type daxioms: bool :param rdfs: Whether RDFS inference is also done (used in subclassed only). :type rdfs: bool :param destination: The destination graph to which the results are written. If None, use the source graph. :type destination: :class:`rdflib.graph.Graph` :var IMaxNum: Maximal index of :code:`rdf:_i` occurrence in the graph. :type IMaxNum: int :var graph: The real graph. :type graph: :class:`rdflib.graph.Graph` :var axioms: Whether axioms should be added or not. :type axioms: bool :var daxioms: Whether datatype axioms should be added or not. :type daxioms: bool :var added_triples: Triples added to the graph, conceptually, during one processing cycle. :type added_triples: set of triples :var error_messages: Error messages (typically inconsistency messages in OWL RL) found during processing. These are added to the final graph at the very end as separate BNodes with error messages. :type error_messages: list of str :var rdfs: Whether RDFS inference is also done (used in subclassed only). :type rdfs: bool """ # noinspection PyUnusedLocal def __init__(self, graph: Graph, axioms, daxioms, rdfs: bool = False, destination: Union[None, Graph] = None): """ The parameter descriptions here are from the old documentation. @param graph: the RDF graph to be extended @type graph: Graph @param axioms: whether axioms should be added or not @type axioms: boolean @param daxioms: whether datatype axioms should be added or not @type daxioms: boolean @param rdfs: whether RDFS inference is also done (used in subclassed only) @type rdfs: boolean @param destination: the destination graph to which the results are written. If None, use the source graph. @type destination: Graph """ self._debug = debugGlobal # Calculate the maximum 'n' value for the '_i' type predicates (see Horst's paper) n = 1 maxnum = 0 cont = True while cont: cont = False predicate = RDF[("_%d" % n)] for (s, p, o) in graph.triples((None, predicate, None)): # there is at least one if we got here maxnum = n n += 1 cont = True self.IMaxNum = maxnum self.graph = graph if isinstance(self.graph, (Dataset, ConjunctiveGraph)): self.graph.default_union = True if destination is None: if isinstance(graph, (Dataset, ConjunctiveGraph)): self.destination = graph.default_context else: self.destination = graph else: if isinstance(destination, (str, rdflib.URIRef)): if isinstance(graph, (Dataset, ConjunctiveGraph)): self.destination = graph.get_context(destination) else: raise ValueError("URIRef destinations are only supported for Datasets and ConjunctiveGraphs") else: source_store = self.graph.store dest_store = destination.store if source_store is not dest_store: raise ValueError("The source and destination graphs share the same backing store") self.destination = destination self.axioms = axioms self.daxioms = daxioms self.rdfs = rdfs self.error_messages = [] self.empty_stored_triples() def add_error(self, message): """ Add an error message :param message: Error message. :type message: str """ if message not in self.error_messages: self.error_messages.append(message) def pre_process(self): """ Do some pre-processing step. This method before anything else in the closure. By default, this method is empty, subclasses can add content to it by overriding it. """ pass def post_process(self): """ Do some post-processing step. This method when all processing is done, but before handling possible errors (ie, the method can add its own error messages). By default, this method is empty, subclasses can add content to it by overriding it. """ pass def rules(self, t, cycle_num): """ The core processing cycles through every tuple in the graph and dispatches it to the various methods implementing a specific group of rules. By default, this method raises an exception; indeed, subclasses *must* add content to by overriding it. :param t: One triple on which to apply the rules. :type t: tuple :param cycle_num: Which cycle are we in, starting with 1. This value is forwarded to all local rules; it is also used locally to collect the bnodes in the graph. :type cycle_num: int """ raise Exception( "This method should not be called directly; subclasses should override it" ) def add_axioms(self): """ Add axioms. This is only a placeholder and raises an exception by default; subclasses *must* fill this with real content """ raise Exception( "This method should not be called directly; subclasses should override it" ) def add_d_axioms(self): """ Add d axioms. This is only a placeholder and raises an exception by default; subclasses I{must} fill this with real content """ raise Exception( "This method should not be called directly; subclasses should override it" ) def one_time_rules(self): """ This is only a placeholder; subclasses should fill this with real content. By default, it is just an empty call. This set of rules is invoked only once and not in a cycle. """ pass # noinspection PyAttributeOutsideInit def empty_stored_triples(self): """ Empty the internal store for triples. """ self.added_triples = set() def flush_stored_triples(self): """ Send the stored triples to the graph, and empty the container. """ for t in self.added_triples: self.destination.add(t) self.empty_stored_triples() def store_triple(self, t): """ In contrast to its name, this does not yet add anything to the graph itself, it just stores the tuple in an internal set (:code:`Core.added_triples`). (It is important for this to be a set: some of the rules in the various closures may generate the same tuples several times.) Before adding the tuple to the set, the method checks whether the tuple is in the final graph already (if yes, it is not added to the set). The set itself is emptied at the start of every processing cycle; the triples are then effectively added to the graph at the end of such a cycle. If the set is actually empty at that point, this means that the cycle has not added any new triple, and the full processing can stop. :param t: The triple to be added to the graph, unless it is already there :type t: tuple """ (s, p, o) = t if not isinstance(p, Literal) and not (t in self.destination or t in self.graph): if self._debug or offlineGeneration: print(t) self.added_triples.add(t) # noinspection PyAttributeOutsideInit def closure(self): """ Generate the closure the graph. This is the real 'core'. The processing rules store new triples via the separate method :func:`owlrl.Closure.Core.store_triple` which stores them in the :code:`added_triples` array. If that array is empty at the end of a cycle, it means that the whole process can be stopped. If required, the relevant axiomatic triples are added to the graph before processing in cycles. Similarly the exchange of literals against bnodes is also done in this step (and restored after all cycles are over). """ self.pre_process() # Handling the axiomatic triples. In general, this means adding all tuples in the list that # forwarded, and those include RDF or RDFS. In both cases the relevant parts of the container axioms should also # be added. if self.axioms: self.add_axioms() # Add the datatype axioms, if needed (note that this makes use of the literal proxies, the order of the call # is important! if self.daxioms: self.add_d_axioms() self.flush_stored_triples() # Get first the 'one-time rules', ie, those that do not need an extra round in cycles down the line self.one_time_rules() self.flush_stored_triples() # Go cyclically through all rules until no change happens new_cycle = True cycle_num = 0 while new_cycle: # yes, there was a change, let us go again cycle_num += 1 # DEBUG: print the cycle number out if self._debug: print("----- Cycle #%d" % cycle_num) # go through all rules, and collect the replies (to see whether any change has been done) # the new triples to be added are collected separately not to interfere with # the current graph yet self.empty_stored_triples() # Execute all the rules; these might fill up the added triples array for t in self.graph.triples((None, None, None)): self.rules(t, cycle_num) # Add the tuples to the graph (if necessary, that is). If any new triple has been generated, a new cycle # will be necessary... new_cycle = len(self.added_triples) > 0 for t in self.added_triples: self.destination.add(t) self.post_process() self.flush_stored_triples() # Add possible error messages if self.error_messages: # I am not sure this is the right vocabulary to use for this purpose, but I haven't found anything! # I could, of course, come up with my own, but I am not sure that would be kosher... self.destination.bind("err", "http://www.daml.org/2002/03/agents/agent-ont#") for m in self.error_messages: message = BNode() self.destination.add((message, RDF.type, ERRNS.ErrorMessage)) self.destination.add((message, ERRNS.error, Literal(m))) OWL-RL-7.1.4/owlrl/CombinedClosure.py000077500000000000000000000162561504201166100172760ustar00rootroot00000000000000# -*- coding: utf-8 -*- # """ The combined closure: performing *both* the OWL 2 RL and RDFS closures. The two are very close but there are some rules in RDFS that are not in OWL 2 RL (eg, the axiomatic triples concerning the container membership properties). Using this closure class the OWL 2 RL implementation becomes a full extension of RDFS. **Requires**: `RDFLib`_, 4.0.0 and higher. .. _RDFLib: https://github.com/RDFLib/rdflib **License**: This software is available for use under the `W3C Software License`_. .. _W3C Software License: http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 **Organization**: `World Wide Web Consortium`_ .. _World Wide Web Consortium: http://www.w3.org **Author**: `Ivan Herman`_ .. _Ivan Herman: http://www.w3.org/People/Ivan/ """ __author__ = "Ivan Herman" __contact__ = "Ivan Herman, ivan@w3.org" __license__ = "W3C® SOFTWARE NOTICE AND LICENSE, http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231" from typing import Union from rdflib import Graph from rdflib.namespace import OWL, RDF, RDFS from owlrl.RDFSClosure import RDFS_Semantics from owlrl.OWLRL import OWLRL_Semantics ###################################################################################################### # noinspection PyPep8Naming class RDFS_OWLRL_Semantics(RDFS_Semantics, OWLRL_Semantics): """ Common subclass of the RDFS and OWL 2 RL semantic classes. All methods simply call back to the functions in the superclasses. This may lead to some unnecessary duplication of terms and rules, but it is not so bad. Also, the additional identification defined for OWL Full, ie, Resource being the same as Thing and OWL and RDFS classes being identical are added to the triple store. Note that this class is also a possible user extension point: subclasses can be created that extend the standard functionality by extending this class. This class *always*} performs RDFS inferences. Subclasses have to set the :code:`self.rdfs` flag explicitly to the requested value if that is to be controlled. :param graph: The RDF graph to be extended. :type graph: :class:`rdflib.Graph` :param axioms: Whether (non-datatype) axiomatic triples should be added or not. :type axioms: bool :param daxioms: Whether datatype axiomatic triples should be added or not. :type daxioms: bool :param rdfs: Placeholder flag (used in subclassed only, it is always defaulted to True in this class) :type rdfs: bool :var full_binding_triples: Additional axiom type triples that are added to the combined semantics; these 'bind' the RDFS and the OWL worlds together. :var rdfs: (bool) Whether RDFS inference is to be performed or not. In this class instance the value is *always* :code:`True`, subclasses may explicitly change it at initialization time. :type rdfs: bool """ full_binding_triples = [ (OWL.Thing, OWL.equivalentClass, RDFS.Resource), (RDFS.Class, OWL.equivalentClass, OWL.Class), (OWL.DataRange, OWL.equivalentClass, RDFS.Datatype), ] def __init__(self, graph: Graph, axioms, daxioms, rdfs: bool = True, destination: Union[None, Graph] = None): """ @param graph: the RDF graph to be extended @type graph: rdflib.Graph @param axioms: whether (non-datatype) axiomatic triples should be added or not @type axioms: bool @param daxioms: whether datatype axiomatic triples should be added or not @type daxioms: bool @param rdfs: placeholder flag (used in subclassed only, it is always defaulted to True in this class) @type rdfs: boolean @param destination: the destination graph to which the results are written. If None, use the source graph. @type destination: rdflib.Graph """ OWLRL_Semantics.__init__(self, graph, axioms, daxioms, rdfs=rdfs, destination=destination) RDFS_Semantics.__init__(self, graph, axioms, daxioms, rdfs=rdfs, destination=destination) self.rdfs = True # noinspection PyMethodMayBeStatic @staticmethod def add_new_datatype( uri, conversion_function, datatype_list, subsumption_dict=None, subsumption_key=None, subsumption_list=None, ): """ If an extension wants to add new datatypes, this method should be invoked at initialization time. :param uri: URI for the new datatypes, like owl_ns["Rational"]. :param conversion_function: A function converting the lexical representation of the datatype to a Python value, possibly raising an exception in case of unsuitable lexical form. :param datatype_list: List of datatypes already in use that has to be checked. :type datatype_list: list :param subsumption_dict: Dictionary of subsumption hierarchies (indexed by the datatype URI-s). :type subsumption_dict: dict :param subsumption_key: Key in the dictionary, if None, the uri parameter is used. :type subsumption_key: str :param subsumption_list: List of subsumptions associated to a subsumption key (ie, all datatypes that are superclasses of the new datatype). :type subsumption_list: list """ from .DatatypeHandling import AltXSDToPYTHON, use_Alt_lexical_conversions if datatype_list: datatype_list.append(uri) if subsumption_dict and subsumption_list: if subsumption_key: subsumption_dict[subsumption_key] = subsumption_list else: subsumption_dict[uri] = subsumption_list AltXSDToPYTHON[uri] = conversion_function use_Alt_lexical_conversions() def post_process(self): """ Do some post-processing step. This method when all processing is done, but before handling possible errors (I.e., the method can add its own error messages). By default, this method is empty, subclasses can add content to it by overriding it. """ OWLRL_Semantics.post_process(self) def rules(self, t, cycle_num): """ :param t: A triple (in the form of a tuple). :type t: tuple :param cycle_num: Which cycle are we in, starting with 1. This value is forwarded to all local rules; it is also used locally to collect the bnodes in the graph. :type cycle_num: int """ OWLRL_Semantics.rules(self, t, cycle_num) if self.rdfs: RDFS_Semantics.rules(self, t, cycle_num) def add_axioms(self): if self.rdfs: RDFS_Semantics.add_axioms(self) OWLRL_Semantics.add_axioms(self) def add_d_axioms(self): if self.rdfs: RDFS_Semantics.add_d_axioms(self) OWLRL_Semantics.add_d_axioms(self) def one_time_rules(self): """Adds some extra axioms and calls for the d_axiom part of the OWL Semantics.""" for t in self.full_binding_triples: self.store_triple(t) # Note that the RL one time rules include the management of datatype which is a true superset # of the rules in RDFS. It is therefore unnecessary to add those even self.rdfs is True. OWLRL_Semantics.one_time_rules(self) OWL-RL-7.1.4/owlrl/DatatypeHandling.py000077500000000000000000000570331504201166100174370ustar00rootroot00000000000000# -*- coding: utf-8 -*- # """ Most of the XSD datatypes are handled directly by RDFLib. However, in some cases, that is not good enough. There are two major reasons for this: #. Some datatypes are missing from RDFLib and required by OWL 2 RL and/or RDFS. #. In other cases, though the datatype is present, RDFLib is fairly lax in checking the lexical value of those datatypes. Typical case is boolean. Some of these deficiencies are handled by this module. All the functions convert the lexical value into a python datatype (or return the original string if this is not possible) which will be used, e.g., for comparisons (equalities). If the lexical value constraints are not met, exceptions are raised. **Requires**: `RDFLib`_, 4.0.0 and higher. .. _RDFLib: https://github.com/RDFLib/rdflib **License**: This software is available for use under the `W3C Software License`_. .. _W3C Software License: http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 **Organization**: `World Wide Web Consortium`_ .. _World Wide Web Consortium: http://www.w3.org **Author**: `Ivan Herman`_ .. _Ivan Herman: http://www.w3.org/People/Ivan/ """ __author__ = "Ivan Herman" __contact__ = "Ivan Herman, ivan@w3.org" __license__ = "W3C® SOFTWARE NOTICE AND LICENSE, http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231" # noinspection PyPep8Naming # from owlrl.RDFS import RDFNS as ns_rdf from rdflib.namespace import RDF, XSD from rdflib.term import XSDToPython, Literal, _toPythonMapping import datetime, time, re from decimal import Decimal # noinspection PyMissingConstructor,PyPep8Naming class _namelessTZ(datetime.tzinfo): """ (Nameless) timezone object. The python datetime object requires timezones as a specific object added to the conversion, rather than the explicit hour and minute difference used by XSD. This class is used to wrap around the hour/minute values. :param hours: Hour offset. :param minutes: Minute offset """ def __init__(self, hours, minutes): """ @param hours: hour offset @param minutes: minute offset """ self.__offset = datetime.timedelta(hours=hours, minutes=minutes) self.__name = "nameless" def utcoffset(self, dt): return self.__offset def tzname(self, dt): return self.__name def dst(self, dt): return datetime.timedelta(0) # noinspection PyPep8Naming def _returnTimeZone(incoming_v): """Almost all time/date related methods require the extraction of optional time zone information. @param incoming_v: the time/date string @return (v,timezone) tuple; 'v' is the input string with the timezone info cut off, 'timezone' is a L{_namelessTZ} instance or None """ if incoming_v[-1] == "Z": v = incoming_v[:-1] tzone = _namelessTZ(0, 0) else: pattern = r".*(\+|-)([0-9][0-9]):([0-9][0-9])" match = re.match(pattern, incoming_v) if match is None: v = incoming_v tzone = None else: hours = int(match.groups()[1]) if match.groups()[0] == "-": hours = -hours - 1 minutes = int(match.groups()[2]) v = incoming_v[:-6] tzone = _namelessTZ(hours, minutes) return v, tzone # Booleans ################################################## # noinspection PyPep8Naming def _strToBool(v): """The built-in conversion to boolean is way too lax. The xsd specification requires that only true, false, 1 or 0 should be used... @param v: the literal string defined as boolean @return corresponding boolean value @raise ValueError: invalid boolean values """ if v.lower() == "true" or v.lower() == "1": return True elif v.lower() == "false" or v.lower() == "0": return False else: raise ValueError("Invalid boolean literal value %s" % v) # Decimals ################################################## # noinspection PyPep8Naming def _strToDecimal(v): """The built in datatype handling for RDFLib maps a decimal number to float, but the python version 2.4 and upwards also has a Decimal number. Better make use of that to use very high numbers. However, there is also a big difference between Python's decimal and XSD's decimal, because the latter does not allow for an exponential normal form (why???). This must be filtered out. @param v: the literal string defined as decimal @return Decimal @raise ValueError: invalid decimal value """ # check whether the lexical form of 'v' is o.k. if v.find("E") != -1 or v.find("e") != -1: # this is an invalid lexical form, though would be accepted by Python raise ValueError("Invalid decimal literal value %s" % v) else: return Decimal(v) # ANY URIS ################################################## # set of characters allowed in a hexadecimal number _hexc = ["A", "B", "C", "D", "E", "F", "a", "b", "c", "d", "e", "f"] # set of numerals _numb = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"] # noinspection PyPep8Naming def _strToAnyURI(v): """Rudimentary test for the AnyURI value. If it is a relative URI, then some tests are done to filter out mistakes. I am not sure this is the full implementation of the RFC, though, may have to be checked at some point later. @param v: the literal string defined as a URI @return the incoming value @raise ValueError: invalid URI value """ import urllib.parse if len(v) == 0: return v if urllib.parse.urlsplit(v)[0] != "": # this means that there is a proper scheme, the URI should be kosher return v else: # this is meant to be a relative URI. # If I am correct, that cannot begin with one or more "?" or ":" characters # all others are o.k. # if it begins with a % then it should be followed by two hexa characters, # otherwise it is also a bug if v[0] == "%": if ( len(v) >= 3 and (v[1] in _hexc or v[1] in _numb) and (v[2] in _hexc or v[2] in _numb) ): return v else: raise ValueError("Invalid IRI %s" % v) elif v[0] == "?" or v[0] == ":": raise ValueError("Invalid IRI %s" % v) else: return v # Base64Binary ################################################## # noinspection PyPep8Naming def _strToBase64Binary(v): """Rudimentary test for the base64Binary value. The problem is that the built-in b64 module functions ignore the fact that only a certain family of characters are allowed to appear in the lexical value, so this is checked first. @param v: the literal string defined as a base64encoded string @return the decoded (binary) content @raise ValueError: invalid base 64 binary value """ import base64 if v.replace("=", "x").replace("+", "y").replace("/", "z").isalnum(): try: return base64.standard_b64decode(v) except: raise ValueError("Invalid Base64Binary %s" % v) else: raise ValueError("Invalid Base64Binary %s" % v) # Numerical types ################################################## # limits for unsigned bytes _limits_unsignedByte = [-1, 256] # limits for bytes _limits_byte = [-129, 128] # limits for unsigned int _limits_unsignedInt = [-1, 4294967296] # limits for int _limits_int = [-2147483649, 2147483648] # limits for unsigned short _limits_unsignedShort = [-1, 65536] # limits for short _limits_short = [-32769, 32768] # limits for unsigned long _limits_unsignedLong = [-1, 18446744073709551616] # limits for long _limits_long = [-9223372036854775809, 9223372036854775808] # limits for positive integer _limits_positiveInteger = [0, None] # limits for non positive integer _limits_nonPositiveInteger = [None, 1] # limits for non negative integer _limits_nonNegativeInteger = [-1, None] # limits for negative integer _limits_negativeInteger = [None, 0] # noinspection PyPep8Naming,PyBroadException def _strToBoundNumeral(v, interval, conversion): """Test (and convert) a generic numerical type, with a check against a lower and upper limit. @param v: the literal string to be converted @param interval: lower and upper bounds (non inclusive). If the value is None, no comparison should be done @param conversion: conversion function, ie, int, long, etc @raise ValueError: invalid value """ try: i = conversion(v) if (interval[0] is None or interval[0] < i) and ( interval[1] is None or i < interval[1] ): return i except: pass raise ValueError("Invalid numerical value %s" % v) # Double and float ################################################## # noinspection PyPep8Naming def _strToDouble(v): """Test and convert a double value into a Decimal or float. Raises an exception if the number is outside the permitted range, ie, 1.0E+310 and 1.0E-330. To be on the safe side (python does not have double!) Decimals are used if possible. Upper and lower values, as required by xsd, are checked (and these fixed values are the reasons why Decimal is used!) @param v: the literal string defined as a double @return Decimal @raise ValueError: invalid value """ try: value = Decimal(v) upper = Decimal("1.0E+310") lower = Decimal("1.0E-330") if lower < abs(value) < upper: # bingo return value else: raise ValueError("Invalid double %s" % v) except: # there was a problem in creating a decimal... raise ValueError("Invalid double %s" % v) # noinspection PyPep8Naming def _strToFloat(v): """Test and convert a float value into Decimal or (python) float. Raises an exception if the number is outside the permitted range, ie, 1.0E+40 and 1.0E-50. (And these fixed values are the reasons why Decimal is used!) @param v: the literal string defined as a float @return Decimal if the local python version is >= 2.4, float otherwise @raise ValueError: invalid value """ try: value = Decimal(v) upper = Decimal("1.0E+40") lower = Decimal("1.0E-50") if lower < abs(value) < upper: # bingo return value else: raise ValueError("Invalid float %s" % v) except: # there was a problem in creating a decimal... raise ValueError("Invalid float %s" % v) # hexa ################################################## # noinspection PyPep8Naming def _strToHexBinary(v): """Test (and convert) hexa integer values. The number of characters should be even. @param v: the literal string defined as a hexa number @return long value @raise ValueError: invalid value """ # first of all, the number of characters must be even according to the xsd spec: length = len(v) if (length / 2) * 2 != length: raise ValueError("Invalid hex binary number %s" % v) return int(v, 16) # Datetime, date timestamp, etc ################################ # noinspection PyPep8Naming def _strToDateTimeAndStamp(incoming_v, timezone_required=False): """Test (and convert) datetime and date timestamp values. @param incoming_v: the literal string defined as the date and time @param timezone_required: whether the timezone is required (ie, for date timestamp) or not @return datetime @rtype: datetime.datetime @raise ValueError: invalid datetime or date timestamp """ # First, handle the timezone portion, if there is any (v, tzone) = _returnTimeZone(incoming_v) # Check on the timezone. For time date stamp object it is required if timezone_required and tzone is None: raise ValueError("Invalid datetime %s" % incoming_v) # The microseconds should be handled here... final_v = v milliseconds = 0 milpattern = r"(.*)(\.)([0-9]*)" match = re.match(milpattern, v) if match is not None: # we have a millisecond portion... try: final_v = match.groups()[0] milliseconds = int(match.groups()[2]) except: raise ValueError("Invalid datetime %s" % incoming_v) # # By now, the pattern should be clear # This may raise an exception... try: tstr = time.strptime(final_v, "%Y-%m-%dT%H:%M:%S") if tzone is not None: return datetime.datetime( tstr.tm_year, tstr.tm_mon, tstr.tm_mday, tstr.tm_hour, tstr.tm_min, tstr.tm_sec, milliseconds, tzone, ) else: return datetime.datetime( tstr.tm_year, tstr.tm_mon, tstr.tm_mday, tstr.tm_hour, tstr.tm_min, tstr.tm_sec, milliseconds, ) except: raise ValueError("Invalid datetime %s" % incoming_v) # noinspection PyPep8Naming def _strToTime(incoming_v): """Test (and convert) time values. @param incoming_v: the literal string defined as time value @return time @rtype datetime.time @raise ValueError: invalid datetime or date timestamp """ # First, handle the timezone portion, if there is any (v, tzone) = _returnTimeZone(incoming_v) # The microseconds should be handled here... final_v = v milliseconds = 0 milpattern = r"(.*)(\.)([0-9]*)" match = re.match(milpattern, v) if match is not None: # we have a millisecond portion... try: final_v = match.groups()[0] milliseconds = int(match.groups()[2]) except: raise ValueError("Invalid datetime %s" % incoming_v) # # By now, the pattern should be clear # This may raise an exception... try: tstr = time.strptime(final_v, "%H:%M:%S") if tzone is not None: return datetime.time( tstr.tm_hour, tstr.tm_min, tstr.tm_sec, milliseconds, tzone ) else: return datetime.time(tstr.tm_hour, tstr.tm_min, tstr.tm_sec, milliseconds) except: raise ValueError("Invalid time %s" % incoming_v) # noinspection PyPep8Naming def _strToDate(incoming_v): """Test (and convert) date values. @param incoming_v: the literal string defined as date (in iso format) @return date @return datetime.date @raise ValueError: invalid datetime or date timestamp """ # First, handle the timezone portion, if there is any (final_v, tzone) = _returnTimeZone(incoming_v) # This may raise an exception... try: tstr = time.strptime(final_v, "%Y-%m-%d") return datetime.date(tstr.tm_year, tstr.tm_mon, tstr.tm_mday) except: raise ValueError("Invalid date %s" % incoming_v) # The 'g' series for dates ############################ # The 'g' datatypes (eg, gYear) cannot be directly represented as a python datatype # the series of methods below simply check whether the incoming string is o.k., but the # returned value is the same as the original # noinspection PyPep8Naming def _strTogYearMonth(v): """Test gYearMonth value @param v: the literal string @return v @raise ValueError: invalid value """ try: time.strptime(v + "-01", "%Y-%m-%d") return v except: raise ValueError("Invalid gYearMonth %s" % v) # noinspection PyPep8Naming def _strTogYear(v): """Test gYear value @param v: the literal string @return v @raise ValueError: invalid value """ try: time.strptime(v + "-01-01", "%Y-%m-%d") return v except: raise ValueError("Invalid gYear %s" % v) # noinspection PyPep8Naming def _strTogMonthDay(v): """Test gYearMonth value @param v: the literal string @return v @raise ValueError: invalid value """ try: time.strptime("2008-" + v, "%Y-%m-%d") return v except: raise ValueError("Invalid gMonthDay %s" % v) # noinspection PyPep8Naming def _strTogDay(v): """Test gYearMonth value @param v: the literal string @return v @raise ValueError: invalid value """ try: time.strptime("2001-01-" + v, "%Y-%m-%d") return v except: raise ValueError("Invalid gDay %s" % v) # noinspection PyPep8Naming def _strTogMonth(v): """Test gYearMonth value @param v: the literal string @return v @raise ValueError: invalid value """ try: time.strptime("2001-" + v + "-01", "%Y-%m-%d") return v except: raise ValueError("Invalid gMonth %s" % v) # XML Literal ######################################### # noinspection PyPep8Naming def _strToXMLLiteral(v): """Test (and convert) XML Literal values. @param v: the literal string defined as an xml literal @return the canonical version of the same xml text @raise ValueError: incorrect xml string """ import xml.dom.minidom try: dom = xml.dom.minidom.parseString(v) return dom.toxml() except: raise ValueError("Invalid XML Literal %s" % v) # language, NMTOKEN, NAME, etc ######################### # regular expression for a 'language' datatype _re_language = r"[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*" # regexp for NMTOKEN. It must be used with a re.U flag (the '(?U' regexp form did not work. It may depend on the # locale...) _re_NMTOKEN = r"[\w:_.\-]+" # characters not permitted at a starting position for Name (otherwise Name is like NMTOKEN _re_Name_ex = [".", "-"] + _numb # regexp for NCName. It must be used with a re.U flag (the '(?U' regexp form did not work. It may depend on the # locale...) _re_NCName = r"[\w_.\-]+" # characters not permitted at a starting position for NCName _re_NCName_ex = [".", "-"] + _numb # noinspection PyDefaultArgument,PyPep8Naming,PyPep8Naming def _strToVal_Regexp(v, regexp, flag=0, excludeStart=[]): """Test (and convert) a generic string type, with a check against a regular expression. @param v: the literal string to be converted @param regexp: the regular expression to check against @param flag: flags to be used in the regular expression @param excludeStart: array of characters disallowed in the first position @return original string @raise ValueError: invalid value """ match = re.match(regexp, v, flag) if match is None or match.end() != len(v): raise ValueError("Invalid literal %s" % v) else: if len(excludeStart) > 0 and v[0] in excludeStart: raise ValueError("Invalid literal %s" % v) return v # Disallowed characters in a token or a normalized string, as a regexp _re_token = "[^\n\t\r]+" # noinspection PyPep8Naming def _strToToken(v): """Test (and convert) a string to a token. @param v: the literal string to be converted @return original string @raise ValueError: invalid value """ if len(v) == 0: return v # filter out the case when there are new lines and similar (if there is a problem, an exception is raised) _strToVal_Regexp(v, _re_token) v1 = " ".join(v.strip().split()) # normalize the string, and see if the result is the same: if len(v1) == len(v): # no characters lost, ie, no unnecessary spaces return v else: raise ValueError("Invalid literal %s" % v) # plain literal ######################################## # noinspection PyPep8Naming def _strToPlainLiteral(v): """Test (and convert) a plain literal @param v: the literal to be converted @return a new RDFLib Literal with language tag @raise ValueError: invalid value """ reg = "(.*)@([^@]*)" # a plain literal must match this regexp! match = re.match(reg, v) if match is None: raise ValueError("Invalid plain literal %s" % v) else: lit = match.groups()[0] if len(match.groups()) == 1 or match.groups()[1] == "": # no language tag return Literal(lit) else: lang = match.groups()[1] # check if this is a correct language tag. Note that can raise an exception! try: lang = _strToVal_Regexp(lang, _re_language) return Literal(lit, lang=lang.lower()) except: raise ValueError("Invalid plain literal %s" % v) ##################################################################################### # Replacement of RDFLib's conversion function. Each entry assigns a function to an XSD datatype, attempting to convert # a string to a Python datatype (or raise an exception if some problem is found) AltXSDToPYTHON = { XSD.language: lambda v: _strToVal_Regexp(v, _re_language), XSD.NMTOKEN: lambda v: _strToVal_Regexp(v, _re_NMTOKEN, re.U), XSD.Name: lambda v: _strToVal_Regexp(v, _re_NMTOKEN, re.U, _re_Name_ex), XSD.NCName: lambda v: _strToVal_Regexp(v, _re_NCName, re.U, _re_NCName_ex), XSD.token: _strToToken, RDF.PlainLiteral: _strToPlainLiteral, XSD.boolean: _strToBool, XSD.decimal: _strToDecimal, XSD.anyURI: _strToAnyURI, XSD.base64Binary: _strToBase64Binary, XSD.double: _strToDouble, XSD.float: _strToFloat, XSD.byte: lambda v: _strToBoundNumeral(v, _limits_byte, int), XSD.int: lambda v: _strToBoundNumeral(v, _limits_int, int), XSD.long: lambda v: _strToBoundNumeral(v, _limits_long, int), XSD.positiveInteger: lambda v: _strToBoundNumeral(v, _limits_positiveInteger, int), XSD.nonPositiveInteger: lambda v: _strToBoundNumeral( v, _limits_nonPositiveInteger, int ), XSD.negativeInteger: lambda v: _strToBoundNumeral(v, _limits_negativeInteger, int), XSD.nonNegativeInteger: lambda v: _strToBoundNumeral( v, _limits_nonNegativeInteger, int ), XSD.short: lambda v: _strToBoundNumeral(v, _limits_short, int), XSD.unsignedByte: lambda v: _strToBoundNumeral(v, _limits_unsignedByte, int), XSD.unsignedShort: lambda v: _strToBoundNumeral(v, _limits_unsignedShort, int), XSD.unsignedInt: lambda v: _strToBoundNumeral(v, _limits_unsignedInt, int), XSD.unsignedLong: lambda v: _strToBoundNumeral(v, _limits_unsignedLong, int), XSD.hexBinary: _strToHexBinary, XSD.dateTime: lambda v: _strToDateTimeAndStamp(v, False), XSD.dateTimeStamp: lambda v: _strToDateTimeAndStamp(v, True), RDF.XMLLiteral: _strToXMLLiteral, XSD.integer: int, XSD.string: lambda v: v, RDF.HTML: lambda v: v, XSD.normalizedString: lambda v: _strToVal_Regexp(v, _re_token), # These are RDFS specific... XSD.time: _strToTime, XSD.date: _strToDate, XSD.gYearMonth: _strTogYearMonth, XSD.gYear: _strTogYear, XSD.gMonthDay: _strTogMonthDay, XSD.gDay: _strTogDay, XSD.gMonth: _strTogMonth, } def use_Alt_lexical_conversions(): """ Registering the datatypes item for RDFLib, ie, bind the dictionary values. The 'bind' method of RDFLib adds extra datatypes to the registered ones in RDFLib, though the table used here (I.e., :code:`AltXSDToPYTHON`) actually overrides all of the default conversion routines. The method also add a Decimal entry to the :code:`PythonToXSD` list of RDFLib. """ _toPythonMapping.update(AltXSDToPYTHON) def use_RDFLib_lexical_conversions(): """ Restore the original (ie, RDFLib) set of lexical conversion routines. """ _toPythonMapping.update(XSDToPython) ####################################################################################### # This module can pretty much tested individually... if __name__ == "__main__": import sys dtype = sys.argv[1] string = sys.argv[2] datatype = XSD[dtype] result = AltXSDToPYTHON[datatype](string) print(type(result)) print(result) OWL-RL-7.1.4/owlrl/Namespaces.py000066400000000000000000000002031504201166100162560ustar00rootroot00000000000000from rdflib import Namespace ERRNS = Namespace("http://www.daml.org/2002/03/agents/agent-ont#") T = Namespace("http://test.org/") OWL-RL-7.1.4/owlrl/OWLRL.py000077500000000000000000001277201504201166100151170ustar00rootroot00000000000000# -*- coding: utf-8 -*- # """ This module is a **brute force** implementation of the OWL 2 RL profile. RDFLib works with 'generalized' RDF, meaning that triples with a BNode predicate are *allowed*. This is good because, e.g., some of the triples generated for RDF from an OWL 2 functional syntax might look like :code:`[ owl:inverseOf p ]`, and the RL rules would then operate on such generalized triple. However, as a last, post processing steps, these triples are removed from the graph before serialization to produce 'standard' RDF (which is o.k. for RL, too, because the consequent triples are all right, generalized triples might have had a role in the deduction steps only). **Requires**: `RDFLib`_, 4.0.0 and higher. .. _RDFLib: https://github.com/RDFLib/rdflib **License**: This software is available for use under the `W3C Software License`_. .. _W3C Software License: http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 **Organization**: `World Wide Web Consortium`_ .. _World Wide Web Consortium: http://www.w3.org **Author**: `Ivan Herman`_ .. _Ivan Herman: http://www.w3.org/People/Ivan/ """ __author__ = "Ivan Herman" __contact__ = "Ivan Herman, ivan@w3.org" __license__ = "W3C® SOFTWARE NOTICE AND LICENSE, http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231" from collections import defaultdict from typing import Union import rdflib from rdflib import BNode, Graph from rdflib.namespace import OWL, RDF, RDFS from owlrl.Closure import Core from owlrl.AxiomaticTriples import OWLRL_Axiomatic_Triples, OWLRL_D_Axiomatic_Triples from owlrl.AxiomaticTriples import OWLRL_Datatypes_Disjointness OWLRL_Annotation_properties = [ RDFS.label, RDFS.comment, RDFS.seeAlso, RDFS.isDefinedBy, OWL.deprecated, OWL.versionInfo, OWL.priorVersion, OWL.backwardCompatibleWith, OWL.incompatibleWith, ] from .XsdDatatypes import OWL_RL_Datatypes, OWL_Datatype_Subsumptions from .DatatypeHandling import AltXSDToPYTHON identity = lambda v: v ####################################################################################################################### # OWL-R Semantics class # # # As an editing help: each rule is prefixed by RULE XXXX where XXXX is the acronym given in the profile document. # This helps in referring back to the spec... # noinspection PyPep8Naming, PyPep8Naming, PyBroadException class OWLRL_Semantics(Core): """ OWL 2 RL Semantics class, i.e., implementation of the OWL 2 RL closure graph. .. note:: Note that the module does *not* implement the so called Datatype entailment rules, simply because the underlying RDFLib does not implement the datatypes (i.e., RDFLib will not make the literal "1.00" and "1.00000" identical, although even with all the ambiguities on datatypes, this *should* be made equal...). Also, the so-called extensional entailment rules (Section 7.3.1 in the RDF Semantics document) have not been implemented either. The comments and references to the various rule follow the names as used in the `OWL 2 RL document`_. .. _OWL 2 RL document: http://www.w3.org/TR/owl2-profiles/#Reasoning_in_OWL_2_RL_and_RDF_Graphs_using_Rules :param graph: The RDF graph to be extended. :type graph: :class:`rdflib.Graph` :param axioms: Whether (non-datatype) axiomatic triples should be added or not. :type axioms: bool :param daxioms: Whether datatype axiomatic triples should be added or not. :type daxioms: bool :param rdfs: Whether RDFS inference is also done (used in subclassed only). :type rdfs: bool """ def __init__(self, graph: Graph, axioms, daxioms, rdfs: bool = False, destination: Union[None, Graph] = None): """ @param graph: the RDF graph to be extended @type graph: rdflib.Graph @param axioms: whether (non-datatype) axiomatic triples should be added or not @type axioms: bool @param daxioms: whether datatype axiomatic triples should be added or not @type daxioms: bool @param rdfs: whether RDFS inference is also done (used in subclassed only) @type rdfs: boolean @param destination: the destination graph to which the results are written. If None, use the source graph. @type destination: rdflib.Graph """ Core.__init__(self, graph, axioms, daxioms, rdfs=rdfs, destination=destination) self.bnodes = [] def _list(self, l): """ Shorthand to get a list of values (ie, from an rdf:List structure) starting at a head @param l: RDFLib resource, should be the head of an rdf:List @return: array of resources """ return [ch for ch in self.graph.items(l)] def post_process(self): """ Remove triples with Bnode predicates. The Bnodes in the graph are collected in the first cycle run. """ to_be_removed = [] for b in self.bnodes: for t in self.graph.triples((None, b, None)): if t not in to_be_removed: to_be_removed.append(t) for t in to_be_removed: self.destination.remove(t) self.graph.remove(t) def add_axioms(self): """ Add axioms """ for t in OWLRL_Axiomatic_Triples: self.destination.add(t) def add_d_axioms(self): """ Add the datatype axioms """ for t in OWLRL_D_Axiomatic_Triples: self.destination.add(t) def restriction_typing_check(self, v, t): """ Helping method to check whether a type statement is in line with a possible restriction. This method is invoked by rule "cls-avf" before setting a type on an allValuesFrom restriction. The method is a placeholder at this level. It is typically implemented by subclasses for extra checks, e.g., for datatype facet checks. :param v: The resource that is to be 'typed'. :param t: The targeted type (ie, Class). :return: Boolean. :rtype: bool """ return True def _one_time_rules_datatypes(self): """ Some of the rules in the rule set are axiomatic in nature, meaning that they really have to be added only once, there is no reason to add these in a cycle. These are performed by this method that is invoked only once at the beginning of the process. These are: cls-thing, cls-nothing1, prp-ap, dt-types1, dt-types2, dt-eq, dt-diff. .. note:: Note, however, that the dt-* are executed only partially, limited by the possibilities offered by RDFLib. These may not cover all the edge cases of OWL RL. Especially, dt-not-type has not (yet?) been implemented (I wonder whether RDFLib should not raise exception for those anyway... """ # noinspection PyShadowingNames def _add_to_explicit(s, o): explicit[s].add(o) # noinspection PyShadowingNames def _append_to_explicit(s, o): explicit[s].add(o) # noinspection PyShadowingNames def _handle_subsumptions(r, dt): if dt in OWL_Datatype_Subsumptions: for new_dt in OWL_Datatype_Subsumptions[dt]: self.store_triple((r, RDF.type, new_dt)) self.store_triple((new_dt, RDF.type, RDFS.Datatype)) used_datatypes.add(new_dt) # explicit object->datatype relationships: those that came from an object being typed as a datatype # or a sameAs. The values are arrays of datatypes to which the resource belong explicit = defaultdict(set) # For processing later: # implicit object->datatype relationships: these come from real # literals which are present in the graph implicit = { o: o.datatype for s, p, o in self.graph.triples((None, None, None)) if isinstance(o, rdflib.Literal) and o.datatype in OWL_RL_Datatypes } # datatypes in use by the graph (directly or indirectly). This will be used at the end to add the # necessary disjointness statements (but not more) used_datatypes = set(implicit.values()) # RULE dt-type2: for all explicit literals the corresponding bnode should get the right type # definition. The 'implicit' dictionary is also filled on the fly # RULE dt-not-type: see whether an explicit literal is valid in terms of the defined datatype for lt in implicit: # note that all non-RL datatypes are ignored # add the explicit typing triple self.store_triple((lt, RDF.type, lt.datatype)) # for dt-not-type # This is a dirty trick: rdflib's Literal includes a method that raises an exception if the # lexical value cannot be mapped on the value space. converter = AltXSDToPYTHON.get(lt.datatype, identity) try: converter(str(lt)) except ValueError: self.add_error( "Lexical value of the literal '%s' does not match" " its datatype (%s)" % (lt, lt.datatype) ) # RULE dt-diff # RULE dt-eq # Compare literals whether they are different or not. This rules # are skipped on purpose at the moment. # Other datatype definitions can come from explicitly defining some nodes as datatypes (though rarely used, # it is perfectly possible... # there may be explicit relationships set in the graph, too! for (s, p, o) in self.graph.triples((None, RDF.type, None)): if o in OWL_RL_Datatypes: used_datatypes.add(o) if s not in implicit: _add_to_explicit(s, o) # Finally, there may be sameAs statements that bind nodes to some of the existing ones. This does not introduce # new datatypes, so the used_datatypes array does not get extended for (s, p, o) in self.graph.triples((None, OWL.sameAs, None)): if o in implicit: _add_to_explicit(s, implicit[o]) # note that s in implicit would mean that the original graph has # a literal in subject position which is not allowed at the moment, so I do not bother if o in explicit: _append_to_explicit(s, o) if s in explicit: _append_to_explicit(o, s) # what we have now: # explicit+implicit contains all the resources of type datatype; # implicit contains those that are given by an explicit literal # explicit contains those that are given by general resources, and there can be a whole array for each entry # RULE dt-type1: add a Datatype typing for all those # Note: the strict interpretation of OWL RL is to do that for all allowed datatypes, but this is # under discussion right now. The optimized version uses only what is really in use for dt in OWL_RL_Datatypes: self.store_triple((dt, RDF.type, RDFS.Datatype)) for dts in explicit.values(): for dt in dts: self.store_triple((dt, RDF.type, RDFS.Datatype)) # Datatype reasoning means that certain datatypes are subtypes of one another. # I could simply generate the extra subclass relationships into the graph and let the generic # process work its way, but it seems to be an overkill. Instead, I prefer to add the explicit typing # into the graph 'manually' for r in explicit: # these are the datatypes that this resource has dtypes = explicit[r] for dt in dtypes: _handle_subsumptions(r, dt) for r, dt in implicit.items(): _handle_subsumptions(r, dt) # Last step: add the datatype disjointness relationships. This is done only for # - 'top' level datatypes # - used in the graph for t in OWLRL_Datatypes_Disjointness: (l, pred, r) = t if l in used_datatypes and r in used_datatypes: self.store_triple(t) def _one_time_rules_misc(self): """ Rules executed: cls-thing, cls-nothing, prp-ap. """ # RULE cls-thing self.store_triple((OWL.Thing, RDF.type, OWL.Class)) # RULE cls-nothing self.store_triple((OWL.Nothing, RDF.type, OWL.Class)) # RULE prp-ap for an in OWLRL_Annotation_properties: self.store_triple((an, RDF.type, OWL.AnnotationProperty)) def one_time_rules(self): """ Some of the rules in the rule set are axiomatic in nature, meaning that they really have to be added only once, there is no reason to add these in a cycle. These are performed by this method that is invoked only once at the beginning of the process. These are: cls-thing, cls-nothing1, prp-ap, dt-types1, dt-types2, dt-eq, dt-diff. """ self._one_time_rules_misc() self._one_time_rules_datatypes() def rules(self, t, cycle_num): """ Go through the various rule groups, as defined in the OWL-RL profile text and implemented via local methods. (The calling cycle takes every tuple in the graph.) :param t: A triple (in the form of a tuple). :param cycle_num: Which cycle are we in, starting with 1. This value is forwarded to all local rules; it is also used locally to collect the bnodes in the graph. """ if cycle_num == 1: for r in t: if isinstance(r, BNode) and r not in self.bnodes: self.bnodes.append(r) self._properties(t, cycle_num) self._equality(t, cycle_num) self._classes(t, cycle_num) self._class_axioms(t, cycle_num) self._schema_vocabulary(t, cycle_num) def _property_chain(self, p, x): """ Implementation of the property chain axiom, invoked from inside the property axiom handler. This is the implementation of rule prp-spo2, taken aside for an easier readability of the code.""" chain = self._list(x) # The complication is that, at each step of the chain, there may be spawns, leading to a multitude # of 'sub' chains:-( if len(chain) > 0: for (u1, _y, _z) in self.graph.triples((None, chain[0], None)): # At least the chain can be started, because the leftmost property has at least # one element in its extension finalList = [(u1, _z)] chainExists = True for pi in chain[1:]: newList = [] for (_u, ui) in finalList: for u in self.graph.objects(ui, pi): # what is stored is only last entry with u1, the intermediate results # are not of interest newList.append((u1, u)) # I have now, in new list, all the intermediate results # until pi # if new list is empty, that means that is a blind alley if len(newList) == 0: chainExists = False break else: finalList = newList if chainExists: for (_u, un) in finalList: self.store_triple((u1, p, un)) def _equality(self, triple, cycle_num): """ Table 4: Semantics of equality. Essentially, the eq-* rules. @param triple: triple to work on @param cycle_num: which cycle are we in, starting with 1. Can be used for some optimization. """ # In many of the 'if' branches, corresponding to rules in the document, # the branch begins by a renaming of variables (eg, pp, c = s, o). # There is no programming reasons for doing that, but by renaming the # variables it becomes easier to compare the declarative rules # in the document with the implementation s, p, o = triple # RULE eq-ref self.store_triple((s, OWL.sameAs, s)) self.store_triple((o, OWL.sameAs, o)) self.store_triple((p, OWL.sameAs, p)) if p == OWL.sameAs: x, y = s, o # RULE eq-sym self.store_triple((y, OWL.sameAs, x)) # RULE eq-trans for z in self.graph.objects(y, OWL.sameAs): self.store_triple((x, OWL.sameAs, z)) # RULE eq-rep-s for pp, oo in self.graph.predicate_objects(s): self.store_triple((o, pp, oo)) # RULE eq-rep-p for ss, oo in self.graph.subject_objects(s): self.store_triple((ss, o, oo)) # RULE eq-rep-o for ss, pp in self.graph.subject_predicates(o): self.store_triple((ss, pp, s)) # RULE eq-diff1 if (s, OWL.differentFrom, o) in self.graph or ( o, OWL.differentFrom, s, ) in self.graph: self.add_error( "'sameAs' and 'differentFrom' cannot be used on the same subject-object pair: (%s, %s)" % (s, o) ) # RULES eq-diff2 and eq-diff3 if p == RDF.type and o == OWL.AllDifferent: x = s # the objects method are generators, we cannot simply concatenate them. So we turn the results # into lists first. (Otherwise the body of the for loops should be repeated verbatim, which # is silly and error prone... m1 = [i for i in self.graph.objects(x, OWL.members)] m2 = [i for i in self.graph.objects(x, OWL.distinctMembers)] for y in m1 + m2: zis = self._list(y) for i in range(0, len(zis) - 1): zi = zis[i] for j in range(i + 1, len(zis) - 1): zj = zis[j] if ( (zi, OWL.sameAs, zj) in self.graph or (zj, OWL.sameAs, zi) in self.graph ) and zi != zj: self.add_error( "'sameAs' and 'AllDifferent' cannot be used on the same subject-object " "pair: (%s, %s)" % (zi, zj) ) def _properties(self, triple, cycle_num): """ Table 5: The Semantics of Axioms about Properties. Essentially, the prp-* rules. @param triple: triple to work on @param cycle_num: which cycle are we in, starting with 1. Can be used for some optimization. """ # In many of the 'if' branches, corresponding to rules in the document, # the branch begins by a renaming of variables (eg, pp, c = s, o). # There is no programming reasons for doing that, but by renaming the # variables it becomes easier to compare the declarative rules # in the document with the implementation p, t, o = triple # RULE prp-ap if cycle_num == 1 and t in OWLRL_Annotation_properties: self.store_triple((t, RDF.type, OWL.AnnotationProperty)) # RULE prp-dom if t == RDFS.domain: for x, y in self.graph.subject_objects(p): self.store_triple((x, RDF.type, o)) # RULE prp-rng elif t == RDFS.range: for x, y in self.graph.subject_objects(p): self.store_triple((y, RDF.type, o)) elif t == RDF.type: # RULE prp-fp if o == OWL.FunctionalProperty: # Property axiom #3 for x, y1 in self.graph.subject_objects(p): for y2 in self.graph.objects(x, p): # Optimization: if the two resources are identical, the samAs is already # taken place somewhere else, unnecessary to add it here if y1 != y2: self.store_triple((y1, OWL.sameAs, y2)) # RULE prp-ifp elif o == OWL.InverseFunctionalProperty: for x1, y in self.graph.subject_objects(p): for x2 in self.graph.subjects(p, y): # Optimization: if the two resources are identical, the samAs is already # taken place somewhere else, unnecessary to add it here if x1 != x2: self.store_triple((x1, OWL.sameAs, x2)) # RULE prp-irp elif o == OWL.IrreflexiveProperty: for x, y in self.graph.subject_objects(p): if x == y: self.add_error( "Irreflexive property used on %s with %s" % (x, p) ) # RULE prp-symp elif o == OWL.SymmetricProperty: for x, y in self.graph.subject_objects(p): self.store_triple((y, p, x)) # RULE prp-asyp elif o == OWL.AsymmetricProperty: for x, y in self.graph.subject_objects(p): if (y, p, x) in self.graph: self.add_error( "Erroneous usage of asymmetric property %s on %s and %s" % (p, x, y) ) # RULE prp-trp elif o == OWL.TransitiveProperty: for x, y in self.graph.subject_objects(p): for z in self.graph.objects(y, p): self.store_triple((x, p, z)) # # Breaking the order here, I take some additional rules here to the branch checking the type... # # RULE prp-adp elif o == OWL.AllDisjointProperties: x = p for y in self.graph.objects(x, OWL.members): pis = self._list(y) for i in range(0, len(pis) - 1): pi = pis[i] for j in range(i + 1, len(pis) - 1): pj = pis[j] for x, y in self.graph.subject_objects(pi): if (x, pj, y) in self.graph: self.add_error( "Disjoint properties in an 'AllDisjointProperties' are not really " "disjoint: (%s, %s,%s) and (%s,%s,%s)" % (x, pi, y, x, pj, y) ) # RULE prp-spo1 elif t == RDFS.subPropertyOf: p1, p2 = p, o for x, y in self.graph.subject_objects(p1): self.store_triple((x, p2, y)) # RULE prp-spo2 elif t == OWL.propertyChainAxiom: self._property_chain(p, o) # RULES prp-eqp1 and prp-eqp2 elif t == OWL.equivalentProperty: p1, p2 = p, o # Optimization: it clearly does not make sense to run these # if the two properties are identical (a separate axiom # does create an equivalent property relations among identical # properties, too...) if p1 != p2: # RULE prp-eqp1 for x, y in self.graph.subject_objects(p1): self.store_triple((x, p2, y)) # RULE prp-eqp2 for x, y in self.graph.subject_objects(p2): self.store_triple((x, p1, y)) # RULE prp-pdw elif t == OWL.propertyDisjointWith: p1, p2 = p, o for x, y in self.graph.subject_objects(p1): if (x, p2, y) in self.graph: self.add_error( "Erroneous usage of disjoint properties %s and %s on %s and %s" % (p1, p2, x, y) ) # RULES prp-inv1 and prp-inv2 elif t == OWL.inverseOf: p1, p2 = p, o # RULE prp-inv1 for x, y in self.graph.subject_objects(p1): self.store_triple((y, p2, x)) # RULE prp-inv2 for x, y in self.graph.subject_objects(p2): self.store_triple((y, p1, x)) # RULE prp-key elif t == OWL.hasKey: c, u = p, o pis = self._list(u) if len(pis) > 0: for x in self.graph.subjects(RDF.type, c): # "Calculate" the keys for 'x'. The complication is that there can be various combinations # of the keys, and that is the structure one has to build up here... # # The final list will be a list of lists, with each constituents being the possible combinations # of the key values. # startup the list finalList = [[zi] for zi in self.graph.objects(x, pis[0])] for pi in pis[1:]: newList = [] for zi in self.graph.objects(x, pi): newList = newList + [l + [zi] for l in finalList] finalList = newList # I am not sure this can happen, but better safe then sorry... ruling out # the value lists whose length are not kosher # (To be checked whether this is necessary in the first place) valueList = [l for l in finalList if len(l) == len(pis)] # Now we can look for the y-s, to see if they have the same key values for y in self.graph.subjects(RDF.type, c): # rule out the existing equivalences if not ( y == x or (y, OWL.sameAs, x) in self.graph or (x, OWL.sameAs, y) in self.graph ): # 'calculate' the keys for the y values and see if there is a match for vals in valueList: same = True for i in range(0, len(pis) - 1): if (y, pis[i], vals[i]) not in self.graph: same = False # No use going with this property line break if same: self.store_triple((x, OWL.sameAs, y)) # Look for the next 'y', this branch is finished, no reason to continue break # RULES prp-npa1 and prp-npa2 elif t == OWL.sourceIndividual: x, i1 = p, o for p1 in self.graph.objects(x, OWL.assertionProperty): for i2 in self.graph.objects(x, OWL.targetIndividual): if (i1, p1, i2) in self.graph: self.add_error( "Negative (object) property assertion violated for: (%s, %s, %s)" % (i1, p1, i2) ) for i2 in self.graph.objects(x, OWL.targetValue): if (i1, p1, i2) in self.graph: self.add_error( "Negative (datatype) property assertion violated for: (%s, %s, %s)" % (i1, p1, i2) ) def _classes(self, triple, cycle_num): """ Table 6: The Semantics of Classes. Essentially, the cls-* rules @param triple: triple to work on @param cycle_num: which cycle are we in, starting with 1. Can be used for some optimization. """ # In many of the 'if' branches, corresponding to rules in the document, # the branch begins by a renaming of variables (eg, pp, c = s, o). # There is no programming reasons for doing that, but by renaming the # variables it becomes easier to compare the declarative rules # in the document with the implementation c, p, x = triple # RULE cls-nothing2 if p == RDF.type and x == OWL.Nothing: self.add_error("%s is defined of type 'Nothing'" % c) # RULES cls-int1 and cls-int2 if p == OWL.intersectionOf: classes = self._list(x) # RULE cls-int1 # Optimization: by looking at the members of class[0] right away one # reduces the search spaces a bit. Individuals not in that class # are without interest anyway # I am not sure how empty lists are sanctioned, so having an extra check # on that does not hurt.. if len(classes) > 0: for y in self.graph.subjects(RDF.type, classes[0]): if False not in [ (y, RDF.type, cl) in self.graph for cl in classes[1:] ]: self.store_triple((y, RDF.type, c)) # RULE cls-int2 for y in self.graph.subjects(RDF.type, c): for cl in classes: self.store_triple((y, RDF.type, cl)) # RULE cls-uni elif p == OWL.unionOf: for cl in self._list(x): for y in self.graph.subjects(RDF.type, cl): self.store_triple((y, RDF.type, c)) # RULE cls-comm elif p == OWL.complementOf: c1, c2 = c, x for x1 in self.graph.subjects(RDF.type, c1): if (x1, RDF.type, c2) in self.graph: self.add_error( "Violation of complementarity for classes %s and %s on element %s" % (c1, c2, x) ) # RULES cls-svf1 and cls=svf2 elif p == OWL.someValuesFrom: xx, y = c, x # RULE cls-svf1 # RULE cls-svf2 for pp in self.graph.objects(xx, OWL.onProperty): for u, v in self.graph.subject_objects(pp): if y == OWL.Thing or (v, RDF.type, y) in self.graph: self.store_triple((u, RDF.type, xx)) # RULE cls-avf elif p == OWL.allValuesFrom: xx, y = c, x for pp in self.graph.objects(xx, OWL.onProperty): for u in self.graph.subjects(RDF.type, xx): for v in self.graph.objects(u, pp): if self.restriction_typing_check(v, y): self.store_triple((v, RDF.type, y)) else: self.add_error( "Violation of type restriction for allValuesFrom in %s for datatype %s on " "value %s" % (pp, y, v) ) # RULES cls-hv1 and cls-hv2 elif p == OWL.hasValue: xx, y = c, x for pp in self.graph.objects(xx, OWL.onProperty): # RULE cls-hv1 for u in self.graph.subjects(RDF.type, xx): self.store_triple((u, pp, y)) # RULE cls-hv2 for u in self.graph.subjects(pp, y): self.store_triple((u, RDF.type, xx)) # RULES cls-maxc1 and cls-maxc1 elif p == OWL.maxCardinality: # This one is a bit complicated, because the literals have been # exchanged against bnodes... # # The construct should lead to an integer. Something may go wrong along the line # leading to an exception... xx = c if x.value == 0: # RULE cls-maxc1 for pp in self.graph.objects(xx, OWL.onProperty): for u, y in self.graph.subject_objects(pp): # This should not occur: if (u, RDF.type, xx) in self.graph: self.add_error( "Erroneous usage of maximum cardinality with %s and %s" % (xx, y) ) elif x.value == 1: # RULE cls-maxc2 for pp in self.graph.objects(xx, OWL.onProperty): for u, y1 in self.graph.subject_objects(pp): if (u, RDF.type, xx) in self.graph: for y2 in self.graph.objects(u, pp): if y1 != y2: self.store_triple((y1, OWL.sameAs, y2)) # RULES cls-maxqc1, cls-maxqc2, cls-maxqc3, cls-maxqc4 elif p == OWL.maxQualifiedCardinality: # This one is a bit complicated, because the literals have been # exchanged against bnodes... # # The construct should lead to an integer. Something may go wrong along the line # leading to an exception... xx = c if x.value == 0: # RULES cls-maxqc1 and cls-maxqc2 folded in one for pp in self.graph.objects(xx, OWL.onProperty): for cc in self.graph.objects(xx, OWL.onClass): for u, y in self.graph.subject_objects(pp): # This should not occur: if ( (y, RDF.type, cc) in self.graph or cc == OWL.Thing ) and (u, RDF.type, xx) in self.graph: self.add_error( "Erroneous usage of maximum qualified cardinality with %s, %s and %s" % (xx, cc, y) ) elif x.value == 1: # RULE cls-maxqc3 and cls-maxqc4 folded in one for pp in self.graph.objects(xx, OWL.onProperty): for cc in self.graph.objects(xx, OWL.onClass): for u, y1 in self.graph.subject_objects(pp): if (u, RDF.type, xx) in self.graph: if cc == OWL.Thing: for y2 in self.graph.objects(u, pp): if y1 != y2: self.store_triple((y1, OWL.sameAs, y2)) else: if (y1, RDF.type, cc) in self.graph: for y2 in self.graph.objects(u, pp): if ( y1 != y2 and (y2, RDF.type, cc) in self.graph ): self.store_triple((y1, OWL.sameAs, y2)) # TODO: what if x.value not in (0, 1)? according to the spec # the cardinality shall be no more than 1, so add an # error? # RULE cls-oo elif p == OWL.oneOf: for y in self._list(x): self.store_triple((y, RDF.type, c)) def _class_axioms(self, triple, cycle_num): """ Table 7: Class Axioms. Essentially, the cax-* rules. @param triple: triple to work on @param cycle_num: which cycle are we in, starting with 1. Can be used for some optimization. """ # In many of the 'if' branches, corresponding to rules in the document, # the branch begins by a renaming of variables (eg, pp, c = s, o). # There is no programming reasons for doing that, but by renaming the # variables it becomes easier to compare the declarative rules # in the document with the implementation c1, p, c2 = triple # RULE cax-sco if p == RDFS.subClassOf: # Other axioms sets classes to be subclasses of themselves, to one can optimize the trivial case if c1 != c2: for x in self.graph.subjects(RDF.type, c1): self.store_triple((x, RDF.type, c2)) # RULES cax-eqc1 and cax-eqc1 # Other axioms set classes to be equivalent to themselves, one can optimize the trivial case elif p == OWL.equivalentClass and c1 != c2: # RULE cax-eqc1 for x in self.graph.subjects(RDF.type, c1): self.store_triple((x, RDF.type, c2)) # RULE cax-eqc1 for x in self.graph.subjects(RDF.type, c2): self.store_triple((x, RDF.type, c1)) # RULE cax-dw elif p == OWL.disjointWith: for x in self.graph.subjects(RDF.type, c1): if (x, RDF.type, c2) in self.graph: self.add_error( "Disjoint classes %s and %s have a common individual %s" % (c1, c2, x) ) # RULE cax-adc elif p == RDF.type and c2 == OWL.AllDisjointClasses: x = c1 for y in self.graph.objects(x, OWL.members): classes = self._list(y) if len(classes) > 0: for i in range(0, len(classes) - 1): cl1 = classes[i] for z in self.graph.subjects(RDF.type, cl1): for cl2 in classes[(i + 1) :]: if (z, RDF.type, cl2) in self.graph: self.add_error( "Disjoint classes %s and %s have a common individual %s" % (cl1, cl2, z) ) def _schema_vocabulary(self, triple, cycle_num): """ Table 9: The Semantics of Schema Vocabulary. Essentially, the scm-* rules @param triple: triple to work on @param cycle_num: which cycle are we in, starting with 1. Can be used for some optimization. """ # In many of the 'if' branches, corresponding to rules in the document, # the branch begins by a renaming of variables (eg, pp, c = s, o). # There is no programming reasons for doing that, but by renaming the # variables it becomes easier to compare the declarative rules # in the document with the implementation s, p, o = triple # RULE scm-cls if p == RDF.type and o == OWL.Class: c = s self.store_triple((c, RDFS.subClassOf, c)) self.store_triple((c, OWL.equivalentClass, c)) self.store_triple((c, RDFS.subClassOf, OWL.Thing)) self.store_triple((OWL.Nothing, RDFS.subClassOf, c)) # RULE scm-sco # Rule scm-eqc2 elif p == RDFS.subClassOf: c1, c2 = s, o # RULE scm-sco # Optimize out the trivial identity case (set elsewhere already) if c1 != c2: for c3 in self.graph.objects(c2, RDFS.subClassOf): # Another axiom already sets that... if c1 != c3: self.store_triple((c1, RDFS.subClassOf, c3)) # RULE scm-eqc2 if (c2, RDFS.subClassOf, c1) in self.graph: self.store_triple((c1, OWL.equivalentClass, c2)) # RULE scm-eqc elif p == OWL.equivalentClass and s != o: c1, c2 = s, o self.store_triple((c1, RDFS.subClassOf, c2)) self.store_triple((c2, RDFS.subClassOf, c1)) # RULE scm-op and RULE scm-dp folded together # There is a bit of a cheating here: 'Property' is not, strictly speaking, in the rule set! elif p == RDF.type and ( o == OWL.ObjectProperty or o == OWL.DatatypeProperty or o == RDF.Property ): pp = s self.store_triple((pp, RDFS.subPropertyOf, pp)) self.store_triple((pp, OWL.equivalentProperty, pp)) # RULE scm-spo # RULE scm-eqp2 elif p == RDFS.subPropertyOf and s != o: p1, p2 = s, o # Optimize out the trivial identity case (set elsewhere already) # RULE scm-spo if p1 != p2: for p3 in self.graph.objects(p2, RDFS.subPropertyOf): if p1 != p3: self.store_triple((p1, RDFS.subPropertyOf, p3)) # RULE scm-eqp2 if (p2, RDFS.subPropertyOf, p1) in self.graph: self.store_triple((p1, OWL.equivalentProperty, p2)) # RULE scm-eqp # Optimize out the trivial identity case (set elsewhere already) elif p == OWL.equivalentProperty and s != o: p1, p2 = s, o self.store_triple((p1, RDFS.subPropertyOf, p2)) self.store_triple((p2, RDFS.subPropertyOf, p1)) # RULES scm-dom1 and scm-dom2 elif p == RDFS.domain: # RULE scm-dom1 pp, c1 = s, o for (_x, _y, c2) in self.graph.triples((c1, RDFS.subClassOf, None)): if c1 != c2: self.store_triple((pp, RDFS.domain, c2)) # RULE scm-dom1 p2, c = s, o for (p1, _x, _y) in self.graph.triples((None, RDFS.subPropertyOf, p2)): if p1 != p2: self.store_triple((p1, RDFS.domain, c)) # RULES scm-rng1 and scm-rng2 elif p == RDFS.range: # RULE scm-rng1 pp, c1 = s, o for (_x, _y, c2) in self.graph.triples((c1, RDFS.subClassOf, None)): if c1 != c2: self.store_triple((pp, RDFS.range, c2)) # RULE scm-rng1 p2, c = s, o for (p1, _x, _y) in self.graph.triples((None, RDFS.subPropertyOf, p2)): if p1 != p2: self.store_triple((p1, RDFS.range, c)) # RULE scm-hv elif p == OWL.hasValue: c1, i = s, o for p1 in self.graph.objects(c1, OWL.onProperty): for c2 in self.graph.subjects(OWL.hasValue, i): for p2 in self.graph.objects(c2, OWL.onProperty): if (p1, RDFS.subPropertyOf, p2) in self.graph: self.store_triple((c1, RDFS.subClassOf, c2)) # RULES scm-svf1 and scm-svf2 elif p == OWL.someValuesFrom: # RULE scm-svf1 c1, y1 = s, o for pp in self.graph.objects(c1, OWL.onProperty): for c2 in self.graph.subjects(OWL.onProperty, pp): for y2 in self.graph.objects(c2, OWL.someValuesFrom): if (y1, RDFS.subClassOf, y2) in self.graph: self.store_triple((c1, RDFS.subClassOf, c2)) # RULE scm-svf2 c1, y = s, o for p1 in self.graph.objects(c1, OWL.onProperty): for c2 in self.graph.subjects(OWL.someValuesFrom, y): for p2 in self.graph.objects(c2, OWL.onProperty): if (p1, RDFS.subPropertyOf, p2) in self.graph: self.store_triple((c1, RDFS.subClassOf, c2)) # RULES scm-avf1 and scm-avf2 elif p == OWL.allValuesFrom: # RULE scm-avf1 c1, y1 = s, o for pp in self.graph.objects(c1, OWL.onProperty): for c2 in self.graph.subjects(OWL.onProperty, pp): for y2 in self.graph.objects(c2, OWL.allValuesFrom): if (y1, RDFS.subClassOf, y2) in self.graph: self.store_triple((c1, RDFS.subClassOf, c2)) # RULE scm-avf2 c1, y = s, o for p1 in self.graph.objects(c1, OWL.onProperty): for c2 in self.graph.subjects(OWL.allValuesFrom, y): for p2 in self.graph.objects(c2, OWL.onProperty): if (p1, RDFS.subPropertyOf, p2) in self.graph: self.store_triple((c2, RDFS.subClassOf, c1)) # RULE scm-int elif p == OWL.intersectionOf: c, x = s, o for ci in self._list(x): self.store_triple((c, RDFS.subClassOf, ci)) # RULE scm-uni elif p == OWL.unionOf: c, x = s, o for ci in self._list(x): self.store_triple((ci, RDFS.subClassOf, c)) OWL-RL-7.1.4/owlrl/OWLRLExtras.py000077500000000000000000000372461504201166100163110ustar00rootroot00000000000000# -*- coding: utf-8 -*- # """ Extension to OWL 2 RL, ie, some additional rules added to the system from OWL 2 Full. It is implemented through the :class:`.OWLRL_Extension` class, whose reference has to be passed to the relevant semantic class (i.e., either the OWL 2 RL or the combined closure class) as an 'extension'. The added rules and features are: - self restriction - owl:rational datatype - datatype restrictions via facets In more details, the rules that are added: 1. self restriction 1: :code:`?z owl:hasSelf ?x. ?x owl:onProperty ?p. ?y rdf:type ?z. => ?y ?p ?y.` 2. self restriction 2: :code:`?z owl:hasSelf ?x. ?x owl:onProperty ?p. ?y ?p ?y. => ?y rdf:type ?z.` **Requires**: `RDFLib`_, 4.0.0 and higher. .. _RDFLib: https://github.com/RDFLib/rdflib **License**: This software is available for use under the `W3C Software License`_. .. _W3C Software License: http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 **Organization**: `World Wide Web Consortium`_ .. _World Wide Web Consortium: http://www.w3.org **Author**: `Ivan Herman`_ .. _Ivan Herman: http://www.w3.org/People/Ivan/ """ __author__ = "Ivan Herman" __contact__ = "Ivan Herman, ivan@w3.org" __license__ = "W3C® SOFTWARE NOTICE AND LICENSE, http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231" from typing import Union import rdflib from rdflib import Graph from rdflib.namespace import RDF, RDFS, OWL, XSD from fractions import Fraction as Rational from .DatatypeHandling import AltXSDToPYTHON # noinspection PyPep8Naming from .CombinedClosure import RDFS_OWLRL_Semantics from .OWLRL import OWLRL_Annotation_properties from .XsdDatatypes import OWL_RL_Datatypes, OWL_Datatype_Subsumptions from .RestrictedDatatype import extract_faceted_datatypes ####################################################################################################################### # Rational datatype # noinspection PyPep8Naming def _strToRational(v): """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. @param v: the literal string defined as boolean @return corresponding Rational value @rtype: Rational @raise ValueError: invalid rational string literal """ try: r = v.split("/") if len(r) == 2: n_str = r[0] d_str = r[1] else: n_str = r[0] d_str = "1" if d_str.strip()[0] == "+": raise ValueError("Invalid Rational literal value %s" % v) else: return Rational( AltXSDToPYTHON[XSD.integer](n_str), AltXSDToPYTHON[XSD.positiveInteger](d_str), ) except: raise ValueError("Invalid Rational literal value %s" % v) ####################################################################################################################### # noinspection PyPep8Naming,PyBroadException class OWLRL_Extension(RDFS_OWLRL_Semantics): """ Additional rules to OWL 2 RL. The initialization method also adds the :code:`owl:rational` datatype to the set of allowed datatypes with the :func:`owlrl.OWLRLExtras._strToRational` function as a conversion between the literal form and a Rational. The :code:`xsd:decimal` datatype is also set to be a subclass of :code:`owl:rational`. Furthermore, the restricted datatypes are extracted from the graph using a separate method in a different module (:py:func:`.RestrictedDatatype.extract_faceted_datatypes`), and all those datatypes are also added to the set of allowed datatypes. In the case of the restricted datatypes and extra subsumption relationship is set up between the restricted and the base datatypes. :cvar extra_axioms: Additional axioms that have to be added to the deductive closure (in case the axiomatic triples are required). :var restricted_datatypes: list of the datatype restriction from :class:`.RestrictedDatatype`. :type restricted_datatypes: list of L{restricted datatype} instances """ extra_axioms = [ (OWL.hasSelf, RDF.type, RDF.Property), (OWL.hasSelf, RDFS.domain, RDF.Property), ] def __init__(self, graph: Graph, axioms, daxioms, rdfs: bool = False, destination: Union[None, Graph] = None): """ @param graph: the RDF graph to be extended @type graph: rdflib.Graph @param axioms: whether (non-datatype) axiomatic triples should be added or not @type axioms: Boolean @param daxioms: whether datatype axiomatic triples should be added or not @type daxioms: Boolean @param rdfs: whether RDFS extension is done @type rdfs: boolean @param destination: the destination graph to which the results are written. If None, use the source graph. @type destination: rdflib.Graph """ RDFS_OWLRL_Semantics.__init__(self, graph, axioms, daxioms, rdfs=rdfs, destination=destination) self.rdfs = rdfs self.add_new_datatype( OWL.rational, _strToRational, OWL_RL_Datatypes, subsumption_dict=OWL_Datatype_Subsumptions, subsumption_key=XSD.decimal, subsumption_list=[OWL.rational], ) self.restricted_datatypes = extract_faceted_datatypes(self, graph) for dt in self.restricted_datatypes: self.add_new_datatype( dt.datatype, dt.toPython, OWL_RL_Datatypes, subsumption_dict=OWL_Datatype_Subsumptions, subsumption_key=dt.datatype, subsumption_list=[dt.base_type], ) # noinspection PyShadowingNames def _subsume_restricted_datatypes(self): """ A one-time-rule: all the literals are checked whether they are (a) of type restricted by a faceted (restricted) datatype and (b) whether the corresponding value abides to the restrictions. If true, then the literal gets an extra tag as being of type of the restricted datatype, too. """ literals = self._literals() for rt in self.restricted_datatypes: # This is a recorded restriction. The base type is: base_type = rt.base_type # Look through all the literals for lt in literals: # check if the type of that literal matches. Note that this also takes # into account the subsumption datatypes, that have been taken # care of by the 'regular' OWL RL process if (lt, RDF.type, base_type) in self.graph: try: # the conversion or the check may go wrong and raise an exception; then simply move on if rt.checkValue(lt.toPython()): # yep, this is also of type 'rt' self.store_triple((lt, RDF.type, rt.datatype)) except: continue def restriction_typing_check(self, v, t): """ Helping method to check whether a type statement is in line with a possible restriction. This method is invoked by rule "cls-avf" before setting a type on an allValuesFrom restriction. The method is a placeholder at this level. It is typically implemented by subclasses for extra checks, e.g., for datatype facet checks. :param v: the resource that is to be 'typed'. :param t: the targeted type (i.e., Class). :return: Boolean. :rtype: bool """ # Look through the restricted datatypes to see if 't' corresponds to one of those... # There are a bunch of possible exceptions here with datatypes, but they can all # be ignored... try: for rt in self.restricted_datatypes: if rt.datatype == t: # bingo if v in self.literal_proxies.bnode_to_lit: return rt.checkValue( self.literal_proxies.bnode_to_lit[v].lit.toPython() ) else: return True # if we got here, no restriction applies return True except: return True def one_time_rules(self): """ This method is invoked only once at the beginning, and prior of, the forward chaining process. At present, only the L{subsumption} of restricted datatypes<_subsume_restricted_datatypes>} is performed. """ RDFS_OWLRL_Semantics.one_time_rules(self) # it is important to flush the triples at this point, because # the handling of the restriction datatypes rely on the datatype # subsumption triples added by the superclass self.flush_stored_triples() self._subsume_restricted_datatypes() def add_axioms(self): """ Add the :class:`owlrl.OWLRLExtras.OWLRL_Extension.extra_axioms`, related to the self restrictions. This method is invoked only once at the beginning, and prior of, the forward chaining process. """ RDFS_OWLRL_Semantics.add_axioms(self) for t in self.extra_axioms: self.destination.add(t) def rules(self, t, cycle_num): """ Go through the additional rules implemented by this module. :param t: A triple (in the form of a tuple). :type t: tuple :param cycle_num: Which cycle are we in, starting with 1. This value is forwarded to all local rules; it is also used locally to collect the bnodes in the graph. :type cycle_num: int """ RDFS_OWLRL_Semantics.rules(self, t, cycle_num) z, q, x = t if q == OWL.hasSelf: for p in self.graph.objects(z, OWL.onProperty): for y in self.graph.subjects(RDF.type, z): self.store_triple((y, p, y)) for y1, y2 in self.graph.subject_objects(p): if y1 == y2: self.store_triple((y1, RDF.type, z)) # noinspection PyPep8Naming class OWLRL_Extension_Trimming(OWLRL_Extension): """ This Class adds only one feature to :class:`.OWLRL_Extension`: to initialize with a trimming flag set to :code:`True` by default. This is pretty experimental and probably contentious: this class *removes* a number of triples from the Graph at the very end of the processing steps. These triples are either the by-products of the deductive closure calculation or are axiom like triples that are added following the rules of OWL 2 RL. While these triples *are necessary* for the correct inference of really 'useful' triples, they may not be of interest for the application for the end result. The triples that are removed are of the form (following a SPARQL-like notation): - :code:`?x owl:sameAs ?x`, :code:`?x rdfs:subClassOf ?x`, :code:`?x rdfs:subPropertyOf ?x`, :code:`?x owl:equivalentClass ?x` type triples. - :code:`?x rdfs:subClassOf rdf:Resource`, :code:`?x rdfs:subClassOf owl:Thing`, :code:`?x rdf:type rdf:Resource`, :code:`owl:Nothing rdfs:subClassOf ?x` type triples. - For a datatype that does *not* appear explicitly in a type assignments (ie, in a :code:`?x rdf:type dt`) the corresponding :code:`dt rdf:type owl:Datatype` and :code:`dt rdf:type owl:DataRange` triples, as well as the disjointness statements with other datatypes. - annotation property axioms. - a number of axiomatic triples on :code:`owl:Thing`, :code:`owl:Nothing` and :code:`rdf:Resource` (eg, :code:`owl:Nothing rdf:type owl:Class`, :code:`owl:Thing owl:equivalentClass rdf:Resource`, etc). Trimming is the only feature of this class, done in the :py:meth:`.post_process` step. If users extend :class:`OWLRL_Extension`, this class can be safely mixed in via multiple inheritance. :param graph: The RDF graph to be extended. :type graph: :class:`rdflib.Graph` :param axioms: Whether (non-datatype) axiomatic triples should be added or not. :type axioms: bool :param daxioms: Whether datatype axiomatic triples should be added or not. :type daxioms: bool :param rdfs: Whether RDFS extension is done. :type rdfs: bool """ def __init__(self, graph: Graph, axioms, daxioms, rdfs: bool = False, destination: Union[None, Graph] = None): """ @param graph: the RDF graph to be extended @type graph: rdflib.Graph @param axioms: whether (non-datatype) axiomatic triples should be added or not @type axioms: Boolean @param daxioms: whether datatype axiomatic triples should be added or not @type daxioms: Boolean @param rdfs: whether RDFS extension is done @type rdfs: boolean @param destination: the destination graph to which the results are written. If None, use the source graph. @type destination: rdflib.Graph """ OWLRL_Extension.__init__(self, graph, axioms, daxioms, rdfs=rdfs, destination=destination) def post_process(self): """ Do some post-processing step performing the trimming of the graph. See the :class:`.OWLRL_Extension_Trimming` class for further details. """ OWLRL_Extension.post_process(self) self.flush_stored_triples() to_be_removed = set() for t in self.graph.triples((None, None, None)): s, p, o = t if s == o: if ( p == OWL.sameAs or p == OWL.equivalentClass or p == RDFS.subClassOf or p == RDFS.subPropertyOf ): to_be_removed.add(t) if ( (p == RDFS.subClassOf and (o == OWL.Thing or o == RDFS.Resource)) or (p == RDF.type and o == RDFS.Resource) or (s == OWL.Nothing and p == RDFS.subClassOf) ): to_be_removed.add(t) for dt in OWL_RL_Datatypes: # see if this datatype appears explicitly in the graph as the type of a symbol if len([s for s in self.graph.subjects(RDF.type, dt)]) == 0: to_be_removed.add((dt, RDF.type, RDFS.Datatype)) to_be_removed.add((dt, RDF.type, OWL.DataRange)) for t in self.graph.triples((dt, OWL.disjointWith, None)): to_be_removed.add(t) for t in self.graph.triples((None, OWL.disjointWith, dt)): to_be_removed.add(t) for an in OWLRL_Annotation_properties: self.destination.remove((an, RDF.type, OWL.AnnotationProperty)) to_be_removed.add((OWL.Nothing, RDF.type, OWL.Class)) to_be_removed.add((OWL.Nothing, RDF.type, RDFS.Class)) to_be_removed.add((OWL.Thing, RDF.type, OWL.Class)) to_be_removed.add((OWL.Thing, RDF.type, RDFS.Class)) to_be_removed.add((OWL.Thing, OWL.equivalentClass, RDFS.Resource)) to_be_removed.add((RDFS.Resource, OWL.equivalentClass, OWL.Thing)) to_be_removed.add((OWL.Class, OWL.equivalentClass, RDFS.Class)) to_be_removed.add((OWL.Class, RDFS.subClassOf, RDFS.Class)) to_be_removed.add((RDFS.Class, OWL.equivalentClass, OWL.Class)) to_be_removed.add((RDFS.Class, RDFS.subClassOf, OWL.Class)) to_be_removed.add((RDFS.Datatype, RDFS.subClassOf, OWL.DataRange)) to_be_removed.add((RDFS.Datatype, OWL.equivalentClass, OWL.DataRange)) to_be_removed.add((OWL.DataRange, RDFS.subClassOf, OWL.DatatypeProperty)) to_be_removed.add((OWL.DataRange, OWL.equivalentClass, OWL.DatatypeProperty)) for t in to_be_removed: self.destination.remove(t) OWL-RL-7.1.4/owlrl/RDFSClosure.py000077500000000000000000000201001504201166100162730ustar00rootroot00000000000000# -*- coding: utf-8 -*- # """ This module is brute force implementation of the RDFS semantics on the top of RDFLib (with some caveats, see in the introductory text). **Requires**: `RDFLib`_, 4.0.0 and higher. .. _RDFLib: https://github.com/RDFLib/rdflib **License**: This software is available for use under the `W3C Software License`_. .. _W3C Software License: http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 **Organization**: `World Wide Web Consortium`_ .. _World Wide Web Consortium: http://www.w3.org **Author**: `Ivan Herman`_ .. _Ivan Herman: http://www.w3.org/People/Ivan/ """ __author__ = "Ivan Herman" __contact__ = "Ivan Herman, ivan@w3.org" __license__ = "W3C® SOFTWARE NOTICE AND LICENSE, http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231" from typing import Union import rdflib from rdflib import Literal, Graph from rdflib.namespace import RDF, RDFS from itertools import product from owlrl.Closure import Core from owlrl.AxiomaticTriples import RDFS_Axiomatic_Triples, RDFS_D_Axiomatic_Triples ###################################################################################################### # RDFS Semantics class # noinspection PyPep8Naming class RDFS_Semantics(Core): """ RDFS Semantics class, ie, implementation of the RDFS closure graph. .. note:: Note that the module does *not* implement the so called Datatype entailment rules, simply because the underlying RDFLib does not implement the datatypes (ie, RDFLib will not make the literal "1.00" and "1.00000" identical, although even with all the ambiguities on datatypes, this I{should} be made equal...). Also, the so-called extensional entailment rules (Section 7.3.1 in the RDF Semantics document) have not been implemented either. The comments and references to the various rule follow the names as used in the `RDF Semantics document`_. .. _RDF Semantics document: http://www.w3.org/TR/rdf-mt/ :param graph: The RDF graph to be extended. :type graph: :class:`rdflib.Graph` :param axioms: Whether (non-datatype) axiomatic triples should be added or not. :type axioms: bool :param daxioms: Whether datatype axiomatic triples should be added or not. :type daxioms: bool :param rdfs: Whether RDFS inference is also done (used in subclassed only). :type rdfs: bool """ def __init__(self, graph: Graph, axioms, daxioms, rdfs: bool = False, destination: Union[None, Graph] = None): """ @param graph: the RDF graph to be extended @type graph: rdflib.Graph @param axioms: whether (non-datatype) axiomatic triples should be added or not @type axioms: bool @param daxioms: whether datatype axiomatic triples should be added or not @type daxioms: bool @param rdfs: whether RDFS inference is also done (used in subclassed only) @type rdfs: boolean @param destination: the destination graph to which the results are written. If None, use the source graph. @type destination: rdflib.Graph """ Core.__init__(self, graph, axioms, daxioms, rdfs=rdfs, destination=destination) def add_axioms(self): """ Add axioms """ for t in RDFS_Axiomatic_Triples: self.destination.add(t) for i in range(1, self.IMaxNum + 1): ci = RDF[("_%d" % i)] self.destination.add((ci, RDF.type, RDF.Property)) self.destination.add((ci, RDFS.domain, RDFS.Resource)) self.destination.add((ci, RDFS.range, RDFS.Resource)) self.destination.add((ci, RDF.type, RDFS.ContainerMembershipProperty)) def add_d_axioms(self): """ This is not really complete, because it just uses the comparison possibilities that RDFLib provides. """ # #1 literals = (lt for lt in self._literals() if lt.datatype is not None) for lt in literals: self.destination.add((lt, RDF.type, lt.datatype)) for t in RDFS_D_Axiomatic_Triples: self.destination.add(t) @staticmethod def _literals_same_as(lt1, lt2): if lt1.value is not None and lt2.value is not None: return lt1.value == lt2.value elif lt1.datatype is not None and lt2.datatype is not None: return lt1.__eq__(lt2) return False # noinspection PyBroadException def one_time_rules(self): """ Some of the rules in the rule set are axiomatic in nature, meaning that they really have to be added only once, there is no reason to add these in a cycle. These are performed by this method that is invoked only once at the beginning of the process. In this case this is related to a 'hidden' same as rules on literals with identical values (though different lexical values). """ # There is also a hidden sameAs rule in RDF Semantics: if a literal appears in a triple, and another one has # the same value, then the triple should be duplicated with the other value. literals = self._literals() items = ( (lt1, lt2) for lt1, lt2 in product(literals, literals) if (lt1 is lt2) or self._literals_same_as(lt1, lt2) ) for lt1, lt2 in items: # In OWL, this line is simply stating a sameAs for the # corresponding literals, and then let the usual rules take # effect. In RDFS this is not possible, so the sameAs rule is, # essentially replicated... for (s, p, o) in self.graph.triples((None, None, lt1)): self.destination.add((s, p, lt2)) def rules(self, t, cycle_num): """ Go through the RDFS entailment rules rdf1, rdfs4-rdfs12, by extending the graph. :param t: A triple (in the form of a tuple). :type t: tuple :param cycle_num: Which cycle are we in, starting with 1. Can be used for some (though minor) optimization. :type cycle_num: int """ s, p, o = t # rdf1 self.store_triple((p, RDF.type, RDF.Property)) # rdfs4a if cycle_num == 1: self.store_triple((s, RDF.type, RDFS.Resource)) # rdfs4b if cycle_num == 1: self.store_triple((o, RDF.type, RDFS.Resource)) if p == RDFS.domain: # rdfs2 for uuu, Y, yyy in self.graph.triples((None, s, None)): self.store_triple((uuu, RDF.type, o)) if p == RDFS.range: # rdfs3 for uuu, Y, vvv in self.graph.triples((None, s, None)): self.store_triple((vvv, RDF.type, o)) if p == RDFS.subPropertyOf: # rdfs5 for Z, Y, xxx in self.graph.triples((o, RDFS.subPropertyOf, None)): self.store_triple((s, RDFS.subPropertyOf, xxx)) # rdfs7 for zzz, Z, www in self.graph.triples((None, s, None)): self.store_triple((zzz, o, www)) if p == RDF.type and o == RDF.Property: # rdfs6 self.store_triple((s, RDFS.subPropertyOf, s)) if p == RDF.type and o == RDFS.Class: # rdfs8 self.store_triple((s, RDFS.subClassOf, RDFS.Resource)) # rdfs10 self.store_triple((s, RDFS.subClassOf, s)) if p == RDFS.subClassOf: # rdfs9 for vvv, Y, Z in self.graph.triples((None, RDF.type, s)): self.store_triple((vvv, RDF.type, o)) # rdfs11 for Z, Y, xxx in self.graph.triples((o, RDFS.subClassOf, None)): self.store_triple((s, RDFS.subClassOf, xxx)) if p == RDF.type and o == RDFS.ContainerMembershipProperty: # rdfs12 self.store_triple((s, RDFS.subPropertyOf, RDFS.member)) if p == RDF.type and o == RDFS.Datatype: self.store_triple((s, RDFS.subClassOf, RDFS.Literal)) def _literals(self): """ Get all literals defined in the graph. """ return set( o for s, p, o in self.graph.triples((None, None, None)) if isinstance(o, Literal) ) OWL-RL-7.1.4/owlrl/RestrictedDatatype.py000066400000000000000000000506611504201166100200200ustar00rootroot00000000000000# -*- coding: utf-8 -*- # """ Module to datatype restrictions, i.e., data ranges. The module implements the following aspects of datatype restrictions: - a new datatype is created run-time and added to the allowed and accepted datatypes; literals are checked whether they abide to the restrictions - the new datatype is defined to be a 'subClass' of the restricted datatype - literals of the restricted datatype and that abide to the restrictions defined by the facets are also assigned to be of the new type The last item is important to handle the following structures:: ex:RE a owl:Restriction ; owl:onProperty ex:p ; owl:someValuesFrom [ a rdfs:Datatype ; owl:onDatatype xsd:string ; owl:withRestrictions ( [ xsd:minLength "3"^^xsd:integer ] [ xsd:maxLength "6"^^xsd:integer ] ) ] . ex:q ex:p "abcd"^^xsd:string. In the case above the system can then infer that :code:`ex:q` is also of type :code:`ex:RE`. Datatype restrictions are used by the :class:`.OWLRLExtras.OWLRL_Extension` extension class. The implementation is **not** 100% complete. Some things that an ideal implementation should do are not done yet like: - checking whether a facet is of a datatype that is allowed for that facet - handling of non-literals in the facets (ie, if the resource is defined to be of type literal, but whose value is defined via a separate :code:`owl:sameAs` somewhere else) **Requires**: `RDFLib`_, 4.0.0 and higher. .. _RDFLib: https://github.com/RDFLib/rdflib **License**: This software is available for use under the `W3C Software License`_. .. _W3C Software License: http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 **Organization**: `World Wide Web Consortium`_ .. _World Wide Web Consortium: http://www.w3.org **Author**: `Ivan Herman`_ .. _Ivan Herman: http://www.w3.org/People/Ivan/ """ __author__ = "Ivan Herman" __contact__ = "Ivan Herman, ivan@w3.org" __license__ = "W3C® SOFTWARE NOTICE AND LICENSE, http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231" import re from rdflib.namespace import OWL, RDF, RDFS, XSD from rdflib import Literal as rdflibLiteral, Graph from .DatatypeHandling import AltXSDToPYTHON from functools import reduce # Constant for datatypes using min, max (inclusive and exclusive): MIN_MAX = 0 # Constant for datatypes using length, minLength, and maxLength (and nothing else) LENGTH = 1 # Constant for datatypes using length, minLength, maxLength, and pattern LENGTH_AND_PATTERN = 2 # Constant for datatypes using length, minLength, maxLength, pattern, and lang range LENGTH_PATTERN_LRANGE = 3 # Dictionary of all the datatypes, keyed by category Datatypes_per_facets = { MIN_MAX: [ # OWL.rational, # OWL.real, XSD.decimal, XSD.integer, XSD.nonNegativeInteger, XSD.nonPositiveInteger, XSD.positiveInteger, XSD.negativeInteger, XSD.long, XSD.short, XSD.byte, XSD.unsignedLong, XSD.unsignedInt, XSD.unsignedShort, XSD.unsignedByte, XSD.double, XSD.float, XSD.dateTime, XSD.dateTimeStamp, XSD.time, XSD.date, ], LENGTH: [XSD.hexBinary, XSD.base64Binary], LENGTH_AND_PATTERN: [ XSD.anyURI, XSD.string, XSD.NMTOKEN, XSD.Name, XSD.NCName, XSD.language, XSD.normalizedString, ], LENGTH_PATTERN_LRANGE: [RDF.PlainLiteral], } # a simple list containing C{all} datatypes that may have a facet facetable_datatypes = reduce(lambda x, y: x + y, list(Datatypes_per_facets.values())) ####################################################################################################### def _lit_to_value(dt, v): """ This method is used to convert a string to a value with facet checking. RDF Literals are converted to Python values using this method; if there is a problem, an exception is raised (and caught higher up to generate an error message). The method is the equivalent of all the methods in the :mod:`.DatatypeHandling` module, and is registered to the system run time, as new restricted datatypes are discovered. (Technically, the registration is done via a :code:`lambda v: _lit_to_value(self,v)` setting from within a :class:`.RestrictedDatatype` instance). :param dt: Faceted datatype. :type dt: :class:`RestrictedDatatype` :param v: Literal to be converted and checked. :raise ValueError: Invalid literal value. """ # This may raise an exception... value = dt.converter(v) # look at the different facet categories and try to find which is # is, if any, the one that is of relevant for this literal for cat in Datatypes_per_facets: if dt.base_type in Datatypes_per_facets[cat]: # yep, this is to be checked. if not dt.checkValue(value): raise ValueError( "Literal value %s does not fit the faceted datatype %s" % (v, dt) ) # got here, everything should be fine return value # noinspection PyPep8Naming,PyShadowingBuiltins def _lang_range_check(range, lang): """ Implementation of the extended filtering algorithm, as defined in point 3.3.2, of U{RFC 4647}, on matching language ranges and language tags. Needed to handle the C{rdf:PlainLiteral} datatype. @param range: language range @param lang: language tag @rtype: boolean """ def _match(r, l): """Matching of a range and language item: either range is a wildcard or the two are equal @param r: language range item @param l: language tag item @rtype: boolean """ return r == "*" or r == l rangeList = range.strip().lower().split("-") langList = lang.strip().lower().split("-") if not _match(rangeList[0], langList[0]): return False rI = 1 rL = 1 while rI < len(rangeList): if rangeList[rI] == "*": rI += 1 continue if rL >= len(langList): return False if _match(rangeList[rI], langList[rL]): rI += 1 rL += 1 continue if len(langList[rL]) == 1: return False else: rL += 1 continue return True ####################################################################################################### def extract_faceted_datatypes(core, graph: Graph): """ Extractions of restricted (i.e., faceted) datatypes from the graph. :param core: The core closure instance that is being handled. :type core: :class:`.Closure.Core` :param graph: RDFLib graph. :type graph: :class:`rdflib.graph.Graph` :return: List of :class:`.RestrictedDatatype` instances. :rtype: list """ retval = [] for dtype in graph.subjects(RDF.type, RDFS.Datatype): base_type = None facets = [] try: base_types = [x for x in graph.objects(dtype, OWL.onDatatype)] if len(base_types) > 0: if len(base_types) > 1: raise Exception( "Several base datatype for the same restriction %s" % dtype ) else: base_type = base_types[0] if base_type in facetable_datatypes: rlists = [x for x in graph.objects(dtype, OWL.withRestrictions)] if len(rlists) > 1: raise Exception( "More than one facet lists for the same restriction %s" % dtype ) elif len(rlists) > 0: final_facets = [] for r in graph.items(rlists[0]): for (facet, lit) in graph.predicate_objects(r): if isinstance(lit, rdflibLiteral): # the python value of the literal should be extracted # note that this call may lead to an exception, but that is fine, # it is caught some lines below anyway... try: if ( lit.datatype is None or lit.datatype == XSD.string ): final_facets.append((facet, str(lit))) else: final_facets.append( ( facet, AltXSDToPYTHON[lit.datatype]( str(lit) ), ) ) except Exception as msg: core.add_error(msg) continue # We do have everything we need: new_datatype = RestrictedDatatype( dtype, base_type, final_facets ) retval.append(new_datatype) except Exception as msg: # import sys # print sys.exc_info() # print sys.exc_type # print sys.exc_value # print sys.exc_traceback core.add_error(msg) continue return retval # noinspection PyPep8Naming class RestrictedDatatypeCore: """ An 'abstract' superclass for datatype restrictions. The instance variables listed here are used in general, without the specificities of the concrete restricted datatype. This module defines the :class:`.RestrictedDatatype` class that corresponds to the datatypes and their restrictions defined in the OWL 2 standard. Other modules may subclass this class to define new datatypes with restrictions. :ivar type_uri: The URI for this datatype. :ivar base_type: URI of the datatype that is restricted. :ivar toPython: Function to convert a Literal of the specified type to a Python value. """ def __init__(self, type_uri, base_type): self.datatype = type_uri self.base_type = base_type self.toPython = None def checkValue(self, value): """ Check whether the (Python) value abides to the constraints defined by the current facets. :param value: The value to be checked. :rtype: bool """ raise Exception( "This class should not be used by itself, only via its subclasses!" ) # noinspection PyPep8Naming class RestrictedDatatype(RestrictedDatatypeCore): """ Implementation of a datatype with facets, ie, datatype with restrictions. :param type_uri: URI of the datatype being defined. :param base_type: URI of the base datatype, ie, the one being restricted. :param facets: List of :code:`(facetURI, value)` pairs. :ivar datatype : The URI for this datatype. :ivar base_type: URI of the datatype that is restricted. :ivar converter: Method to convert a literal of the base type to a Python value (:code:`DatatypeHandling.AltXSDToPYTHON`). :ivar minExclusive: Value for the :code`xsd:minExclusive` facet, initialized to :code:`None` and set to the right value if a facet is around. :ivar minInclusive: Value for the :code:`xsd:minInclusive` facet, initialized to :code:`None` and set to the right value if a facet is around. :ivar maxExclusive: Value for the :code:`xsd:maxExclusive` facet, initialized to :code:`None` and set to the right value if a facet is around. :ivar maxInclusive: Value for the :code:`xsd:maxInclusive` facet, initialized to :code:`None` and set to the right value if a facet is around. :ivar minLength: Value for the :code:`xsd:minLength` facet, initialized to :code:`None` and set to the right value if a facet is around. :ivar maxLength: Value for the :code:`xsd:maxLength` facet, initialized to :code:`None` and set to the right value if a facet is around. :ivar length: Value for the :code:`xsd:length` facet, initialized to :code:`None` and set to the right value if a facet is around. :ivar pattern: Array of patterns for the :code:`xsd:pattern` facet, initialized to :code:`[]` and set to the right value if a facet is around. :ivar langRange: Array of language ranges for the :code:`rdf:langRange` facet, initialized to :code:`[]` and set to the right value if a facet is around. :ivar check_methods: List of class methods that are relevant for the given :code:`base_type`. :ivar toPython: Function to convert a Literal of the specified type to a Python value. Is defined by :code:`lambda v: _lit_to_value(self, v)`, see :py:func:`._lit_to_value`. """ def __init__(self, type_uri, base_type, facets): """ @param type_uri: URI of the datatype being defined @param base_type: URI of the base datatype, ie, the one being restricted @param facets: array of C{(facetURI, value)} pairs """ RestrictedDatatypeCore.__init__(self, type_uri, base_type) if self.base_type not in AltXSDToPYTHON: raise Exception("No facet is implemented for datatype %s" % self.base_type) self.converter = AltXSDToPYTHON[self.base_type] self.minExclusive = None self.maxExclusive = None self.minInclusive = None self.maxInclusive = None self.length = None self.maxLength = None self.minLength = None self.pattern = [] self.langRange = [] for (facet, value) in facets: if facet == XSD.minInclusive and ( self.minInclusive is None or self.minInclusive < value ): self.minInclusive = value elif facet == XSD.minExclusive and ( self.minExclusive is None or self.minExclusive < value ): self.minExclusive = value elif facet == XSD.maxInclusive and ( self.maxInclusive is None or value < self.maxInclusive ): self.maxInclusive = value elif facet == XSD.maxExclusive and ( self.maxExclusive is None or value < self.maxExclusive ): self.maxExclusive = value elif facet == RDF.langRange: self.langRange.append(value) elif facet == XSD.length: self.length = value elif facet == XSD.maxLength and ( self.maxLength is None or value < self.maxLength ): self.maxLength = value elif facet == XSD.minLength and ( self.minLength is None or value > self.minLength ): self.minLength = value elif facet == XSD.pattern: self.pattern.append(re.compile(value)) # Choose the methods that are relevant for this datatype, based on the base type facet_to_method = { MIN_MAX: [ RestrictedDatatype._check_max_exclusive, RestrictedDatatype._check_min_exclusive, RestrictedDatatype._check_max_inclusive, RestrictedDatatype._check_min_inclusive, ], LENGTH: [ RestrictedDatatype._check_min_length, RestrictedDatatype._check_max_length, RestrictedDatatype._check_length, ], LENGTH_AND_PATTERN: [ RestrictedDatatype._check_min_length, RestrictedDatatype._check_max_length, RestrictedDatatype._check_length, RestrictedDatatype._check_pattern, ], LENGTH_PATTERN_LRANGE: [ RestrictedDatatype._check_min_length, RestrictedDatatype._check_max_length, RestrictedDatatype._check_length, RestrictedDatatype._check_lang_range, ], } self.check_methods = [] for cat in Datatypes_per_facets: if self.base_type in Datatypes_per_facets[cat]: self.check_methods = facet_to_method[cat] break self.toPython = lambda v: _lit_to_value(self, v) def checkValue(self, value): """ Check whether the (Python) value abides to the constraints defined by the current facets. :param value: The value to be checked. :rtype: bool """ for method in self.check_methods: if not method(self, value): return False return True def _check_min_exclusive(self, value): """ Check the (python) value against min exclusive facet. @param value: the value to be checked @rtype: boolean """ if self.minExclusive is not None: return self.minExclusive < value else: return True def _check_min_inclusive(self, value): """ Check the (python) value against min inclusive facet. @param value: the value to be checked @rtype: boolean """ if self.minInclusive is not None: return self.minInclusive <= value else: return True def _check_max_exclusive(self, value): """ Check the (python) value against max exclusive facet. @param value: the value to be checked @rtype: boolean """ if self.maxExclusive is not None: return value < self.maxExclusive else: return True def _check_max_inclusive(self, value): """ Check the (python) value against max inclusive facet. @param value: the value to be checked @rtype: boolean """ if self.maxInclusive is not None: return value <= self.maxInclusive else: return True def _check_min_length(self, value): """ Check the (python) value against minimum length facet. @param value: the value to be checked @rtype: boolean """ if isinstance(value, rdflibLiteral): val = str(value) else: val = value if self.minLength is not None: return self.minLength <= len(val) else: return True def _check_max_length(self, value): """ Check the (python) value against maximum length facet. @param value: the value to be checked @rtype: boolean """ if isinstance(value, rdflibLiteral): val = str(value) else: val = value if self.maxLength is not None: return self.maxLength >= len(val) else: return True def _check_length(self, value): """ Check the (python) value against exact length facet. @param value: the value to be checked @rtype: boolean """ if isinstance(value, rdflibLiteral): val = str(value) else: val = value if self.length is not None: return self.length == len(val) else: return True def _check_pattern(self, value): """ Check the (python) value against array of regular expressions. @param value: the value to be checked @rtype: boolean """ if isinstance(value, rdflibLiteral): val = str(value) else: val = value for p in self.pattern: if p.match(val) is None: return False return True def _check_lang_range(self, value): """ Check the (python) value against array of language ranges. @param value: the value to be checked @rtype: boolean """ if isinstance(value, rdflibLiteral): lang = value.language else: return False for r in self.langRange: if not _lang_range_check(r, lang): return False return True OWL-RL-7.1.4/owlrl/XsdDatatypes.py000077500000000000000000000075041504201166100166320ustar00rootroot00000000000000# -*- coding: utf-8 -*- # """ Lists of XSD datatypes and their mutual relationships **Requires**: `RDFLib`_, 4.0.0 and higher. .. _RDFLib: https://github.com/RDFLib/rdflib **License**: This software is available for use under the `W3C Software License`_. .. _W3C Software License: http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 **Organization**: `World Wide Web Consortium`_ .. _World Wide Web Consortium: http://www.w3.org **Author**: `Ivan Herman`_ .. _Ivan Herman: http://www.w3.org/People/Ivan/ """ __author__ = "Ivan Herman" __contact__ = "Ivan Herman, ivan@w3.org" __license__ = "W3C® SOFTWARE NOTICE AND LICENSE, http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231" from rdflib.namespace import RDF, RDFS, XSD # The basic XSD types used everywhere; this means not the complete set of day/month types _Common_XSD_Datatypes = [ XSD.integer, XSD.decimal, XSD.nonNegativeInteger, XSD.nonPositiveInteger, XSD.negativeInteger, XSD.positiveInteger, XSD.long, XSD.int, XSD.short, XSD.byte, XSD.unsignedLong, XSD.unsignedInt, XSD.unsignedShort, XSD.unsignedByte, XSD.float, XSD.double, XSD.string, XSD.normalizedString, XSD.token, XSD.language, XSD.Name, XSD.NCName, XSD.NMTOKEN, XSD.boolean, XSD.hexBinary, XSD.base64Binary, XSD.anyURI, XSD.dateTimeStamp, XSD.dateTime, XSD.time, XSD.date, RDFS.Literal, RDF.XMLLiteral, RDF.HTML, RDF.langString, ] # RDFS Datatypes: the basic ones plus the complete set of day/month ones RDFS_Datatypes = _Common_XSD_Datatypes + [ XSD.gYearMonth, XSD.gMonthDay, XSD.gYear, XSD.gDay, XSD.gMonth, ] # OWL RL Datatypes: the basic ones plus plain literal OWL_RL_Datatypes = _Common_XSD_Datatypes + [RDF.PlainLiteral] # XSD Datatype subsumptions _Common_Datatype_Subsumptions = { XSD.dateTimeStamp: [XSD.dateTime], XSD.integer: [XSD.decimal], XSD.long: [XSD.integer, XSD.decimal], XSD.int: [XSD.long, XSD.integer, XSD.decimal], XSD.short: [ XSD.int, XSD.long, XSD.integer, XSD.decimal, ], XSD.byte: [ XSD.short, XSD.int, XSD.long, XSD.integer, XSD.decimal, ], XSD.nonNegativeInteger: [XSD.integer, XSD.decimal], XSD.positiveInteger: [ XSD.nonNegativeInteger, XSD.integer, XSD.decimal, ], XSD.unsignedLong: [ XSD.nonNegativeInteger, XSD.integer, XSD.decimal, ], XSD.unsignedInt: [ XSD.unsignedLong, XSD.nonNegativeInteger, XSD.integer, XSD.decimal, ], XSD.unsignedShort: [ XSD.unsignedInt, XSD.unsignedLong, XSD.nonNegativeInteger, XSD.integer, XSD.decimal, ], XSD.unsignedByte: [ XSD.unsignedShort, XSD.unsignedInt, XSD.unsignedLong, XSD.nonNegativeInteger, XSD.integer, XSD.decimal, ], XSD.nonPositiveInteger: [XSD.integer, XSD.decimal], XSD.negativeInteger: [ XSD.nonPositiveInteger, XSD.integer, XSD.decimal, ], XSD.normalizedString: [XSD.string], XSD.token: [XSD.normalizedString, XSD.string], XSD.language: [XSD.token, XSD.normalizedString, XSD.string], XSD.Name: [XSD.token, XSD.normalizedString, XSD.string], XSD.NCName: [ XSD.Name, XSD.token, XSD.normalizedString, XSD.string, ], XSD.NMTOKEN: [ XSD.Name, XSD.token, XSD.normalizedString, XSD.string, ], } # RDFS Datatype subsumptions: at the moment, there is no extra to XSD RDFS_Datatype_Subsumptions = _Common_Datatype_Subsumptions # OWL Datatype subsumptions: at the moment, there is no extra to XSD OWL_Datatype_Subsumptions = _Common_Datatype_Subsumptions OWL-RL-7.1.4/owlrl/__init__.py000077500000000000000000000641251504201166100157560ustar00rootroot00000000000000# -*- coding: utf-8 -*- # """ This module is a brute force implementation of the 'finite' version of `RDFS semantics`_ and of `OWL 2 RL`_ on the top of RDFLib (with some caveats, see below). Some extensions to these are also implemented. .. _RDFS semantics: http://www.w3.org/TR/rdf-mt/ .. _OWL 2 RL: http://www.w3.org/TR/owl2-profiles/#Reasoning_in_OWL_2_RL_and_RDF_Graphs_using_Rules Brute force means that, in all cases, simple forward chaining rules are used to extend (recursively) the incoming graph with all triples that the rule sets permit (ie, the "deductive closure" of the graph is computed). There is an extra options whether the axiomatic triples are added to the graph (prior to the forward chaining step). These, typically set the domain and range for properties or define some core classes. In the case of RDFS, the implementation uses a 'finite' version of the axiomatic triples only (as proposed, for example, by Herman ter Horst). This means that it adds only those :code:`rdf:_i` type predicates that do appear in the original graph, thereby keeping this step finite. For OWL 2 RL, OWL 2 does not define axiomatic triples formally; but they can be deduced from the `OWL 2 RDF Based Semantics`_ document and are listed in Appendix 6 (though informally). .. _OWL 2 RDF Based Semantics: http://www.w3.org/TR/owl2-rdf-based-semantics/ .. note:: This implementation adds only those triples that refer to OWL terms that are meaningful for the OWL 2 RL case. Package Entry Points ==================== The main entry point to the package is via the :class:`.DeductiveClosure` class. This class should be initialized to control the parameters of the deductive closure; the forward chaining is done via the L{expand} method. The simplest way to use the package from an RDFLib application is as follows:: graph = Graph() # creation of an RDFLib graph ... ... # normal RDFLib application, eg, parsing RDF data ... DeductiveClosure(OWLRL_Semantics).expand(graph) # calculate an OWL 2 RL deductive closure of graph # without axiomatic triples The first argument of the :class:`.DeductiveClosure` initialization can be replaced by other classes, providing different types of deductive closure; other arguments are also possible. For example:: DeductiveClosure(OWLRL_Extension, rdfs_closure = True, axiomatic_triples = True, datatype_axioms = True).expand(graph) This will calculate the deductive closure including RDFS and some extensions to OWL 2 RL, and with all possible axiomatic triples added to the graph (this is about the maximum the package can do…) The same instance of :class:`.DeductiveClosure` can be used for several graph expansions. In other words, the expand function does not change any state. For convenience, a second entry point to the package is provided in the form of a function called :func:`owlrl.convert_graph`, that expects a directory with various options, including a file name. The function parses the file, creates the expanded graph, and serializes the result into RDF/XML or Turtle. This function is particularly useful as an entry point for a CGI call (where the HTML form parameters are in a directory) and is easy to use with a command line interface. The package distribution contains an example for both. There are major closure type (ie, semantic closure possibilities); these can be controlled through the appropriate parameters of the :class:`.DeductiveClosure` class: * using the :class:`.RDFS_Semantics` class, implementing the `RDFS semantics`_. .. _RDFS semantics: http://www.w3.org/TR/rdf-mt/ * using the :class:`.OWLRL.OWLRL_Semantics` class, implementing the `OWL 2 RL`_. .. _OWL 2 RL: http://www.w3.org/TR/owl2-profiles/#Reasoning_in_OWL_2_RL_and_RDF_Graphs_using_Rules * using :class:`.CombinedClosure.RDFS_OWLRL_Semantics` class, implementing a combined semantics of `RDFS semantics`_ and `OWL 2 RL`_. .. _RDFS semantics: http://www.w3.org/TR/rdf-mt/ .. _OWL 2 RL: http://www.w3.org/TR/owl2-profiles/#Reasoning_in_OWL_2_RL_and_RDF_Graphs_using_Rules In all three cases there are other dimensions that can control the exact closure being generated: * for convenience, the so called axiomatic triples (see, eg, the `axiomatic triples in RDFS`_ are, by default, I{not} added to the graph closure to reduce the number of generated triples. These can be controlled through a separate initialization argument. .. _axiomatic triples in RDFS: http://www.w3.org/TR/rdf-mt/#rdfs_interp * similarly, the axiomatic triples for D-entailment are separated. Some Technical/implementation aspects ===================================== The core processing is done in the in the :class:`.Closure.Core` class, which is subclassed by the :class:`.RDFSClosure.RDFS_Semantics` and the :class:`.OWLRL.OWLRL_Semantics` classes (these two are then, on their turn, subclassed by the :class:`.CombinedClosure.RDFS_OWLRL_Semantics` class). The core implements the core functionality of cycling through the rules, whereas the rules themselves are defined and implemented in the subclasses. There are also methods that are executed only once either at the beginning or at the end of the full processing cycle. Adding axiomatic triples is handled separately, which allows a finer user control over these features. The OWL specification includes references to datatypes that are not in the core RDFS specification, consequently not directly implemented by RDFLib. These are added in a separate module of the package. Problems with Literals with datatypes ------------------------------------- The current distribution of RDFLib is fairly poor in handling datatypes, particularly in checking whether a lexical form of a literal is "proper" as for its declared datatype. A typical example is :: "-1234"^^xsd:nonNegativeInteger which should not be accepted as valid literal. Because the requirements of OWL 2 RL are much stricter in this respect, an alternative set of datatype handling (essentially, conversions) had to be implemented (see the :py:mod:`.XsdDatatypes` module). The :class:`.DeductiveClosure` class has an additional instance variable whether the default RDFLib conversion routines should be exchanged against the new ones. If this flag is set to True and instance creation (this is the default), then the conversion routines are set back to the originals once the expansion is complete, thereby avoiding to influence older application that may not work properly with the new set of conversion routines. If the user wants to use these alternative lexical conversions everywhere in the application, then the :py:meth:`.DeductiveClosure.use_improved_datatypes_conversions` method can be invoked. That method changes the conversion routines and, from that point on, all usage of :class:`.DeductiveClosure` instances will use the improved conversion methods without resetting them. Ie, the code structure can be something like:: DeductiveClosure().use_improved_datatypes_conversions() ... RDFLib application DeductiveClosure().expand(graph) ... The default situation can be set back using the :py:meth:`.DeductiveClosure.use_rdflib_datatypes_conversions` call. It is, however, not *required* to use these methods at all. I.e., the user can use:: DeductiveClosure(improved_datatypes=False).expand(graph) which will result in a proper graph expansion except for the datatype specific comparisons which will be incomplete. **Requires**: * `RDFLib`_, 4.0.0 and higher. .. _RDFLib: https://github.com/RDFLib/rdflib * `rdflib_jsonld`_ .. _rdflib_jsonld: https://github.com/RDFLib/rdflib-jsonld **License**: This software is available for use under the `W3C Software License`_ .. _W3C Software License: http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 **Organization**: `World Wide Web Consortium`_ .. _World Wide Web Consortium: http://www.w3.org **Author**: `Ivan Herman`_ .. _Ivan Herman: http://www.w3.org/People/Ivan/ """ # Examples: LangString is disjoint from String __version__ = "7.1.4" __author__ = "Ivan Herman" __contact__ = "Ivan Herman, ivan@w3.org" __license__ = "W3C® SOFTWARE NOTICE AND LICENSE, http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231" from typing import Union # noinspection PyPackageRequirements,PyPackageRequirements,PyPackageRequirements import rdflib from rdflib import Graph, Literal from . import DatatypeHandling, Closure from .OWLRLExtras import OWLRL_Extension, OWLRL_Extension_Trimming from .OWLRL import OWLRL_Semantics from .RDFSClosure import RDFS_Semantics from .CombinedClosure import RDFS_OWLRL_Semantics from rdflib.namespace import OWL RDFXML = "xml" TURTLE = "turtle" JSON = "json" AUTO = "auto" RDFA = "rdfa" # noinspection PyShadowingBuiltins def __parse_input(iformat, inp, graph): """Parse the input into the graph, possibly checking the suffix for the format. @param iformat: input format; can be one of L{AUTO}, L{TURTLE}, or L{RDFXML}. L{AUTO} means that the suffix of the file name or URI will decide: '.ttl' means Turtle, RDF/XML otherwise. @param inp: input file; anything that RDFLib accepts in that position (URI, file name, file object). If '-', standard input is used. @param graph: the RDFLib Graph instance to parse into. """ if iformat == AUTO: if inp == "-": format = "turtle" else: if inp.endswith(".ttl") or inp.endswith(".n3"): format = "turtle" elif inp.endswith(".json") or inp.endswith(".jsonld"): format = "json-ld" elif inp.endswith(".html"): format = "rdfa1.1" else: format = "xml" elif iformat == TURTLE: format = "turtle" elif iformat == RDFA: format = "rdfa1.1" elif iformat == RDFXML: format = "xml" elif iformat == JSON: format = "json-ld" else: raise Exception("Unknown input syntax") if inp == "-": # standard input is used import sys source = sys.stdin else: source = inp graph.parse(source, format=format) def interpret_owl_imports(iformat, graph): """ Interpret the owl import statements. Essentially, recursively merge with all the objects in the owl import statement, and remove the corresponding triples from the graph. This method can be used by an application prior to expansion. It is *not* done by the :class:`.DeductiveClosure` class. :param iformat: Input format; can be one of :code:`AUTO`, :code:`TURTLE`, or :code:`RDFXML`. :code:`AUTO` means that the suffix of the file name or URI will decide: '.ttl' means Turtle, RDF/XML otherwise. :type iformat: str :param graph: The RDFLib Graph instance to parse into. :type graph: :class:`rdflib.graph.Graph` """ while True: # 1. collect the import statements: all_imports = [t for t in graph.triples((None, OWL.imports, None))] if len(all_imports) == 0: # no import statement whatsoever, we can go on... return # 2. remove all the import statements from the graph for t in all_imports: graph.remove(t) # 3. get all the imported vocabularies and import them for (s, p, uri) in all_imports: # this is not 100% kosher. The expected object for an import statement is a URI. However, # on local usage, a string would also make sense, so I do that one, too if isinstance(uri, Literal): __parse_input(iformat, str(uri), graph) else: __parse_input(iformat, uri, graph) # 4. start all over again to see if import statements have been imported def return_closure_class(owl_closure, rdfs_closure, owl_extras, trimming=False): """ Return the right semantic extension class based on three possible choices (this method is here to help potential users, the result can be fed into a :class:`DeductiveClosure` instance at initialization). :param owl_closure: Whether OWL 2 RL deductive closure should be calculated. :type owl_closure: bool :param rdfs_closure: Whether RDFS deductive closure should be calculated. In case :code:`owl_closure==True`, this parameter should also be used in the initialization of :class:`DeductiveClosure`. :type rdfs_closure: bool :param owl_extras: Whether the extra possibilities (rational datatype, etc) should be added to an OWL 2 RL deductive closure. This parameter has no effect in case :code:`owl_closure==False`. :type owl_extras: bool :param trimming: Whether extra trimming is done on the OWL RL + Extension output. :type trimming: bool :return: Deductive class reference or None. :rtype: :class:`.DeductiveClosure` or None """ if owl_closure: if owl_extras: if trimming: return OWLRL_Extension_Trimming else: return OWLRL_Extension else: if rdfs_closure: return RDFS_OWLRL_Semantics else: return OWLRL_Semantics elif rdfs_closure: return RDFS_Semantics else: return None # noinspection PyCallingNonCallable class DeductiveClosure: """ Entry point to generate the deductive closure of a graph. The exact choice deductive closure is controlled by a class reference. The important initialization parameter is the :code:`closure_class`, a Class object referring to a subclass of :class:`.Closure.Core`. Although this package includes a number of such subclasses :class:`.OWLRL_Semantics`, :class:`.RDFS_Semantics`, :class:`.RDFS_OWLRL_Semantics`, and :class:`.OWLRL_Extension`, the user can use his/her own if additional rules are implemented. Note that :code:`owl:imports` statements are *not* interpreted in this class, that has to be done beforehand on the graph that is to be expanded. :param closure_class: A closure class reference. :type closure_class: subclass of :class:`.Closure.Core` :param improved_datatypes: Whether the improved set of lexical-to-Python conversions should be used for datatype handling. See the introduction for more details. Default: True. :type improved_datatypes: bool :param rdfs_closure: Whether the RDFS closure should also be executed. Default: False. :type rdfs_closure: bool :param axiomatic_triples: Whether relevant axiomatic triples are added before chaining, except for datatype axiomatic triples. Default: False. :type axiomatic_triples: bool :param datatype_axioms: Whether further datatype axiomatic triples are added to the output. Default: false. :type datatype_axioms: bool :var improved_datatype_generic: Whether the improved set of lexical-to-Python conversions should be used for datatype handling *in general*, I.e., not only for a particular instance and not only for inference purposes. Default: False. :type improved_datatype_generic: bool """ # This is the original set of param definitions in the class definition # # @ivar rdfs_closure: Whether the RDFS closure should also be executed. Default: False. # @type rdfs_closure: boolean # @ivar axiomatic_triples: Whether relevant axiomatic triples are added before chaining, except for datatype axiomatic # triples. Default: False. # @type axiomatic_triples: boolean # @ivar datatype_axioms: Whether further datatype axiomatic triples are added to the output. Default: false. # @type datatype_axioms: boolean # @ivar closure_class: the class instance used to expand the graph # @type closure_class: L{Closure.Core} # @cvar improved_datatype_generic: Whether the improved set of lexical-to-Python conversions should be used for # datatype handling I{in general}, ie, not only for a particular instance and not only for inference purposes. # Default: False. # @type improved_datatype_generic: boolean improved_datatype_generic = False def __init__( self, closure_class, improved_datatypes=True, rdfs_closure=False, axiomatic_triples=False, datatype_axioms=False, ): # This is the original set of param definitions in the __init__ # # @param closure_class: a closure class reference. # @type closure_class: subclass of L{Closure.Core} # @param rdfs_closure: whether RDFS rules are executed or not # @type rdfs_closure: boolean # @param axiomatic_triples: Whether relevant axiomatic triples are added before chaining, except for datatype # axiomatic triples. Default: False. # @type axiomatic_triples: boolean # @param datatype_axioms: Whether further datatype axiomatic triples are added to the output. Default: false. # @type datatype_axioms: boolean # @param improved_datatypes: Whether the improved set of lexical-to-Python conversions should be used for # datatype handling. See the introduction for more details. Default: True. # @type improved_datatypes: boolean if closure_class is None: self.closure_class = None else: if not isinstance(closure_class, type): raise ValueError("The closure type argument must be a class reference") else: self.closure_class = closure_class self.axiomatic_triples = axiomatic_triples self.datatype_axioms = datatype_axioms self.rdfs_closure = rdfs_closure self.improved_datatypes = improved_datatypes def expand(self, graph: Graph, destination: Union[None, Graph] = None): """ Expand the graph using forward chaining, and with the relevant closure type. :param graph: The RDF graph. :type graph: :class:`rdflib.Graph` :param destination: The RDF graph to which the results are written. If not specified, the graph is modified in-place. :type destination: :class:`rdflib.Graph` """ if (not DeductiveClosure.improved_datatype_generic) and self.improved_datatypes: DatatypeHandling.use_Alt_lexical_conversions() if self.closure_class is not None: self.closure_class( graph, self.axiomatic_triples, self.datatype_axioms, rdfs=self.rdfs_closure, destination=destination ).closure() if (not DeductiveClosure.improved_datatype_generic) and self.improved_datatypes: DatatypeHandling.use_RDFLib_lexical_conversions() @staticmethod def use_improved_datatypes_conversions(): """ Switch the system to use the improved datatype conversion routines. """ DeductiveClosure.improved_datatype_generic = True DatatypeHandling.use_Alt_lexical_conversions() @staticmethod def use_rdflib_datatypes_conversions(): """ Switch the system to use the generic (RDFLib) datatype conversion routines """ DeductiveClosure.improved_datatype_generic = False DatatypeHandling.use_RDFLib_lexical_conversions() ############################################################################################################### # noinspection PyPep8Naming,PyBroadException,PyBroadException,PyBroadException def convert_graph(options, closureClass=None): """ Entry point for external scripts (CGI or command line) to parse an RDF file(s), possibly execute OWL and/or RDFS closures, and serialize back the result in some format. Note that this entry point can be used requiring no entailment at all; because both the input and the output format for the package can be RDF/XML or Turtle, such usage would simply mean a format conversion. If OWL 2 RL processing is required, that also means that the :code:`owl:imports` statements are interpreted. I.e., ontologies can be spread over several files. Note, however, that the output of the process would then include all imported ontologies, too. :param options: Object with specific attributes. :type options: object :param options.sources: List of uris or file names for the source data; for each one if the name ends with 'ttl', it is considered to be turtle, RDF/XML otherwise (this can be overwritten by the options.iformat, though) :type options.sources: list :param options.text: Direct Turtle encoding of a graph as a text string (useful, eg, for a CGI call using a text field). :type options.text: str :param options.owlClosure: Can be yes or no. :type options.owlClosure: bool :param options.rdfsClosure: Can be yes or no. :type options.rdfsClosure: bool :param options.owlExtras: Can be yes or no; whether the extra rules beyond OWL 2 RL are used or not. :type options.owlExtras: bool :param options.axioms: Whether relevant axiomatic triples are added before chaining (can be a boolean, or the strings "yes" or "no"). :type options.axioms: bool :param options.daxioms: Further datatype axiomatic triples are added to the output (can be a boolean, or the strings "yes" or "no"). :type options.daxioms: bool :param options.format: Output format, can be "turtle" or "rdfxml". :type options.format: str :param options.iformat: Input format, can be "turtle", "rdfa", "json", "rdfxml", or "auto". "auto" means that the suffix of the file is considered: '.ttl'. '.html', 'json' or '.jsonld' respectively with 'xml' as a fallback. :type options.iformat: str :param options.trimming: Whether the extension to OWLRL should also include trimming. :type options.trimming: bool :param closureClass: Explicit class reference. If set, this overrides the various different other options to be used as an extension. :type closureClass: TODO(edmond.chuc@csiro.au): What class is this supposed to be? """ # Original parameter definitions from old documentation. # # @param options: object with specific attributes, namely: # - options.sources: list of uris or file names for the source data; for each one if the name ends with 'ttl', it is # considered to be turtle, RDF/XML otherwise (this can be overwritten by the options.iformat, though) # - options.text: direct Turtle encoding of a graph as a text string (useful, eg, for a CGI call using a text field) # - options.owlClosure: can be yes or no # - options.rdfsClosure: can be yes or no # - options.owlExtras: can be yes or no; whether the extra rules beyond OWL 2 RL are used or not. # - options.axioms: whether relevant axiomatic triples are added before chaining (can be a boolean, or the strings # "yes" or "no") # - options.daxioms: further datatype axiomatic triples are added to the output (can be a boolean, or the strings # "yes" or "no") # - options.format: output format, can be "turtle" or "rdfxml" # - options.iformat: input format, can be "turtle", "rdfa", "json", "rdfxml", or "auto". "auto" means that the # suffix of the file is considered: '.ttl'. '.html', 'json' or '.jsonld' respectively with 'xml' as a fallback # - options.trimming: whether the extension to OWLRL should also include trimming # @param closureClass: explicit class reference. If set, this overrides the various different other options to be # used as an extension. def __check_yes_or_true(opt): return ( opt is True or opt == "yes" or opt == "Yes" or opt == "True" or opt == "true" ) import warnings warnings.filterwarnings("ignore") if len(options.sources) == 0 and ( options.text is None or len(options.text.strip()) == 0 ): raise Exception("No graph specified either via a URI or text") graph = Graph() # Just to be sure that this attribute does not create issues with older versions of the service... # the try statement should be removed, eventually... iformat = "auto" try: iformat = options.iformat except: # exception can be raised if that attribute is not used at all, true for older versions pass # similar measure with the possible usage of the 'source' options try: if options.source is not None: options.sources.append(options.source) except: # exception can be raised if that attribute is not used at all, true for newer versions pass # Get the sources first. Note that a possible error is filtered out, namely to process the same file twice. This is # done by turning the input arguments into a set... for inp in set(options.sources): __parse_input(iformat, inp, graph) # add the possible extra text (ie, the text input on the HTML page) if options.text is not None: graph.parse(data=options.text, format="n3") # Get all the options right # noinspection PyPep8Naming owlClosure = __check_yes_or_true(options.owlClosure) # noinspection PyPep8Naming rdfsClosure = __check_yes_or_true(options.rdfsClosure) # noinspection PyPep8Naming owlExtras = __check_yes_or_true(options.owlExtras) try: trimming = __check_yes_or_true(options.trimming) except: trimming = False axioms = __check_yes_or_true(options.axioms) daxioms = __check_yes_or_true(options.daxioms) if owlClosure: interpret_owl_imports(iformat, graph) # @@@@ some smarter choice should be used later to decide what the closure class is!!! That should # also control the import management. Eg, if the superclass includes OWL... if closureClass is not None: closure_class = closureClass else: closure_class = return_closure_class( owlClosure, rdfsClosure, owlExtras, trimming ) DeductiveClosure( closure_class, improved_datatypes=True, rdfs_closure=rdfsClosure, axiomatic_triples=axioms, datatype_axioms=daxioms, ).expand(graph) if options.format == "rdfxml": return graph.serialize(format="pretty-xml") elif options.format == "json": return graph.serialize(format="json-ld") else: return graph.serialize(format="turtle") OWL-RL-7.1.4/poetry.lock000066400000000000000000001530561504201166100147010ustar00rootroot00000000000000# This file is automatically @generated by Poetry 2.0.1 and should not be changed by hand. [[package]] name = "alabaster" version = "0.7.13" description = "A configurable sidebar-enabled Sphinx theme" optional = false python-versions = ">=3.6" groups = ["dev"] files = [ {file = "alabaster-0.7.13-py3-none-any.whl", hash = "sha256:1ee19aca801bbabb5ba3f5f258e4422dfa86f82f3e9cefb0859b283cdd7f62a3"}, {file = "alabaster-0.7.13.tar.gz", hash = "sha256:a27a4a084d5e690e16e01e03ad2b2e552c61a65469419b907243193de1a84ae2"}, ] [[package]] name = "babel" version = "2.17.0" description = "Internationalization utilities" optional = false python-versions = ">=3.8" groups = ["dev"] files = [ {file = "babel-2.17.0-py3-none-any.whl", hash = "sha256:4d0b53093fdfb4b21c92b5213dba5a1b23885afa8383709427046b21c366e5f2"}, {file = "babel-2.17.0.tar.gz", hash = "sha256:0c54cffb19f690cdcc52a3b50bcbf71e07a808d1c80d549f2459b9d2cf0afb9d"}, ] [package.extras] dev = ["backports.zoneinfo", "freezegun (>=1.0,<2.0)", "jinja2 (>=3.0)", "pytest (>=6.0)", "pytest-cov", "pytz", "setuptools", "tzdata"] [[package]] name = "black" version = "24.4.2" description = "The uncompromising code formatter." optional = false python-versions = ">=3.8" groups = ["dev"] files = [ {file = "black-24.4.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:dd1b5a14e417189db4c7b64a6540f31730713d173f0b63e55fabd52d61d8fdce"}, {file = "black-24.4.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:8e537d281831ad0e71007dcdcbe50a71470b978c453fa41ce77186bbe0ed6021"}, {file = "black-24.4.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:eaea3008c281f1038edb473c1aa8ed8143a5535ff18f978a318f10302b254063"}, {file = "black-24.4.2-cp310-cp310-win_amd64.whl", hash = "sha256:7768a0dbf16a39aa5e9a3ded568bb545c8c2727396d063bbaf847df05b08cd96"}, {file = "black-24.4.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:257d724c2c9b1660f353b36c802ccece186a30accc7742c176d29c146df6e474"}, {file = "black-24.4.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:bdde6f877a18f24844e381d45e9947a49e97933573ac9d4345399be37621e26c"}, {file = "black-24.4.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e151054aa00bad1f4e1f04919542885f89f5f7d086b8a59e5000e6c616896ffb"}, {file = "black-24.4.2-cp311-cp311-win_amd64.whl", hash = "sha256:7e122b1c4fb252fd85df3ca93578732b4749d9be076593076ef4d07a0233c3e1"}, {file = "black-24.4.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:accf49e151c8ed2c0cdc528691838afd217c50412534e876a19270fea1e28e2d"}, {file = "black-24.4.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:88c57dc656038f1ab9f92b3eb5335ee9b021412feaa46330d5eba4e51fe49b04"}, {file = "black-24.4.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:be8bef99eb46d5021bf053114442914baeb3649a89dc5f3a555c88737e5e98fc"}, {file = "black-24.4.2-cp312-cp312-win_amd64.whl", hash = "sha256:415e686e87dbbe6f4cd5ef0fbf764af7b89f9057b97c908742b6008cc554b9c0"}, {file = "black-24.4.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:bf10f7310db693bb62692609b397e8d67257c55f949abde4c67f9cc574492cc7"}, {file = "black-24.4.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:98e123f1d5cfd42f886624d84464f7756f60ff6eab89ae845210631714f6db94"}, {file = "black-24.4.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:48a85f2cb5e6799a9ef05347b476cce6c182d6c71ee36925a6c194d074336ef8"}, {file = "black-24.4.2-cp38-cp38-win_amd64.whl", hash = "sha256:b1530ae42e9d6d5b670a34db49a94115a64596bc77710b1d05e9801e62ca0a7c"}, {file = "black-24.4.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:37aae07b029fa0174d39daf02748b379399b909652a806e5708199bd93899da1"}, {file = "black-24.4.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:da33a1a5e49c4122ccdfd56cd021ff1ebc4a1ec4e2d01594fef9b6f267a9e741"}, {file = "black-24.4.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ef703f83fc32e131e9bcc0a5094cfe85599e7109f896fe8bc96cc402f3eb4b6e"}, {file = "black-24.4.2-cp39-cp39-win_amd64.whl", hash = "sha256:b9176b9832e84308818a99a561e90aa479e73c523b3f77afd07913380ae2eab7"}, {file = "black-24.4.2-py3-none-any.whl", hash = "sha256:d36ed1124bb81b32f8614555b34cc4259c3fbc7eec17870e8ff8ded335b58d8c"}, {file = "black-24.4.2.tar.gz", hash = "sha256:c872b53057f000085da66a19c55d68f6f8ddcac2642392ad3a355878406fbd4d"}, ] [package.dependencies] click = ">=8.0.0" mypy-extensions = ">=0.4.3" packaging = ">=22.0" pathspec = ">=0.9.0" platformdirs = ">=2" tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} typing-extensions = {version = ">=4.0.1", markers = "python_version < \"3.11\""} [package.extras] colorama = ["colorama (>=0.4.3)"] d = ["aiohttp (>=3.7.4)", "aiohttp (>=3.7.4,!=3.9.0)"] jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] uvloop = ["uvloop (>=0.15.2)"] [[package]] name = "certifi" version = "2025.7.14" description = "Python package for providing Mozilla's CA Bundle." optional = false python-versions = ">=3.7" groups = ["dev"] files = [ {file = "certifi-2025.7.14-py3-none-any.whl", hash = "sha256:6b31f564a415d79ee77df69d757bb49a5bb53bd9f756cbbe24394ffd6fc1f4b2"}, {file = "certifi-2025.7.14.tar.gz", hash = "sha256:8ea99dbdfaaf2ba2f9bac77b9249ef62ec5218e7c2b2e903378ed5fccf765995"}, ] [[package]] name = "charset-normalizer" version = "3.4.2" description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." optional = false python-versions = ">=3.7" groups = ["dev"] files = [ {file = "charset_normalizer-3.4.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:7c48ed483eb946e6c04ccbe02c6b4d1d48e51944b6db70f697e089c193404941"}, {file = "charset_normalizer-3.4.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b2d318c11350e10662026ad0eb71bb51c7812fc8590825304ae0bdd4ac283acd"}, {file = "charset_normalizer-3.4.2-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9cbfacf36cb0ec2897ce0ebc5d08ca44213af24265bd56eca54bee7923c48fd6"}, {file = "charset_normalizer-3.4.2-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:18dd2e350387c87dabe711b86f83c9c78af772c748904d372ade190b5c7c9d4d"}, {file = "charset_normalizer-3.4.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8075c35cd58273fee266c58c0c9b670947c19df5fb98e7b66710e04ad4e9ff86"}, {file = "charset_normalizer-3.4.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:5bf4545e3b962767e5c06fe1738f951f77d27967cb2caa64c28be7c4563e162c"}, {file = "charset_normalizer-3.4.2-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:7a6ab32f7210554a96cd9e33abe3ddd86732beeafc7a28e9955cdf22ffadbab0"}, {file = "charset_normalizer-3.4.2-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:b33de11b92e9f75a2b545d6e9b6f37e398d86c3e9e9653c4864eb7e89c5773ef"}, {file = "charset_normalizer-3.4.2-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:8755483f3c00d6c9a77f490c17e6ab0c8729e39e6390328e42521ef175380ae6"}, {file = "charset_normalizer-3.4.2-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:68a328e5f55ec37c57f19ebb1fdc56a248db2e3e9ad769919a58672958e8f366"}, {file = "charset_normalizer-3.4.2-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:21b2899062867b0e1fde9b724f8aecb1af14f2778d69aacd1a5a1853a597a5db"}, {file = "charset_normalizer-3.4.2-cp310-cp310-win32.whl", hash = "sha256:e8082b26888e2f8b36a042a58307d5b917ef2b1cacab921ad3323ef91901c71a"}, {file = "charset_normalizer-3.4.2-cp310-cp310-win_amd64.whl", hash = "sha256:f69a27e45c43520f5487f27627059b64aaf160415589230992cec34c5e18a509"}, {file = "charset_normalizer-3.4.2-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:be1e352acbe3c78727a16a455126d9ff83ea2dfdcbc83148d2982305a04714c2"}, {file = "charset_normalizer-3.4.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:aa88ca0b1932e93f2d961bf3addbb2db902198dca337d88c89e1559e066e7645"}, {file = "charset_normalizer-3.4.2-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d524ba3f1581b35c03cb42beebab4a13e6cdad7b36246bd22541fa585a56cccd"}, {file = "charset_normalizer-3.4.2-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:28a1005facc94196e1fb3e82a3d442a9d9110b8434fc1ded7a24a2983c9888d8"}, {file = "charset_normalizer-3.4.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fdb20a30fe1175ecabed17cbf7812f7b804b8a315a25f24678bcdf120a90077f"}, {file = "charset_normalizer-3.4.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0f5d9ed7f254402c9e7d35d2f5972c9bbea9040e99cd2861bd77dc68263277c7"}, {file = "charset_normalizer-3.4.2-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:efd387a49825780ff861998cd959767800d54f8308936b21025326de4b5a42b9"}, {file = "charset_normalizer-3.4.2-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:f0aa37f3c979cf2546b73e8222bbfa3dc07a641585340179d768068e3455e544"}, {file = "charset_normalizer-3.4.2-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:e70e990b2137b29dc5564715de1e12701815dacc1d056308e2b17e9095372a82"}, {file = "charset_normalizer-3.4.2-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:0c8c57f84ccfc871a48a47321cfa49ae1df56cd1d965a09abe84066f6853b9c0"}, {file = "charset_normalizer-3.4.2-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:6b66f92b17849b85cad91259efc341dce9c1af48e2173bf38a85c6329f1033e5"}, {file = "charset_normalizer-3.4.2-cp311-cp311-win32.whl", hash = "sha256:daac4765328a919a805fa5e2720f3e94767abd632ae410a9062dff5412bae65a"}, {file = "charset_normalizer-3.4.2-cp311-cp311-win_amd64.whl", hash = "sha256:e53efc7c7cee4c1e70661e2e112ca46a575f90ed9ae3fef200f2a25e954f4b28"}, {file = "charset_normalizer-3.4.2-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:0c29de6a1a95f24b9a1aa7aefd27d2487263f00dfd55a77719b530788f75cff7"}, {file = "charset_normalizer-3.4.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cddf7bd982eaa998934a91f69d182aec997c6c468898efe6679af88283b498d3"}, {file = "charset_normalizer-3.4.2-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:fcbe676a55d7445b22c10967bceaaf0ee69407fbe0ece4d032b6eb8d4565982a"}, {file = "charset_normalizer-3.4.2-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d41c4d287cfc69060fa91cae9683eacffad989f1a10811995fa309df656ec214"}, {file = "charset_normalizer-3.4.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4e594135de17ab3866138f496755f302b72157d115086d100c3f19370839dd3a"}, {file = "charset_normalizer-3.4.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:cf713fe9a71ef6fd5adf7a79670135081cd4431c2943864757f0fa3a65b1fafd"}, {file = "charset_normalizer-3.4.2-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:a370b3e078e418187da8c3674eddb9d983ec09445c99a3a263c2011993522981"}, {file = "charset_normalizer-3.4.2-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:a955b438e62efdf7e0b7b52a64dc5c3396e2634baa62471768a64bc2adb73d5c"}, {file = "charset_normalizer-3.4.2-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:7222ffd5e4de8e57e03ce2cef95a4c43c98fcb72ad86909abdfc2c17d227fc1b"}, {file = "charset_normalizer-3.4.2-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:bee093bf902e1d8fc0ac143c88902c3dfc8941f7ea1d6a8dd2bcb786d33db03d"}, {file = "charset_normalizer-3.4.2-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:dedb8adb91d11846ee08bec4c8236c8549ac721c245678282dcb06b221aab59f"}, {file = "charset_normalizer-3.4.2-cp312-cp312-win32.whl", hash = "sha256:db4c7bf0e07fc3b7d89ac2a5880a6a8062056801b83ff56d8464b70f65482b6c"}, {file = "charset_normalizer-3.4.2-cp312-cp312-win_amd64.whl", hash = "sha256:5a9979887252a82fefd3d3ed2a8e3b937a7a809f65dcb1e068b090e165bbe99e"}, {file = "charset_normalizer-3.4.2-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:926ca93accd5d36ccdabd803392ddc3e03e6d4cd1cf17deff3b989ab8e9dbcf0"}, {file = "charset_normalizer-3.4.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:eba9904b0f38a143592d9fc0e19e2df0fa2e41c3c3745554761c5f6447eedabf"}, {file = "charset_normalizer-3.4.2-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3fddb7e2c84ac87ac3a947cb4e66d143ca5863ef48e4a5ecb83bd48619e4634e"}, {file = "charset_normalizer-3.4.2-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:98f862da73774290f251b9df8d11161b6cf25b599a66baf087c1ffe340e9bfd1"}, {file = "charset_normalizer-3.4.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c9379d65defcab82d07b2a9dfbfc2e95bc8fe0ebb1b176a3190230a3ef0e07c"}, {file = "charset_normalizer-3.4.2-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e635b87f01ebc977342e2697d05b56632f5f879a4f15955dfe8cef2448b51691"}, {file = "charset_normalizer-3.4.2-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:1c95a1e2902a8b722868587c0e1184ad5c55631de5afc0eb96bc4b0d738092c0"}, {file = "charset_normalizer-3.4.2-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:ef8de666d6179b009dce7bcb2ad4c4a779f113f12caf8dc77f0162c29d20490b"}, {file = "charset_normalizer-3.4.2-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:32fc0341d72e0f73f80acb0a2c94216bd704f4f0bce10aedea38f30502b271ff"}, {file = "charset_normalizer-3.4.2-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:289200a18fa698949d2b39c671c2cc7a24d44096784e76614899a7ccf2574b7b"}, {file = "charset_normalizer-3.4.2-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:4a476b06fbcf359ad25d34a057b7219281286ae2477cc5ff5e3f70a246971148"}, {file = "charset_normalizer-3.4.2-cp313-cp313-win32.whl", hash = "sha256:aaeeb6a479c7667fbe1099af9617c83aaca22182d6cf8c53966491a0f1b7ffb7"}, {file = "charset_normalizer-3.4.2-cp313-cp313-win_amd64.whl", hash = "sha256:aa6af9e7d59f9c12b33ae4e9450619cf2488e2bbe9b44030905877f0b2324980"}, {file = "charset_normalizer-3.4.2-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1cad5f45b3146325bb38d6855642f6fd609c3f7cad4dbaf75549bf3b904d3184"}, {file = "charset_normalizer-3.4.2-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b2680962a4848b3c4f155dc2ee64505a9c57186d0d56b43123b17ca3de18f0fa"}, {file = "charset_normalizer-3.4.2-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:36b31da18b8890a76ec181c3cf44326bf2c48e36d393ca1b72b3f484113ea344"}, {file = "charset_normalizer-3.4.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f4074c5a429281bf056ddd4c5d3b740ebca4d43ffffe2ef4bf4d2d05114299da"}, {file = "charset_normalizer-3.4.2-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c9e36a97bee9b86ef9a1cf7bb96747eb7a15c2f22bdb5b516434b00f2a599f02"}, {file = "charset_normalizer-3.4.2-cp37-cp37m-musllinux_1_2_aarch64.whl", hash = "sha256:1b1bde144d98e446b056ef98e59c256e9294f6b74d7af6846bf5ffdafd687a7d"}, {file = "charset_normalizer-3.4.2-cp37-cp37m-musllinux_1_2_i686.whl", hash = "sha256:915f3849a011c1f593ab99092f3cecfcb4d65d8feb4a64cf1bf2d22074dc0ec4"}, {file = "charset_normalizer-3.4.2-cp37-cp37m-musllinux_1_2_ppc64le.whl", hash = "sha256:fb707f3e15060adf5b7ada797624a6c6e0138e2a26baa089df64c68ee98e040f"}, {file = "charset_normalizer-3.4.2-cp37-cp37m-musllinux_1_2_s390x.whl", hash = "sha256:25a23ea5c7edc53e0f29bae2c44fcb5a1aa10591aae107f2a2b2583a9c5cbc64"}, {file = "charset_normalizer-3.4.2-cp37-cp37m-musllinux_1_2_x86_64.whl", hash = "sha256:770cab594ecf99ae64c236bc9ee3439c3f46be49796e265ce0cc8bc17b10294f"}, {file = "charset_normalizer-3.4.2-cp37-cp37m-win32.whl", hash = "sha256:6a0289e4589e8bdfef02a80478f1dfcb14f0ab696b5a00e1f4b8a14a307a3c58"}, {file = "charset_normalizer-3.4.2-cp37-cp37m-win_amd64.whl", hash = "sha256:6fc1f5b51fa4cecaa18f2bd7a003f3dd039dd615cd69a2afd6d3b19aed6775f2"}, {file = "charset_normalizer-3.4.2-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:76af085e67e56c8816c3ccf256ebd136def2ed9654525348cfa744b6802b69eb"}, {file = "charset_normalizer-3.4.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e45ba65510e2647721e35323d6ef54c7974959f6081b58d4ef5d87c60c84919a"}, {file = "charset_normalizer-3.4.2-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:046595208aae0120559a67693ecc65dd75d46f7bf687f159127046628178dc45"}, {file = "charset_normalizer-3.4.2-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:75d10d37a47afee94919c4fab4c22b9bc2a8bf7d4f46f87363bcf0573f3ff4f5"}, {file = "charset_normalizer-3.4.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6333b3aa5a12c26b2a4d4e7335a28f1475e0e5e17d69d55141ee3cab736f66d1"}, {file = "charset_normalizer-3.4.2-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e8323a9b031aa0393768b87f04b4164a40037fb2a3c11ac06a03ffecd3618027"}, {file = "charset_normalizer-3.4.2-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:24498ba8ed6c2e0b56d4acbf83f2d989720a93b41d712ebd4f4979660db4417b"}, {file = "charset_normalizer-3.4.2-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:844da2b5728b5ce0e32d863af26f32b5ce61bc4273a9c720a9f3aa9df73b1455"}, {file = "charset_normalizer-3.4.2-cp38-cp38-musllinux_1_2_ppc64le.whl", hash = "sha256:65c981bdbd3f57670af8b59777cbfae75364b483fa8a9f420f08094531d54a01"}, {file = "charset_normalizer-3.4.2-cp38-cp38-musllinux_1_2_s390x.whl", hash = "sha256:3c21d4fca343c805a52c0c78edc01e3477f6dd1ad7c47653241cf2a206d4fc58"}, {file = "charset_normalizer-3.4.2-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:dc7039885fa1baf9be153a0626e337aa7ec8bf96b0128605fb0d77788ddc1681"}, {file = "charset_normalizer-3.4.2-cp38-cp38-win32.whl", hash = "sha256:8272b73e1c5603666618805fe821edba66892e2870058c94c53147602eab29c7"}, {file = "charset_normalizer-3.4.2-cp38-cp38-win_amd64.whl", hash = "sha256:70f7172939fdf8790425ba31915bfbe8335030f05b9913d7ae00a87d4395620a"}, {file = "charset_normalizer-3.4.2-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:005fa3432484527f9732ebd315da8da8001593e2cf46a3d817669f062c3d9ed4"}, {file = "charset_normalizer-3.4.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e92fca20c46e9f5e1bb485887d074918b13543b1c2a1185e69bb8d17ab6236a7"}, {file = "charset_normalizer-3.4.2-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:50bf98d5e563b83cc29471fa114366e6806bc06bc7a25fd59641e41445327836"}, {file = "charset_normalizer-3.4.2-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:721c76e84fe669be19c5791da68232ca2e05ba5185575086e384352e2c309597"}, {file = "charset_normalizer-3.4.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:82d8fd25b7f4675d0c47cf95b594d4e7b158aca33b76aa63d07186e13c0e0ab7"}, {file = "charset_normalizer-3.4.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b3daeac64d5b371dea99714f08ffc2c208522ec6b06fbc7866a450dd446f5c0f"}, {file = "charset_normalizer-3.4.2-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:dccab8d5fa1ef9bfba0590ecf4d46df048d18ffe3eec01eeb73a42e0d9e7a8ba"}, {file = "charset_normalizer-3.4.2-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:aaf27faa992bfee0264dc1f03f4c75e9fcdda66a519db6b957a3f826e285cf12"}, {file = "charset_normalizer-3.4.2-cp39-cp39-musllinux_1_2_ppc64le.whl", hash = "sha256:eb30abc20df9ab0814b5a2524f23d75dcf83cde762c161917a2b4b7b55b1e518"}, {file = "charset_normalizer-3.4.2-cp39-cp39-musllinux_1_2_s390x.whl", hash = "sha256:c72fbbe68c6f32f251bdc08b8611c7b3060612236e960ef848e0a517ddbe76c5"}, {file = "charset_normalizer-3.4.2-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:982bb1e8b4ffda883b3d0a521e23abcd6fd17418f6d2c4118d257a10199c0ce3"}, {file = "charset_normalizer-3.4.2-cp39-cp39-win32.whl", hash = "sha256:43e0933a0eff183ee85833f341ec567c0980dae57c464d8a508e1b2ceb336471"}, {file = "charset_normalizer-3.4.2-cp39-cp39-win_amd64.whl", hash = "sha256:d11b54acf878eef558599658b0ffca78138c8c3655cf4f3a4a673c437e67732e"}, {file = "charset_normalizer-3.4.2-py3-none-any.whl", hash = "sha256:7f56930ab0abd1c45cd15be65cc741c28b1c9a34876ce8c17a2fa107810c0af0"}, {file = "charset_normalizer-3.4.2.tar.gz", hash = "sha256:5baececa9ecba31eff645232d59845c07aa030f0c81ee70184a90d35099a0e63"}, ] [[package]] name = "click" version = "8.1.8" description = "Composable command line interface toolkit" optional = false python-versions = ">=3.7" groups = ["dev"] files = [ {file = "click-8.1.8-py3-none-any.whl", hash = "sha256:63c132bbbed01578a06712a2d1f497bb62d9c1c0d329b7903a866228027263b2"}, {file = "click-8.1.8.tar.gz", hash = "sha256:ed53c9d8990d83c2a27deae68e4ee337473f6330c040a31d4225c9574d16096a"}, ] [package.dependencies] colorama = {version = "*", markers = "platform_system == \"Windows\""} [[package]] name = "colorama" version = "0.4.6" description = "Cross-platform colored terminal text." optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" groups = ["dev"] markers = "platform_system == \"Windows\" or sys_platform == \"win32\"" files = [ {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, ] [[package]] name = "docutils" version = "0.20.1" description = "Docutils -- Python Documentation Utilities" optional = false python-versions = ">=3.7" groups = ["dev"] files = [ {file = "docutils-0.20.1-py3-none-any.whl", hash = "sha256:96f387a2c5562db4476f09f13bbab2192e764cac08ebbf3a34a95d9b1e4a59d6"}, {file = "docutils-0.20.1.tar.gz", hash = "sha256:f08a4e276c3a1583a86dce3e34aba3fe04d02bba2dd51ed16106244e8a923e3b"}, ] [[package]] name = "exceptiongroup" version = "1.3.0" description = "Backport of PEP 654 (exception groups)" optional = false python-versions = ">=3.7" groups = ["dev"] markers = "python_version < \"3.11\"" files = [ {file = "exceptiongroup-1.3.0-py3-none-any.whl", hash = "sha256:4d111e6e0c13d0644cad6ddaa7ed0261a0b36971f6d23e7ec9b4b9097da78a10"}, {file = "exceptiongroup-1.3.0.tar.gz", hash = "sha256:b241f5885f560bc56a59ee63ca4c6a8bfa46ae4ad651af316d4e81817bb9fd88"}, ] [package.dependencies] typing-extensions = {version = ">=4.6.0", markers = "python_version < \"3.13\""} [package.extras] test = ["pytest (>=6)"] [[package]] name = "idna" version = "3.10" description = "Internationalized Domain Names in Applications (IDNA)" optional = false python-versions = ">=3.6" groups = ["dev"] files = [ {file = "idna-3.10-py3-none-any.whl", hash = "sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3"}, {file = "idna-3.10.tar.gz", hash = "sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9"}, ] [package.extras] all = ["flake8 (>=7.1.1)", "mypy (>=1.11.2)", "pytest (>=8.3.2)", "ruff (>=0.6.2)"] [[package]] name = "imagesize" version = "1.4.1" description = "Getting image size from png/jpeg/jpeg2000/gif file" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" groups = ["dev"] files = [ {file = "imagesize-1.4.1-py2.py3-none-any.whl", hash = "sha256:0d8d18d08f840c19d0ee7ca1fd82490fdc3729b7ac93f49870406ddde8ef8d8b"}, {file = "imagesize-1.4.1.tar.gz", hash = "sha256:69150444affb9cb0d5cc5a92b3676f0b2fb7cd9ae39e947a5e11a36b4497cd4a"}, ] [[package]] name = "importlib-metadata" version = "8.5.0" description = "Read metadata from Python packages" optional = false python-versions = ">=3.8" groups = ["dev"] markers = "python_version < \"3.10\"" files = [ {file = "importlib_metadata-8.5.0-py3-none-any.whl", hash = "sha256:45e54197d28b7a7f1559e60b95e7c567032b602131fbd588f1497f47880aa68b"}, {file = "importlib_metadata-8.5.0.tar.gz", hash = "sha256:71522656f0abace1d072b9e5481a48f07c138e00f079c38c8f883823f9c26bd7"}, ] [package.dependencies] zipp = ">=3.20" [package.extras] check = ["pytest-checkdocs (>=2.4)", "pytest-ruff (>=0.2.1)"] cover = ["pytest-cov"] doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] enabler = ["pytest-enabler (>=2.2)"] perf = ["ipython"] test = ["flufl.flake8", "importlib-resources (>=1.3)", "jaraco.test (>=5.4)", "packaging", "pyfakefs", "pytest (>=6,!=8.1.*)", "pytest-perf (>=0.9.2)"] type = ["pytest-mypy"] [[package]] name = "iniconfig" version = "2.1.0" description = "brain-dead simple config-ini parsing" optional = false python-versions = ">=3.8" groups = ["dev"] files = [ {file = "iniconfig-2.1.0-py3-none-any.whl", hash = "sha256:9deba5723312380e77435581c6bf4935c94cbfab9b1ed33ef8d238ea168eb760"}, {file = "iniconfig-2.1.0.tar.gz", hash = "sha256:3abbd2e30b36733fee78f9c7f7308f2d0050e88f0087fd25c2645f63c773e1c7"}, ] [[package]] name = "isodate" version = "0.7.2" description = "An ISO 8601 date/time/duration parser and formatter" optional = false python-versions = ">=3.7" groups = ["main"] markers = "python_version < \"3.11\"" files = [ {file = "isodate-0.7.2-py3-none-any.whl", hash = "sha256:28009937d8031054830160fce6d409ed342816b543597cece116d966c6d99e15"}, {file = "isodate-0.7.2.tar.gz", hash = "sha256:4cd1aa0f43ca76f4a6c6c0292a85f40b35ec2e43e315b59f06e6d32171a953e6"}, ] [[package]] name = "jinja2" version = "3.1.6" description = "A very fast and expressive template engine." optional = false python-versions = ">=3.7" groups = ["dev"] files = [ {file = "jinja2-3.1.6-py3-none-any.whl", hash = "sha256:85ece4451f492d0c13c5dd7c13a64681a86afae63a5f347908daf103ce6d2f67"}, {file = "jinja2-3.1.6.tar.gz", hash = "sha256:0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d"}, ] [package.dependencies] MarkupSafe = ">=2.0" [package.extras] i18n = ["Babel (>=2.7)"] [[package]] name = "markupsafe" version = "2.1.5" description = "Safely add untrusted strings to HTML/XML markup." optional = false python-versions = ">=3.7" groups = ["dev"] files = [ {file = "MarkupSafe-2.1.5-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:a17a92de5231666cfbe003f0e4b9b3a7ae3afb1ec2845aadc2bacc93ff85febc"}, {file = "MarkupSafe-2.1.5-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:72b6be590cc35924b02c78ef34b467da4ba07e4e0f0454a2c5907f473fc50ce5"}, {file = "MarkupSafe-2.1.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e61659ba32cf2cf1481e575d0462554625196a1f2fc06a1c777d3f48e8865d46"}, {file = "MarkupSafe-2.1.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2174c595a0d73a3080ca3257b40096db99799265e1c27cc5a610743acd86d62f"}, {file = "MarkupSafe-2.1.5-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ae2ad8ae6ebee9d2d94b17fb62763125f3f374c25618198f40cbb8b525411900"}, {file = "MarkupSafe-2.1.5-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:075202fa5b72c86ad32dc7d0b56024ebdbcf2048c0ba09f1cde31bfdd57bcfff"}, {file = "MarkupSafe-2.1.5-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:598e3276b64aff0e7b3451b72e94fa3c238d452e7ddcd893c3ab324717456bad"}, {file = "MarkupSafe-2.1.5-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:fce659a462a1be54d2ffcacea5e3ba2d74daa74f30f5f143fe0c58636e355fdd"}, {file = "MarkupSafe-2.1.5-cp310-cp310-win32.whl", hash = "sha256:d9fad5155d72433c921b782e58892377c44bd6252b5af2f67f16b194987338a4"}, {file = "MarkupSafe-2.1.5-cp310-cp310-win_amd64.whl", hash = "sha256:bf50cd79a75d181c9181df03572cdce0fbb75cc353bc350712073108cba98de5"}, {file = "MarkupSafe-2.1.5-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:629ddd2ca402ae6dbedfceeba9c46d5f7b2a61d9749597d4307f943ef198fc1f"}, {file = "MarkupSafe-2.1.5-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:5b7b716f97b52c5a14bffdf688f971b2d5ef4029127f1ad7a513973cfd818df2"}, {file = "MarkupSafe-2.1.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6ec585f69cec0aa07d945b20805be741395e28ac1627333b1c5b0105962ffced"}, {file = "MarkupSafe-2.1.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b91c037585eba9095565a3556f611e3cbfaa42ca1e865f7b8015fe5c7336d5a5"}, {file = "MarkupSafe-2.1.5-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7502934a33b54030eaf1194c21c692a534196063db72176b0c4028e140f8f32c"}, {file = "MarkupSafe-2.1.5-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:0e397ac966fdf721b2c528cf028494e86172b4feba51d65f81ffd65c63798f3f"}, {file = "MarkupSafe-2.1.5-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:c061bb86a71b42465156a3ee7bd58c8c2ceacdbeb95d05a99893e08b8467359a"}, {file = "MarkupSafe-2.1.5-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:3a57fdd7ce31c7ff06cdfbf31dafa96cc533c21e443d57f5b1ecc6cdc668ec7f"}, {file = "MarkupSafe-2.1.5-cp311-cp311-win32.whl", hash = "sha256:397081c1a0bfb5124355710fe79478cdbeb39626492b15d399526ae53422b906"}, {file = "MarkupSafe-2.1.5-cp311-cp311-win_amd64.whl", hash = "sha256:2b7c57a4dfc4f16f7142221afe5ba4e093e09e728ca65c51f5620c9aaeb9a617"}, {file = "MarkupSafe-2.1.5-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:8dec4936e9c3100156f8a2dc89c4b88d5c435175ff03413b443469c7c8c5f4d1"}, {file = "MarkupSafe-2.1.5-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:3c6b973f22eb18a789b1460b4b91bf04ae3f0c4234a0a6aa6b0a92f6f7b951d4"}, {file = "MarkupSafe-2.1.5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ac07bad82163452a6884fe8fa0963fb98c2346ba78d779ec06bd7a6262132aee"}, {file = "MarkupSafe-2.1.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f5dfb42c4604dddc8e4305050aa6deb084540643ed5804d7455b5df8fe16f5e5"}, {file = "MarkupSafe-2.1.5-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ea3d8a3d18833cf4304cd2fc9cbb1efe188ca9b5efef2bdac7adc20594a0e46b"}, {file = "MarkupSafe-2.1.5-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:d050b3361367a06d752db6ead6e7edeb0009be66bc3bae0ee9d97fb326badc2a"}, {file = "MarkupSafe-2.1.5-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:bec0a414d016ac1a18862a519e54b2fd0fc8bbfd6890376898a6c0891dd82e9f"}, {file = "MarkupSafe-2.1.5-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:58c98fee265677f63a4385256a6d7683ab1832f3ddd1e66fe948d5880c21a169"}, {file = "MarkupSafe-2.1.5-cp312-cp312-win32.whl", hash = "sha256:8590b4ae07a35970728874632fed7bd57b26b0102df2d2b233b6d9d82f6c62ad"}, {file = "MarkupSafe-2.1.5-cp312-cp312-win_amd64.whl", hash = "sha256:823b65d8706e32ad2df51ed89496147a42a2a6e01c13cfb6ffb8b1e92bc910bb"}, {file = "MarkupSafe-2.1.5-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:c8b29db45f8fe46ad280a7294f5c3ec36dbac9491f2d1c17345be8e69cc5928f"}, {file = "MarkupSafe-2.1.5-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ec6a563cff360b50eed26f13adc43e61bc0c04d94b8be985e6fb24b81f6dcfdf"}, {file = "MarkupSafe-2.1.5-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a549b9c31bec33820e885335b451286e2969a2d9e24879f83fe904a5ce59d70a"}, {file = "MarkupSafe-2.1.5-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4f11aa001c540f62c6166c7726f71f7573b52c68c31f014c25cc7901deea0b52"}, {file = "MarkupSafe-2.1.5-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:7b2e5a267c855eea6b4283940daa6e88a285f5f2a67f2220203786dfa59b37e9"}, {file = "MarkupSafe-2.1.5-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:2d2d793e36e230fd32babe143b04cec8a8b3eb8a3122d2aceb4a371e6b09b8df"}, {file = "MarkupSafe-2.1.5-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:ce409136744f6521e39fd8e2a24c53fa18ad67aa5bc7c2cf83645cce5b5c4e50"}, {file = "MarkupSafe-2.1.5-cp37-cp37m-win32.whl", hash = "sha256:4096e9de5c6fdf43fb4f04c26fb114f61ef0bf2e5604b6ee3019d51b69e8c371"}, {file = "MarkupSafe-2.1.5-cp37-cp37m-win_amd64.whl", hash = "sha256:4275d846e41ecefa46e2015117a9f491e57a71ddd59bbead77e904dc02b1bed2"}, {file = "MarkupSafe-2.1.5-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:656f7526c69fac7f600bd1f400991cc282b417d17539a1b228617081106feb4a"}, {file = "MarkupSafe-2.1.5-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:97cafb1f3cbcd3fd2b6fbfb99ae11cdb14deea0736fc2b0952ee177f2b813a46"}, {file = "MarkupSafe-2.1.5-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1f3fbcb7ef1f16e48246f704ab79d79da8a46891e2da03f8783a5b6fa41a9532"}, {file = "MarkupSafe-2.1.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fa9db3f79de01457b03d4f01b34cf91bc0048eb2c3846ff26f66687c2f6d16ab"}, {file = "MarkupSafe-2.1.5-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ffee1f21e5ef0d712f9033568f8344d5da8cc2869dbd08d87c84656e6a2d2f68"}, {file = "MarkupSafe-2.1.5-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:5dedb4db619ba5a2787a94d877bc8ffc0566f92a01c0ef214865e54ecc9ee5e0"}, {file = "MarkupSafe-2.1.5-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:30b600cf0a7ac9234b2638fbc0fb6158ba5bdcdf46aeb631ead21248b9affbc4"}, {file = "MarkupSafe-2.1.5-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:8dd717634f5a044f860435c1d8c16a270ddf0ef8588d4887037c5028b859b0c3"}, {file = "MarkupSafe-2.1.5-cp38-cp38-win32.whl", hash = "sha256:daa4ee5a243f0f20d528d939d06670a298dd39b1ad5f8a72a4275124a7819eff"}, {file = "MarkupSafe-2.1.5-cp38-cp38-win_amd64.whl", hash = "sha256:619bc166c4f2de5caa5a633b8b7326fbe98e0ccbfacabd87268a2b15ff73a029"}, {file = "MarkupSafe-2.1.5-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:7a68b554d356a91cce1236aa7682dc01df0edba8d043fd1ce607c49dd3c1edcf"}, {file = "MarkupSafe-2.1.5-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:db0b55e0f3cc0be60c1f19efdde9a637c32740486004f20d1cff53c3c0ece4d2"}, {file = "MarkupSafe-2.1.5-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3e53af139f8579a6d5f7b76549125f0d94d7e630761a2111bc431fd820e163b8"}, {file = "MarkupSafe-2.1.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:17b950fccb810b3293638215058e432159d2b71005c74371d784862b7e4683f3"}, {file = "MarkupSafe-2.1.5-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4c31f53cdae6ecfa91a77820e8b151dba54ab528ba65dfd235c80b086d68a465"}, {file = "MarkupSafe-2.1.5-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:bff1b4290a66b490a2f4719358c0cdcd9bafb6b8f061e45c7a2460866bf50c2e"}, {file = "MarkupSafe-2.1.5-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:bc1667f8b83f48511b94671e0e441401371dfd0f0a795c7daa4a3cd1dde55bea"}, {file = "MarkupSafe-2.1.5-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:5049256f536511ee3f7e1b3f87d1d1209d327e818e6ae1365e8653d7e3abb6a6"}, {file = "MarkupSafe-2.1.5-cp39-cp39-win32.whl", hash = "sha256:00e046b6dd71aa03a41079792f8473dc494d564611a8f89bbbd7cb93295ebdcf"}, {file = "MarkupSafe-2.1.5-cp39-cp39-win_amd64.whl", hash = "sha256:fa173ec60341d6bb97a89f5ea19c85c5643c1e7dedebc22f5181eb73573142c5"}, {file = "MarkupSafe-2.1.5.tar.gz", hash = "sha256:d283d37a890ba4c1ae73ffadf8046435c76e7bc2247bbb63c00bd1a709c6544b"}, ] [[package]] name = "mypy-extensions" version = "1.1.0" description = "Type system extensions for programs checked with the mypy type checker." optional = false python-versions = ">=3.8" groups = ["dev"] files = [ {file = "mypy_extensions-1.1.0-py3-none-any.whl", hash = "sha256:1be4cccdb0f2482337c4743e60421de3a356cd97508abadd57d47403e94f5505"}, {file = "mypy_extensions-1.1.0.tar.gz", hash = "sha256:52e68efc3284861e772bbcd66823fde5ae21fd2fdb51c62a211403730b916558"}, ] [[package]] name = "packaging" version = "25.0" description = "Core utilities for Python packages" optional = false python-versions = ">=3.8" groups = ["dev"] files = [ {file = "packaging-25.0-py3-none-any.whl", hash = "sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484"}, {file = "packaging-25.0.tar.gz", hash = "sha256:d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f"}, ] [[package]] name = "pathspec" version = "0.12.1" description = "Utility library for gitignore style pattern matching of file paths." optional = false python-versions = ">=3.8" groups = ["dev"] files = [ {file = "pathspec-0.12.1-py3-none-any.whl", hash = "sha256:a0d503e138a4c123b27490a4f7beda6a01c6f288df0e4a8b79c7eb0dc7b4cc08"}, {file = "pathspec-0.12.1.tar.gz", hash = "sha256:a482d51503a1ab33b1c67a6c3813a26953dbdc71c31dacaef9a838c4e29f5712"}, ] [[package]] name = "platformdirs" version = "4.3.6" description = "A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`." optional = false python-versions = ">=3.8" groups = ["dev"] files = [ {file = "platformdirs-4.3.6-py3-none-any.whl", hash = "sha256:73e575e1408ab8103900836b97580d5307456908a03e92031bab39e4554cc3fb"}, {file = "platformdirs-4.3.6.tar.gz", hash = "sha256:357fb2acbc885b0419afd3ce3ed34564c13c9b95c89360cd9563f73aa5e2b907"}, ] [package.extras] docs = ["furo (>=2024.8.6)", "proselint (>=0.14)", "sphinx (>=8.0.2)", "sphinx-autodoc-typehints (>=2.4)"] test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=8.3.2)", "pytest-cov (>=5)", "pytest-mock (>=3.14)"] type = ["mypy (>=1.11.2)"] [[package]] name = "pluggy" version = "1.5.0" description = "plugin and hook calling mechanisms for python" optional = false python-versions = ">=3.8" groups = ["dev"] files = [ {file = "pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669"}, {file = "pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1"}, ] [package.extras] dev = ["pre-commit", "tox"] testing = ["pytest", "pytest-benchmark"] [[package]] name = "pygments" version = "2.19.2" description = "Pygments is a syntax highlighting package written in Python." optional = false python-versions = ">=3.8" groups = ["dev"] files = [ {file = "pygments-2.19.2-py3-none-any.whl", hash = "sha256:86540386c03d588bb81d44bc3928634ff26449851e99741617ecb9037ee5ec0b"}, {file = "pygments-2.19.2.tar.gz", hash = "sha256:636cb2477cec7f8952536970bc533bc43743542f70392ae026374600add5b887"}, ] [package.extras] windows-terminal = ["colorama (>=0.4.6)"] [[package]] name = "pyparsing" version = "3.1.4" description = "pyparsing module - Classes and methods to define and execute parsing grammars" optional = false python-versions = ">=3.6.8" groups = ["main"] files = [ {file = "pyparsing-3.1.4-py3-none-any.whl", hash = "sha256:a6a7ee4235a3f944aa1fa2249307708f893fe5717dc603503c6c7969c070fb7c"}, {file = "pyparsing-3.1.4.tar.gz", hash = "sha256:f86ec8d1a83f11977c9a6ea7598e8c27fc5cddfa5b07ea2241edbbde1d7bc032"}, ] [package.extras] diagrams = ["jinja2", "railroad-diagrams"] [[package]] name = "pytest" version = "8.3.5" description = "pytest: simple powerful testing with Python" optional = false python-versions = ">=3.8" groups = ["dev"] files = [ {file = "pytest-8.3.5-py3-none-any.whl", hash = "sha256:c69214aa47deac29fad6c2a4f590b9c4a9fdb16a403176fe154b79c0b4d4d820"}, {file = "pytest-8.3.5.tar.gz", hash = "sha256:f4efe70cc14e511565ac476b57c279e12a855b11f48f212af1080ef2263d3845"}, ] [package.dependencies] colorama = {version = "*", markers = "sys_platform == \"win32\""} exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} iniconfig = "*" packaging = "*" pluggy = ">=1.5,<2" tomli = {version = ">=1", markers = "python_version < \"3.11\""} [package.extras] dev = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] [[package]] name = "rdflib" version = "7.1.4" description = "RDFLib is a Python library for working with RDF, a simple yet powerful language for representing information." optional = false python-versions = "<4.0.0,>=3.8.1" groups = ["main"] files = [ {file = "rdflib-7.1.4-py3-none-any.whl", hash = "sha256:72f4adb1990fa5241abd22ddaf36d7cafa5d91d9ff2ba13f3086d339b213d997"}, {file = "rdflib-7.1.4.tar.gz", hash = "sha256:fed46e24f26a788e2ab8e445f7077f00edcf95abb73bcef4b86cefa8b62dd174"}, ] [package.dependencies] isodate = {version = ">=0.7.2,<1.0.0", markers = "python_version < \"3.11\""} pyparsing = ">=2.1.0,<4" [package.extras] berkeleydb = ["berkeleydb (>=18.1.0,<19.0.0)"] html = ["html5rdf (>=1.2,<2)"] lxml = ["lxml (>=4.3,<6.0)"] networkx = ["networkx (>=2,<4)"] orjson = ["orjson (>=3.9.14,<4)"] [[package]] name = "requests" version = "2.32.4" description = "Python HTTP for Humans." optional = false python-versions = ">=3.8" groups = ["dev"] files = [ {file = "requests-2.32.4-py3-none-any.whl", hash = "sha256:27babd3cda2a6d50b30443204ee89830707d396671944c998b5975b031ac2b2c"}, {file = "requests-2.32.4.tar.gz", hash = "sha256:27d0316682c8a29834d3264820024b62a36942083d52caf2f14c0591336d3422"}, ] [package.dependencies] certifi = ">=2017.4.17" charset_normalizer = ">=2,<4" idna = ">=2.5,<4" urllib3 = ">=1.21.1,<3" [package.extras] socks = ["PySocks (>=1.5.6,!=1.5.7)"] use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] [[package]] name = "snowballstemmer" version = "3.0.1" description = "This package provides 32 stemmers for 30 languages generated from Snowball algorithms." optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*" groups = ["dev"] files = [ {file = "snowballstemmer-3.0.1-py3-none-any.whl", hash = "sha256:6cd7b3897da8d6c9ffb968a6781fa6532dce9c3618a4b127d920dab764a19064"}, {file = "snowballstemmer-3.0.1.tar.gz", hash = "sha256:6d5eeeec8e9f84d4d56b847692bacf79bc2c8e90c7f80ca4444ff8b6f2e52895"}, ] [[package]] name = "sphinx" version = "7.1.2" description = "Python documentation generator" optional = false python-versions = ">=3.8" groups = ["dev"] files = [ {file = "sphinx-7.1.2-py3-none-any.whl", hash = "sha256:d170a81825b2fcacb6dfd5a0d7f578a053e45d3f2b153fecc948c37344eb4cbe"}, {file = "sphinx-7.1.2.tar.gz", hash = "sha256:780f4d32f1d7d1126576e0e5ecc19dc32ab76cd24e950228dcf7b1f6d3d9e22f"}, ] [package.dependencies] alabaster = ">=0.7,<0.8" babel = ">=2.9" colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""} docutils = ">=0.18.1,<0.21" imagesize = ">=1.3" importlib-metadata = {version = ">=4.8", markers = "python_version < \"3.10\""} Jinja2 = ">=3.0" packaging = ">=21.0" Pygments = ">=2.13" requests = ">=2.25.0" snowballstemmer = ">=2.0" sphinxcontrib-applehelp = "*" sphinxcontrib-devhelp = "*" sphinxcontrib-htmlhelp = ">=2.0.0" sphinxcontrib-jsmath = "*" sphinxcontrib-qthelp = "*" sphinxcontrib-serializinghtml = ">=1.1.5" [package.extras] docs = ["sphinxcontrib-websupport"] lint = ["docutils-stubs", "flake8 (>=3.5.0)", "flake8-simplify", "isort", "mypy (>=0.990)", "ruff", "sphinx-lint", "types-requests"] test = ["cython", "filelock", "html5lib", "pytest (>=4.6)"] [[package]] name = "sphinxcontrib-applehelp" version = "1.0.4" description = "sphinxcontrib-applehelp is a Sphinx extension which outputs Apple help books" optional = false python-versions = ">=3.8" groups = ["dev"] files = [ {file = "sphinxcontrib-applehelp-1.0.4.tar.gz", hash = "sha256:828f867945bbe39817c210a1abfd1bc4895c8b73fcaade56d45357a348a07d7e"}, {file = "sphinxcontrib_applehelp-1.0.4-py3-none-any.whl", hash = "sha256:29d341f67fb0f6f586b23ad80e072c8e6ad0b48417db2bde114a4c9746feb228"}, ] [package.extras] lint = ["docutils-stubs", "flake8", "mypy"] test = ["pytest"] [[package]] name = "sphinxcontrib-devhelp" version = "1.0.2" description = "sphinxcontrib-devhelp is a sphinx extension which outputs Devhelp document." optional = false python-versions = ">=3.5" groups = ["dev"] files = [ {file = "sphinxcontrib-devhelp-1.0.2.tar.gz", hash = "sha256:ff7f1afa7b9642e7060379360a67e9c41e8f3121f2ce9164266f61b9f4b338e4"}, {file = "sphinxcontrib_devhelp-1.0.2-py2.py3-none-any.whl", hash = "sha256:8165223f9a335cc1af7ffe1ed31d2871f325254c0423bc0c4c7cd1c1e4734a2e"}, ] [package.extras] lint = ["docutils-stubs", "flake8", "mypy"] test = ["pytest"] [[package]] name = "sphinxcontrib-htmlhelp" version = "2.0.1" description = "sphinxcontrib-htmlhelp is a sphinx extension which renders HTML help files" optional = false python-versions = ">=3.8" groups = ["dev"] files = [ {file = "sphinxcontrib-htmlhelp-2.0.1.tar.gz", hash = "sha256:0cbdd302815330058422b98a113195c9249825d681e18f11e8b1f78a2f11efff"}, {file = "sphinxcontrib_htmlhelp-2.0.1-py3-none-any.whl", hash = "sha256:c38cb46dccf316c79de6e5515e1770414b797162b23cd3d06e67020e1d2a6903"}, ] [package.extras] lint = ["docutils-stubs", "flake8", "mypy"] test = ["html5lib", "pytest"] [[package]] name = "sphinxcontrib-jsmath" version = "1.0.1" description = "A sphinx extension which renders display math in HTML via JavaScript" optional = false python-versions = ">=3.5" groups = ["dev"] files = [ {file = "sphinxcontrib-jsmath-1.0.1.tar.gz", hash = "sha256:a9925e4a4587247ed2191a22df5f6970656cb8ca2bd6284309578f2153e0c4b8"}, {file = "sphinxcontrib_jsmath-1.0.1-py2.py3-none-any.whl", hash = "sha256:2ec2eaebfb78f3f2078e73666b1415417a116cc848b72e5172e596c871103178"}, ] [package.extras] test = ["flake8", "mypy", "pytest"] [[package]] name = "sphinxcontrib-qthelp" version = "1.0.3" description = "sphinxcontrib-qthelp is a sphinx extension which outputs QtHelp document." optional = false python-versions = ">=3.5" groups = ["dev"] files = [ {file = "sphinxcontrib-qthelp-1.0.3.tar.gz", hash = "sha256:4c33767ee058b70dba89a6fc5c1892c0d57a54be67ddd3e7875a18d14cba5a72"}, {file = "sphinxcontrib_qthelp-1.0.3-py2.py3-none-any.whl", hash = "sha256:bd9fc24bcb748a8d51fd4ecaade681350aa63009a347a8c14e637895444dfab6"}, ] [package.extras] lint = ["docutils-stubs", "flake8", "mypy"] test = ["pytest"] [[package]] name = "sphinxcontrib-serializinghtml" version = "1.1.5" description = "sphinxcontrib-serializinghtml is a sphinx extension which outputs \"serialized\" HTML files (json and pickle)." optional = false python-versions = ">=3.5" groups = ["dev"] files = [ {file = "sphinxcontrib-serializinghtml-1.1.5.tar.gz", hash = "sha256:aa5f6de5dfdf809ef505c4895e51ef5c9eac17d0f287933eb49ec495280b6952"}, {file = "sphinxcontrib_serializinghtml-1.1.5-py2.py3-none-any.whl", hash = "sha256:352a9a00ae864471d3a7ead8d7d79f5fc0b57e8b3f95e9867eb9eb28999b92fd"}, ] [package.extras] lint = ["docutils-stubs", "flake8", "mypy"] test = ["pytest"] [[package]] name = "tomli" version = "2.2.1" description = "A lil' TOML parser" optional = false python-versions = ">=3.8" groups = ["dev"] markers = "python_version < \"3.11\"" files = [ {file = "tomli-2.2.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:678e4fa69e4575eb77d103de3df8a895e1591b48e740211bd1067378c69e8249"}, {file = "tomli-2.2.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:023aa114dd824ade0100497eb2318602af309e5a55595f76b626d6d9f3b7b0a6"}, {file = "tomli-2.2.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ece47d672db52ac607a3d9599a9d48dcb2f2f735c6c2d1f34130085bb12b112a"}, {file = "tomli-2.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6972ca9c9cc9f0acaa56a8ca1ff51e7af152a9f87fb64623e31d5c83700080ee"}, {file = "tomli-2.2.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c954d2250168d28797dd4e3ac5cf812a406cd5a92674ee4c8f123c889786aa8e"}, {file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:8dd28b3e155b80f4d54beb40a441d366adcfe740969820caf156c019fb5c7ec4"}, {file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:e59e304978767a54663af13c07b3d1af22ddee3bb2fb0618ca1593e4f593a106"}, {file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:33580bccab0338d00994d7f16f4c4ec25b776af3ffaac1ed74e0b3fc95e885a8"}, {file = "tomli-2.2.1-cp311-cp311-win32.whl", hash = "sha256:465af0e0875402f1d226519c9904f37254b3045fc5084697cefb9bdde1ff99ff"}, {file = "tomli-2.2.1-cp311-cp311-win_amd64.whl", hash = "sha256:2d0f2fdd22b02c6d81637a3c95f8cd77f995846af7414c5c4b8d0545afa1bc4b"}, {file = "tomli-2.2.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:4a8f6e44de52d5e6c657c9fe83b562f5f4256d8ebbfe4ff922c495620a7f6cea"}, {file = "tomli-2.2.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:8d57ca8095a641b8237d5b079147646153d22552f1c637fd3ba7f4b0b29167a8"}, {file = "tomli-2.2.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4e340144ad7ae1533cb897d406382b4b6fede8890a03738ff1683af800d54192"}, {file = "tomli-2.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:db2b95f9de79181805df90bedc5a5ab4c165e6ec3fe99f970d0e302f384ad222"}, {file = "tomli-2.2.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:40741994320b232529c802f8bc86da4e1aa9f413db394617b9a256ae0f9a7f77"}, {file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:400e720fe168c0f8521520190686ef8ef033fb19fc493da09779e592861b78c6"}, {file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:02abe224de6ae62c19f090f68da4e27b10af2b93213d36cf44e6e1c5abd19fdd"}, {file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:b82ebccc8c8a36f2094e969560a1b836758481f3dc360ce9a3277c65f374285e"}, {file = "tomli-2.2.1-cp312-cp312-win32.whl", hash = "sha256:889f80ef92701b9dbb224e49ec87c645ce5df3fa2cc548664eb8a25e03127a98"}, {file = "tomli-2.2.1-cp312-cp312-win_amd64.whl", hash = "sha256:7fc04e92e1d624a4a63c76474610238576942d6b8950a2d7f908a340494e67e4"}, {file = "tomli-2.2.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:f4039b9cbc3048b2416cc57ab3bda989a6fcf9b36cf8937f01a6e731b64f80d7"}, {file = "tomli-2.2.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:286f0ca2ffeeb5b9bd4fcc8d6c330534323ec51b2f52da063b11c502da16f30c"}, {file = "tomli-2.2.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a92ef1a44547e894e2a17d24e7557a5e85a9e1d0048b0b5e7541f76c5032cb13"}, {file = "tomli-2.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9316dc65bed1684c9a98ee68759ceaed29d229e985297003e494aa825ebb0281"}, {file = "tomli-2.2.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e85e99945e688e32d5a35c1ff38ed0b3f41f43fad8df0bdf79f72b2ba7bc5272"}, {file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:ac065718db92ca818f8d6141b5f66369833d4a80a9d74435a268c52bdfa73140"}, {file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:d920f33822747519673ee656a4b6ac33e382eca9d331c87770faa3eef562aeb2"}, {file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:a198f10c4d1b1375d7687bc25294306e551bf1abfa4eace6650070a5c1ae2744"}, {file = "tomli-2.2.1-cp313-cp313-win32.whl", hash = "sha256:d3f5614314d758649ab2ab3a62d4f2004c825922f9e370b29416484086b264ec"}, {file = "tomli-2.2.1-cp313-cp313-win_amd64.whl", hash = "sha256:a38aa0308e754b0e3c67e344754dff64999ff9b513e691d0e786265c93583c69"}, {file = "tomli-2.2.1-py3-none-any.whl", hash = "sha256:cb55c73c5f4408779d0cf3eef9f762b9c9f147a77de7b258bef0a5628adc85cc"}, {file = "tomli-2.2.1.tar.gz", hash = "sha256:cd45e1dc79c835ce60f7404ec8119f2eb06d38b1deba146f07ced3bbc44505ff"}, ] [[package]] name = "typing-extensions" version = "4.13.2" description = "Backported and Experimental Type Hints for Python 3.8+" optional = false python-versions = ">=3.8" groups = ["dev"] markers = "python_version < \"3.11\"" files = [ {file = "typing_extensions-4.13.2-py3-none-any.whl", hash = "sha256:a439e7c04b49fec3e5d3e2beaa21755cadbbdc391694e28ccdd36ca4a1408f8c"}, {file = "typing_extensions-4.13.2.tar.gz", hash = "sha256:e6c81219bd689f51865d9e372991c540bda33a0379d5573cddb9a3a23f7caaef"}, ] [[package]] name = "urllib3" version = "2.2.3" description = "HTTP library with thread-safe connection pooling, file post, and more." optional = false python-versions = ">=3.8" groups = ["dev"] files = [ {file = "urllib3-2.2.3-py3-none-any.whl", hash = "sha256:ca899ca043dcb1bafa3e262d73aa25c465bfb49e0bd9dd5d59f1d0acba2f8fac"}, {file = "urllib3-2.2.3.tar.gz", hash = "sha256:e7d814a81dad81e6caf2ec9fdedb284ecc9c73076b62654547cc64ccdcae26e9"}, ] [package.extras] brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)"] h2 = ["h2 (>=4,<5)"] socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"] zstd = ["zstandard (>=0.18.0)"] [[package]] name = "zipp" version = "3.20.2" description = "Backport of pathlib-compatible object wrapper for zip files" optional = false python-versions = ">=3.8" groups = ["dev"] markers = "python_version < \"3.10\"" files = [ {file = "zipp-3.20.2-py3-none-any.whl", hash = "sha256:a817ac80d6cf4b23bf7f2828b7cabf326f15a001bea8b1f9b49631780ba28350"}, {file = "zipp-3.20.2.tar.gz", hash = "sha256:bc9eb26f4506fda01b81bcde0ca78103b6e62f991b381fec825435c836edbc29"}, ] [package.extras] check = ["pytest-checkdocs (>=2.4)", "pytest-ruff (>=0.2.1)"] cover = ["pytest-cov"] doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] enabler = ["pytest-enabler (>=2.2)"] test = ["big-O", "importlib-resources", "jaraco.functools", "jaraco.itertools", "jaraco.test", "more-itertools", "pytest (>=6,!=8.1.*)", "pytest-ignore-flaky"] type = ["pytest-mypy"] [metadata] lock-version = "2.1" python-versions = ">=3.9,<4.0" content-hash = "21295d04cc780525e82f6de98a984a56dd82468e1754440dca99c058ce44bbdc" OWL-RL-7.1.4/pypi.txt000066400000000000000000000004431504201166100142160ustar00rootroot00000000000000rm -r .pytest_cache build dist owlrl.egg-info git commit -am "..." git tag "v5.2.3" git push git push --tags # markup release on GitHub - https://github.com/RDFLib/OWL-RL/releases python setup.py bdist_wheel sdist twine upload ./dist/* build docco `python setup.py build_sphinx` OWL-RL-7.1.4/pyproject.toml000066400000000000000000000011431504201166100154060ustar00rootroot00000000000000[tool.poetry] name = "owlrl" version = "7.1.4" description = "A simple implementation of the OWL2 RL Profile, as well as a basic RDFS inference, on top of RDFLib. Based mechanical forward chaining." authors = ["Nicholas Car "] license = "W3C software and Document Notice License" readme = "README.rst" packages = [{include = "owlrl"}] [tool.poetry.dependencies] python = ">=3.9,<4.0" rdflib = ">=7.1.4" [tool.poetry.group.dev.dependencies] black = "24.4.2" sphinx = ">=7.1.2,<8" pytest = ">=7.1.3,<9.0.0" [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" OWL-RL-7.1.4/scripts/000077500000000000000000000000001504201166100141625ustar00rootroot00000000000000OWL-RL-7.1.4/scripts/RDFConvertService000077500000000000000000000120341504201166100174050ustar00rootroot00000000000000#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Possible CGI entry point for the owl package. @author: U{Ivan Herman} @license: This software is available for use under the U{W3C® SOFTWARE NOTICE AND LICENSE} @contact: Ivan Herman, ivan@w3.org """ """ $Id: RDFConvertService.py,v 1.3 2009/07/10 08:45:14 ivan Exp $ """ import os import sys import cgi import cgitb # prevent accidentally importing `scripts/owlrl` file when calling # `from owlrl import ...` below. HERE_DIR = os.path.abspath(os.path.dirname(__file__)) if HERE_DIR in sys.path: sys.path.remove(HERE_DIR) # Add 'owlrl' module from the parent directory into the path if it exists. PARENT_DIR = os.path.dirname(HERE_DIR) parent_dir_list = os.listdir(PARENT_DIR) if 'owlrl' in parent_dir_list: possible_owlrl = os.path.join(PARENT_DIR, 'owlrl') if os.path.isdir(possible_owlrl): sys.path.append(possible_owlrl) __version__ = "4.0" cgitb.enable() form = cgi.FieldStorage() from owlrl import convert_graph, RDFXML, TURTLE, AUTO # --------------------------------------------------------------------------------------------------------------------- class Options: def __init__(self, frm): self.iformat = AUTO self.owlClosure = "no" self.rdfsClosure = "no" self.owlExtras = "no" self.axioms = "no" self.daxioms = "no" self.sources = [] self.text = None self.format = TURTLE if "source_1" in list(frm.keys()): self.sources.append(frm["source_1"].value) if "source_2" in list(frm.keys()): self.sources.append(frm["source_2"].value) if "text" in list(frm.keys()): self.text = frm["text"].value if "format" in list(frm.keys()): self.format = frm["format"].value if "iformat" in list(frm.keys()): v = frm["iformat"].value if v == "xml" or v == "turtle": self.iformat = v if "fullClosure" in list(frm.keys()) and frm["fullClosure"].value == "yes": self.owlClosure = "yes" self.rdfsClosure = "yes" self.axioms = "no" self.daxioms = "no" self.owlExtras = "no" else: if "owlClosure" in list(frm.keys()): self.owlClosure = frm["owlClosure"].value if "rdfsClosure" in list(frm.keys()): self.rdfsClosure = frm["rdfsClosure"].value if "owlExtras" in list(frm.keys()): self.owlExtras = frm["owlExtras"].value if "axioms" in list(frm.keys()): self.axioms = frm["axioms"].value if "daxioms" in list(frm.keys()): self.daxioms = frm["daxioms"].value # this one is for backward compatibility... if "uri" in list(frm.keys()): self.sources.append(frm["uri"].value) if "source" in list(frm.keys()): self.sources.append(frm["source"].value) def to_html(self): print('
') print('
Sources:
') print('
') if len(self.sources) == 0: print("none") elif len(self.sources) == 1: print(cgi.escape(self.sources[0])) else: print(cgi.escape(self.sources[0]), ", ", cgi.escape(self.sources[1])) print('
') print('
Input format:
') print('
%s
' % self.iformat) print('
Output format:
%s
' % self.format) print('
OWL 2 RL Processing:
%s
' % self.owlClosure) print('
RDFS Processing:
%s
' % self.rdfsClosure) print('
Extra OWL Processing:
%s
' % self.owlExtras) print('
Axiomatic triples added:
%s
' % self.axioms) print('
Datatype Axiomatic triples added:
%s
' % self.daxioms) if self.text is not None: print('
Turtle code added to the graph:
') print('
') if self.text is not None: print(cgi.escape(self.text).replace('\n', '
')) # --------------------------------------------------------------------------------------------------------------------- options = Options(form) try: retval = convert_graph(options) if options.format == TURTLE: print('Content-Type: text/turtle; charset=utf-8') else: print('Content-Type: application/rdf+xml; charset=utf-8') print() print(retval) except: (typ, value, traceback) = sys.exc_info() print('Content-type: text/html; charset=utf-8') print('Status: 400 Invalid Input') print() print("") print("") print("Error in RDF Closure processing") print("") print("

Error in RDF Closure processing:

") print("
%s
" % value) print("

For reference, the input arguments were:

") options.to_html() print("") print("") OWL-RL-7.1.4/scripts/owlrl000077500000000000000000000113361504201166100152530ustar00rootroot00000000000000#!/usr/bin/env python3 import os from optparse import OptionParser from owlrl import convert_graph, RDFXML, TURTLE, JSON, AUTO, RDFA def main(): parser = OptionParser(usage="%prog [options] fname1 fname2 ...") parser.disable_interspersed_args() # The 'text' field is not used in the command line, but the CGI environment uses it. This means that there # is no option to change that, but is added to the final option structure parser.set_defaults(format=TURTLE, owlClosure="no", rdfsClosure="no", owlExtras="no", axioms="no", daxioms="no", iformat=AUTO, trimming="no", maximal="no", text=None) parser.add_option("-f", "--file", type="string", dest="source", help="input file; should be a .rdf or .ttl file, for RDF/XML or Turtle, respectively. If " "missing, or if the value is '-' then standard input is used. Usage of this options is not " "really necessary, the fname in the command lines refer to files by themselves") parser.add_option("--owlrl", action="store", dest="owlClosure", choices=["yes", "no"], help="execute OWL RL closure; argument must be yes|no [default: %default]") parser.add_option("-w", action="store_const", dest="owlClosure", const="yes", help="OWL-RL is executed; shorthand for --owlrl=yes") parser.add_option("--rdfs", action="store", dest="rdfsClosure", choices=["yes", "no"], help="execute RDFS closure; argument must be yes|no [default: %default]") parser.add_option("-r", action="store_const", dest="rdfsClosure", const="yes", help="RDFS is executed; shorthand for --rdfs=yes") parser.add_option("--extras", action="store", dest="owlExtras", choices=["yes", "no"], help="additional owl features added; argument must be yes|no [default: %default]") parser.add_option("-e", action="store_const", dest="owlExtras", const="yes", help="additional owl features added; shorthand for --extras=yes [default: %default]") parser.add_option("--axioms", action="store", dest="axioms", choices=["yes", "no"], help="axiomatic triples; argument must be yes|no [default: %default]") parser.add_option("-a", action="store_const", dest="axioms", const="yes", help="add axiomatic triples; shorthand for --axioms=yes [default: %default]") parser.add_option("--daxioms", action="store", dest="daxioms", choices=["yes", "no"], help="datatype axiomatic triples; argument must be true|false [default: %default]") parser.add_option("-d", action="store_const", dest="daxioms", const="yes", help="add axiomatic triples; shorthand for --daxioms=yes [default: %default]") parser.add_option("--trimming", action="store", dest="trimming", choices=["yes", "no"], help="trim the output of OWL 2 RL and extension; 'yes' is ineffective unless --extras=yes " "[default: %default]") parser.add_option("-m", "--maximal", action="store_const", dest="maximal", const="yes", help="maximal possibilities switched on: RDFS, OWL with extensions, and with trimming") parser.add_option("-t", action="store_const", dest="trimming", const="yes", help="trim the output of OWL 2 RL and extension; shorthand for --trimming=yes " "[default: %default]") parser.add_option("-o", "-s", "--serialization", "--syntax", action="store", dest="format", choices=[TURTLE, JSON, RDFXML], help="output format; argument must be turtle|json|xml [default: %default]") parser.add_option("-i", "--input_syntax", action="store", dest="iformat", choices=[AUTO, TURTLE, JSON, RDFA, RDFXML], help="format of input; argument must be auto|turtle|xml|rdfa|json [default: %default]; auto " "means that file suffix defines the format. This flag is valid for all input files.") (options, args) = parser.parse_args() if options.source is None: options.sources = [] else: options.sources = [options.source] if len(args) > 0: options.sources += args if len(options.sources) == 0: # the default mechanism, ie, to use standard input options.sources = ["-"] if options.maximal == "yes": options.trimming = "yes" options.owlClosure = "yes" options.owlExtras = "yes" print(convert_graph(options)) # The standard startup idiom... if __name__ == '__main__': main() OWL-RL-7.1.4/setup.cfg000066400000000000000000000000511504201166100143100ustar00rootroot00000000000000[metadata] description-file = README.rst OWL-RL-7.1.4/setup.py000077500000000000000000000055131504201166100142140ustar00rootroot00000000000000#!/usr/bin/env python3 # -*- coding: latin-1 -*- import re import os import io from setuptools import setup def open_local(paths, mode="r", encoding="utf8"): path = os.path.join(os.path.abspath(os.path.dirname(__file__)), *paths) return io.open(path, mode, encoding=encoding) with open_local(["owlrl", "__init__.py"], encoding="utf-8") as fp: try: version = re.findall(r'^__version__ = "([^"]+)"\r?$', fp.read(), re.M)[0] except IndexError: raise RuntimeError("Unable to determine version.") with open_local(["README.rst"]) as readme: long_description = readme.read() with open_local(["requirements.txt"]) as req: found_requirements = req.read().split("\n") dependency_links = [] requirements = [] for f in found_requirements: if "git+" in f: pkg = f.split("#")[-1] dependency_links.append(f.strip() + "-9876543210") requirements.append(pkg.replace("egg=", "").rstrip()) else: requirements.append(f.strip()) setup( name="owlrl", packages=["owlrl"], scripts=["scripts/owlrl", "scripts/RDFConvertService"], package_dir={"owlrl": "./owlrl"}, version=version, description="OWL-RL and RDFS based RDF Closure inferencing for Python", author="Ivan Herman", author_email="ivan@ivan-herman.net", maintainer="Nicholas Car", maintainer_email="nick@kurrawong.ai", url="https://github.com/RDFLib/OWL-RL/", download_url="https://github.com/RDFLib/OWL-RL/" "archive/v{:s}.tar.gz".format(version), license="LICENSE.txt", keywords=[ "Linked Data", "Semantic Web", "Python", "triples", "inferencing", "RDF", "OWL", "OWL-RL", "owlrl", "RDFS", ], long_description=long_description, long_description_content_type="text/x-rst", classifiers=[ "Development Status :: 5 - Production/Stable", "Topic :: Utilities", "Topic :: Software Development :: Libraries :: Python Modules", "Intended Audience :: Developers", "License :: OSI Approved :: W3C License", "Natural Language :: English", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Operating System :: OS Independent", ], install_requires=requirements, tests_require=["pytest"] + requirements, dependency_links=dependency_links, ) OWL-RL-7.1.4/test/000077500000000000000000000000001504201166100134525ustar00rootroot00000000000000OWL-RL-7.1.4/test/relatives.ttl000066400000000000000000000032241504201166100161760ustar00rootroot00000000000000@prefix : . @prefix owl: . @prefix rdfs: . a owl:Ontology . # # Ontology # :Person a owl:Class . :Child a owl:Class ; rdfs:subClassOf :Person . :Parent a owl:Class ; rdfs:subClassOf :Person . :hasParent a owl:ObjectProperty . :hasChild a owl:ObjectProperty ; owl:inverseOf :hasParent . :hasGrandparent a owl:ObjectProperty ; owl:propertyChainAxiom ( :hasParent :hasParent ) . # # Data # :Aaron a owl:NamedIndividual . :Ann a :Person, owl:NamedIndividual . :Bill a :Person, owl:NamedIndividual . :Bob a :Person, owl:NamedIndividual ; :hasParent :Bill . :Cathy a :Person, owl:NamedIndividual ; :hasParent :Bill . :Fred a :Person, owl:NamedIndividual ; :hasChild :James ; :hasParent :Cathy . :Jacob a :Person, owl:NamedIndividual ; :hasParent :Fred . :James a :Person, owl:NamedIndividual . :James2 a :Person, owl:NamedIndividual ; :hasChild :John . :John a :Person, owl:NamedIndividual ; :hasChild :Mary, :Michael ; :hasParent :James2 . :Mary a :Person, owl:NamedIndividual . :Michael a :Person, owl:NamedIndividual ; :hasParent :John . :Simon a :Person, owl:NamedIndividual ; :hasParent :Michael . :Tim a :Child, owl:NamedIndividual ; :hasParent :Simon, :Valerie . :Valerie a :Person, owl:NamedIndividual . :Victor a :Person, owl:NamedIndividual . OWL-RL-7.1.4/test/test_basic.py000066400000000000000000000026501504201166100161470ustar00rootroot00000000000000from rdflib import Graph, Namespace from rdflib.namespace import RDF import sys from pathlib import Path sys.path.append(str(Path(__file__).parent.parent)) import owlrl RELS = Namespace("http://example.org/relatives#") def test_basic(): # create an RDF graph, load a simple OWL ontology and data g = Graph() try: g.parse("relatives.ttl", format="turtle") except FileNotFoundError: # This test might be run from the parent directory root g.parse("test/relatives.ttl", format="turtle") # count no. rels:Person class instances, no inferencing, should find 14 results (one Child) cnt = 0 for _ in g.subjects(predicate=RDF.type, object=RELS.Person): cnt += 1 assert cnt == 14 # count no. of hasGrandparent predicates, no inferencing, should find 0 results cnt = 0 for _ in g.subject_objects(predicate=RELS.hasGrandparent): cnt += 1 assert cnt == 0 # expand the graph with OWL-RL semantics owlrl.DeductiveClosure(owlrl.OWLRL_Semantics).expand(g) # count no. rels:Person class instances, after inferencing, should find 15 results cnt = 0 for _ in g.subjects(predicate=RDF.type, object=RELS.Person): cnt += 1 assert cnt == 15 # count no. of hasGrandparent predicates, after inferencing, should find 7 results cnt = 0 for _ in g.subject_objects(predicate=RELS.hasGrandparent): cnt += 1 assert cnt == 7 OWL-RL-7.1.4/test/test_class_axioms.py000066400000000000000000000017651504201166100175610ustar00rootroot00000000000000""" Test for OWL 2 RL/RDF rules from Table 7. The Semantics of Class Axioms https://www.w3.org/TR/owl2-profiles/#Reasoning_in_OWL_2_RL_and_RDF_Graphs_using_Rules """ from rdflib import Graph, Literal, RDF, OWL import sys from pathlib import Path sys.path.append(str(Path(__file__).parent.parent)) import owlrl from owlrl.Namespaces import ERRNS, T def test_cax_dw(): """ Test cax-dw rule for OWL 2 RL. If:: T(?c1, owl:disjointWith, ?c2) T(?x, rdf:type, ?c1) T(?x, rdf:type, ?c2) then:: false """ g = Graph() x = T.x c1 = T.c1 c2 = T.c2 g.add((c1, OWL.disjointWith, c2)) g.add((x, RDF.type, c1)) g.add((x, RDF.type, c2)) owlrl.DeductiveClosure(owlrl.OWLRL_Semantics).expand(g) result = next(g.objects(predicate=ERRNS.error)) expected = Literal( "Disjoint classes http://test.org/c1 and http://test.org/c2" " have a common individual http://test.org/x" ) assert expected == result OWL-RL-7.1.4/test/test_classes.py000066400000000000000000000150601504201166100165220ustar00rootroot00000000000000""" Test for OWL 2 RL/RDF rules from Table 6. The Semantics of Classes https://www.w3.org/TR/owl2-profiles/#Reasoning_in_OWL_2_RL_and_RDF_Graphs_using_Rules """ from unittest import mock from rdflib import Graph, Literal, RDF, OWL import sys from pathlib import Path sys.path.append(str(Path(__file__).parent.parent)) import owlrl from owlrl.Namespaces import ERRNS, T def test_cls_maxc1(): """ Test cls-maxc1 rule for OWL 2 RL. If:: T(?x, owl:maxCardinality, "0"^^xsd:nonNegativeInteger) T(?x, owl:onProperty, ?p) T(?u, rdf:type, ?x) T(?u, ?p, ?y) then:: false """ g = Graph() x = T.x p = T.p c = T.C u = T.u y = T.y g.add((x, OWL.maxCardinality, Literal(0))) g.add((x, OWL.onProperty, p)) g.add((x, OWL.onClass, c)) g.add((u, RDF.type, x)) g.add((u, p, y)) owlrl.DeductiveClosure(owlrl.OWLRL_Semantics).expand(g) result = next(g.objects(predicate=ERRNS.error)) expected = Literal( "Erroneous usage of maximum cardinality with" " http://test.org/x and http://test.org/y" ) assert expected == result def test_cls_maxc2(): """ Test cls-maxc2 rule for OWL 2 RL. If:: T(?x, owl:maxCardinality, "1"^^xsd:nonNegativeInteger) T(?x, owl:onProperty, ?p) T(?u, rdf:type, ?x) T(?u, ?p, ?y1) T(?u, ?p, ?y2) then:: T(?y1, owl:sameAs, ?y2) """ g = Graph() x = T.x p = T.p u = T.u y1 = T.y1 y2 = T.y2 g.add((x, OWL.maxCardinality, Literal(1))) g.add((x, OWL.onProperty, p)) g.add((u, RDF.type, x)) g.add((u, p, y1)) g.add((u, p, y2)) owlrl.DeductiveClosure(owlrl.OWLRL_Semantics).expand(g) assert (y1, OWL.sameAs, y2) in g def test_cls_maxqc1(): """ Test cls-maxqc1 rule for OWL 2 RL. If:: T(?x, owl:maxQualifiedCardinality, "0"^^xsd:nonNegativeInteger) T(?x, owl:onProperty, ?p) T(?x, owl:onClass, ?c) T(?u, rdf:type, ?x) T(?u, ?p, ?y) T(?y, rdf:type, ?c) then:: false """ g = Graph() g.add((T.x, OWL.maxQualifiedCardinality, Literal(0))) g.add((T.x, OWL.onProperty, T.p)) g.add((T.x, OWL.onClass, T.C)) g.add((T.u, RDF.type, T.x)) g.add((T.u, T.p, T.y)) g.add((T.y, RDF.type, T.C)) owlrl.DeductiveClosure(owlrl.OWLRL_Semantics).expand(g) result = next(g.objects(predicate=ERRNS.error)) expected = Literal( "Erroneous usage of maximum qualified cardinality with" " http://test.org/x, http://test.org/C and http://test.org/y" ) assert expected == result def test_cls_maxqc2(): """ Test cls-maxqc2 rule for OWL 2 RL. If:: T(?x, owl:maxQualifiedCardinality, "0"^^xsd:nonNegativeInteger) T(?x, owl:onProperty, ?p) T(?x, owl:onClass, owl:Thing) T(?u, rdf:type, ?x) T(?u, ?p, ?y) then:: false """ g = Graph() x = T.x p = T.p u = T.u y = T.y g.add((x, OWL.maxQualifiedCardinality, Literal(0))) g.add((x, OWL.onProperty, p)) g.add((x, OWL.onClass, OWL.Thing)) g.add((u, RDF.type, x)) g.add((u, p, y)) owlrl.DeductiveClosure(owlrl.OWLRL_Semantics).expand(g) result = next(g.objects(predicate=ERRNS.error)) expected = Literal( "Erroneous usage of maximum qualified cardinality with" + " http://test.org/x, http://www.w3.org/2002/07/owl#Thing and" + " http://test.org/y" ) assert expected == result def test_cls_maxqc3(): """ Test cls-maxqc3 rule for OWL 2 RL. If:: T(?x, owl:maxQualifiedCardinality, "1"^^xsd:nonNegativeInteger) T(?x, owl:onProperty, ?p) T(?x, owl:onClass, ?c) T(?u, rdf:type, ?x) T(?u, ?p, ?y1) T(?y1, rdf:type, ?c) T(?u, ?p, ?y2) T(?y2, rdf:type, ?c) then:: T(?y1, owl:sameAs, ?y2) """ g = Graph() x = T.x p = T.p c = T.C u = T.u y1 = T.y1 y2 = T.y2 g.add((x, OWL.maxQualifiedCardinality, Literal(1))) g.add((x, OWL.onProperty, p)) g.add((x, OWL.onClass, c)) g.add((u, RDF.type, x)) g.add((u, p, y1)) g.add((y1, RDF.type, c)) g.add((u, p, y2)) g.add((y2, RDF.type, c)) owlrl.DeductiveClosure(owlrl.OWLRL_Semantics).expand(g) assert (y1, OWL.sameAs, y2) in g def test_cls_maxqc4(): """ Test cls-maxqc4 rule for OWL 2 RL. If:: T(?x, owl:maxQualifiedCardinality, "1"^^xsd:nonNegativeInteger) T(?x, owl:onProperty, ?p) T(?x, owl:onClass, owl:Thing) T(?u, rdf:type, ?x) T(?u, ?p, ?y1) T(?u, ?p, ?y2) then:: T(?y1, owl:sameAs, ?y2) """ g = Graph() x = T.x p = T.p u = T.u y1 = T.y1 y2 = T.y2 g.add((x, OWL.maxQualifiedCardinality, Literal(1))) g.add((x, OWL.onProperty, p)) g.add((x, OWL.onClass, OWL.Thing)) g.add((u, RDF.type, x)) g.add((u, p, y1)) g.add((u, p, y2)) owlrl.DeductiveClosure(owlrl.OWLRL_Semantics).expand(g) assert (y1, OWL.sameAs, y2) in g def test_cls_avf(): """ Test for cls-avf rule for OWL 2 RL. If:: T(?x, owl:allValuesFrom, ?y) T(?x, owl:onProperty, ?p) T(?u, rdf:type, ?x) T(?u, ?p, ?v) and type restriction *valid*, then:: T(?v, rdf:type, ?y) """ g = Graph() x = T.x p = T.p u = T.u y = T.y v = T.v g.add((x, OWL.allValuesFrom, y)) g.add((x, OWL.onProperty, p)) g.add((u, RDF.type, x)) g.add((u, p, v)) owlrl.DeductiveClosure(owlrl.OWLRL_Semantics).expand(g) assert (v, RDF.type, y) in g @mock.patch.object(owlrl.OWLRL_Semantics, "restriction_typing_check") def test_cls_avf_error(mock_rtc): """ Test restriction type check for cls-avf rule for OWL 2 RL. If:: T(?x, owl:allValuesFrom, ?y) T(?x, owl:onProperty, ?p) T(?u, rdf:type, ?x) T(?u, ?p, ?v) and type restriction *invalid*, then:: false """ g = Graph() x = T.x p = T.p u = T.u y = T.y v = T.v g.add((x, OWL.allValuesFrom, y)) g.add((x, OWL.onProperty, p)) g.add((u, RDF.type, x)) g.add((u, p, v)) # trigger invalid restriction type mock_rtc.return_value = False owlrl.DeductiveClosure(owlrl.OWLRL_Semantics).expand(g) result = next(g.objects(predicate=ERRNS.error)) expected = Literal( "Violation of type restriction for allValuesFrom in http://test.org/p" " for datatype http://test.org/y on value http://test.org/v" ) assert expected == result OWL-RL-7.1.4/test/test_dataset.py000066400000000000000000000106171504201166100165150ustar00rootroot00000000000000from rdflib import Namespace, Dataset, URIRef from rdflib.namespace import RDF import sys from pathlib import Path try: from rdflib.graph import ConjunctiveGraph # ConjunctiveGraph is going away in rdflib 8.0 except ImportError: ConjunctiveGraph = Dataset sys.path.append(str(Path(__file__).parent.parent)) import owlrl RELS = Namespace("http://example.org/relatives#") def test_dataset(): # create an RDF graph, load a simple OWL ontology and data d = Dataset() d.default_union = True g = d.default_context try: g.parse("relatives.ttl", format="turtle") except FileNotFoundError: # This test might be run from the parent directory root g.parse("test/relatives.ttl", format="turtle") # count no. rels:Person class instances, no inferencing, should find 14 results (one Child) cnt = 0 for _ in d.subjects(predicate=RDF.type, object=RELS.Person): cnt += 1 assert cnt == 14 dest = d.graph(identifier=URIRef("urn:test:dest")) # count no. of hasGrandparent predicates, no inferencing, should find 0 results cnt = 0 for _ in d.subject_objects(predicate=RELS.hasGrandparent): cnt += 1 assert cnt == 0 # expand the graph with OWL-RL semantics owlrl.DeductiveClosure(owlrl.OWLRL_Semantics).expand(d, destination=dest) # count no. rels:Person class instances, after inferencing, should find 1 result in the Dest graph cnt = 0 for _ in dest.subjects(predicate=RDF.type, object=RELS.Person): cnt += 1 assert cnt == 1 # count no. rels:Person class instances, after inferencing, should find 15 results in the whole dataset cnt = 0 for _ in d.subjects(predicate=RDF.type, object=RELS.Person): cnt += 1 assert cnt == 15 # count no. of hasGrandparent predicates, after inferencing, should find 7 results in the Dest graph cnt = 0 for _ in dest.subject_objects(predicate=RELS.hasGrandparent): cnt += 1 assert cnt == 7 # count no. of hasGrandparent predicates, after inferencing, should find 7 results in the whole dataset cnt = 0 for _ in d.subject_objects(predicate=RELS.hasGrandparent): cnt += 1 assert cnt == 7 # count no. of hasGrandparent predicates, after inferencing, should find 0 results in the default graph cnt = 0 for _ in g.subject_objects(predicate=RELS.hasGrandparent): cnt += 1 assert cnt == 0 def test_conjunctive_graph(): # create an RDF graph, load a simple OWL ontology and data d = ConjunctiveGraph() g = d.default_context try: g.parse("relatives.ttl", format="turtle") except FileNotFoundError: # This test might be run from the parent directory root g.parse("test/relatives.ttl", format="turtle") # count no. rels:Person class instances, no inferencing, should find 14 results (one Child) cnt = 0 for _ in d.subjects(predicate=RDF.type, object=RELS.Person): cnt += 1 assert cnt == 14 dest = d.get_context(URIRef("urn:test:dest")) # count no. of hasGrandparent predicates, no inferencing, should find 0 results cnt = 0 for _ in d.subject_objects(predicate=RELS.hasGrandparent): cnt += 1 assert cnt == 0 # expand the graph with OWL-RL semantics owlrl.DeductiveClosure(owlrl.OWLRL_Semantics).expand(d, destination=dest) # count no. rels:Person class instances, after inferencing, should find 1 result in the Dest graph cnt = 0 for _ in dest.subjects(predicate=RDF.type, object=RELS.Person): cnt += 1 assert cnt == 1 # count no. rels:Person class instances, after inferencing, should find 15 results in the whole dataset cnt = 0 for _ in d.subjects(predicate=RDF.type, object=RELS.Person): cnt += 1 assert cnt == 15 # count no. of hasGrandparent predicates, after inferencing, should find 7 results in the Dest graph cnt = 0 for _ in dest.subject_objects(predicate=RELS.hasGrandparent): cnt += 1 assert cnt == 7 # count no. of hasGrandparent predicates, after inferencing, should find 7 results in the whole dataset cnt = 0 for _ in d.subject_objects(predicate=RELS.hasGrandparent): cnt += 1 assert cnt == 7 # count no. of hasGrandparent predicates, after inferencing, should find 0 results in the default graph cnt = 0 for _ in g.subject_objects(predicate=RELS.hasGrandparent): cnt += 1 assert cnt == 0OWL-RL-7.1.4/test/test_datatypes.py000066400000000000000000000064631504201166100170720ustar00rootroot00000000000000""" Test for OWL 2 RL/RDF rules from Table 8. The Semantics of Datatypes https://www.w3.org/TR/owl2-profiles/#Reasoning_in_OWL_2_RL_and_RDF_Graphs_using_Rules NOTE: The following axioms are skipped on purpose - dt-eq - dt-diff """ from rdflib import Graph, Literal, RDF, XSD, RDFS import sys from pathlib import Path sys.path.append(str(Path(__file__).parent.parent)) import owlrl from owlrl.Namespaces import ERRNS, T def test_dt_type1(): """ Test dt-type1 rule for OWL 2 RL. """ g = Graph() owlrl.DeductiveClosure(owlrl.OWLRL_Semantics).expand(g) assert (RDF.PlainLiteral, RDF.type, RDFS.Datatype) in g assert (RDF.XMLLiteral, RDF.type, RDFS.Datatype) in g assert (RDFS.Literal, RDF.type, RDFS.Datatype) in g assert (XSD.decimal, RDF.type, RDFS.Datatype) in g assert (XSD.integer, RDF.type, RDFS.Datatype) in g assert (XSD.nonNegativeInteger, RDF.type, RDFS.Datatype) in g assert (XSD.nonPositiveInteger, RDF.type, RDFS.Datatype) in g assert (XSD.positiveInteger, RDF.type, RDFS.Datatype) in g assert (XSD.negativeInteger, RDF.type, RDFS.Datatype) in g assert (XSD.long, RDF.type, RDFS.Datatype) in g assert (XSD.int, RDF.type, RDFS.Datatype) in g assert (XSD.short, RDF.type, RDFS.Datatype) in g assert (XSD.byte, RDF.type, RDFS.Datatype) in g assert (XSD.unsignedLong, RDF.type, RDFS.Datatype) in g assert (XSD.unsignedInt, RDF.type, RDFS.Datatype) in g assert (XSD.unsignedShort, RDF.type, RDFS.Datatype) in g assert (XSD.unsignedByte, RDF.type, RDFS.Datatype) in g assert (XSD.float, RDF.type, RDFS.Datatype) in g assert (XSD.double, RDF.type, RDFS.Datatype) in g assert (XSD.string, RDF.type, RDFS.Datatype) in g assert (XSD.normalizedString, RDF.type, RDFS.Datatype) in g assert (XSD.token, RDF.type, RDFS.Datatype) in g assert (XSD.language, RDF.type, RDFS.Datatype) in g assert (XSD.Name, RDF.type, RDFS.Datatype) in g assert (XSD.NCName, RDF.type, RDFS.Datatype) in g assert (XSD.NMTOKEN, RDF.type, RDFS.Datatype) in g assert (XSD.boolean, RDF.type, RDFS.Datatype) in g assert (XSD.hexBinary, RDF.type, RDFS.Datatype) in g assert (XSD.base64Binary, RDF.type, RDFS.Datatype) in g assert (XSD.anyURI, RDF.type, RDFS.Datatype) in g assert (XSD.dateTime, RDF.type, RDFS.Datatype) in g assert (XSD.dateTimeStamp, RDF.type, RDFS.Datatype) in g def test_dt_type2(): """ Test dt-type2 rule for OWL 2 RL. """ p_one = Literal(1, datatype=XSD.positiveInteger) g = Graph() g.add((T.A, T.prop, p_one)) owlrl.DeductiveClosure(owlrl.OWLRL_Semantics).expand(g) assert (T.A, T.prop, p_one) in g assert (p_one, RDF.type, XSD.positiveInteger) in g def test_dt_not_type(): """ Test dt-not-type rule for OWL 2 RL. """ m_one = Literal(-1, datatype=XSD.nonNegativeInteger) g = Graph() g.add((T.A, T.prop, m_one)) owlrl.DeductiveClosure(owlrl.OWLRL_Semantics).expand(g) # TODO, we know this one fails. It is not supposed to. # assert (m_one, RDF.type, XSD.nonNegativeInteger) not in g assert True result = next(g.objects(predicate=ERRNS.error)) expected = Literal( "Lexical value of the literal '-1' does not match its datatype" " (http://www.w3.org/2001/XMLSchema#nonNegativeInteger)" ) assert expected == result OWL-RL-7.1.4/test/test_equality.py000066400000000000000000000021241504201166100167170ustar00rootroot00000000000000""" Test for OWL 2 RL/RDF rules from Table 4. The Semantics of Equality https://www.w3.org/TR/owl2-profiles/#Reasoning_in_OWL_2_RL_and_RDF_Graphs_using_Rules """ from rdflib import Graph, Literal, OWL import sys from pathlib import Path sys.path.append(str(Path(__file__).parent.parent)) import owlrl from owlrl.Namespaces import ERRNS, T def test_eq_diff1(): """ Test eq-diff1 rule for OWL 2 RL. If:: T(?x, owl:sameAs, ?y) T(?x, owl:differentFrom, ?y) then:: false """ g = Graph() x = T.x y = T.y g.add((x, OWL.sameAs, y)) g.add((x, OWL.differentFrom, y)) owlrl.DeductiveClosure(owlrl.OWLRL_Semantics).expand(g) result = g.objects(predicate=ERRNS.error) expected = Literal( "'sameAs' and 'differentFrom' cannot be used on the same" + " subject-object pair:" ) # expect multiple error messages for pairs (x, y), (x, x) and (y, y) # due to contradiction: # # x == y and x != y => x != x and y != y and x == x and y == y assert all(r.startswith(expected) for r in result) OWL-RL-7.1.4/test/test_owlrl_extras.py000066400000000000000000000017431504201166100176150ustar00rootroot00000000000000""" Unit tests for OWL RL extras closure. """ from rdflib import Graph, Literal, RDF, XSD import sys from pathlib import Path sys.path.append(str(Path(__file__).parent.parent)) import owlrl from owlrl.Namespaces import T def test_one_time_rules(): """ Test OWL 2 RL extras closure one time rules. """ data = """ @prefix : . @prefix owl: . @prefix xsd: . @prefix rdfs: . :t a rdfs:Datatype ; owl:onDatatype xsd:integer; owl:withRestrictions ( [xsd:minInclusive "1"^^xsd:integer] [xsd:maxInclusive "6"^^xsd:integer] ). """ g = Graph() g.parse(data=data, format="n3") lt = Literal(2, datatype=XSD.integer) g.add((lt, RDF.type, XSD.integer)) g.add((T.a, T.p, lt)) owlrl.DeductiveClosure(owlrl.OWLRL_Extension).expand(g) assert (lt, RDF.type, T.t) in g OWL-RL-7.1.4/test/test_rdfs_closure.py000066400000000000000000000022221504201166100175530ustar00rootroot00000000000000""" Unit tests for RDFS closure. """ from rdflib import Graph, Literal, RDF, XSD from pathlib import Path import sys sys.path.append(str(Path(__file__).parent.parent)) import owlrl from owlrl.Namespaces import T def test_one_time_rules(): """ Test RDFS closure one time rules. """ g = Graph() lt1 = Literal(10, datatype=XSD.integer) lt2 = Literal(10, datatype=XSD.nonNegativeInteger) g.add((T.a1, T.p, lt1)) g.add((T.a2, T.p, lt2)) owlrl.DeductiveClosure(owlrl.RDFS_Semantics).expand(g) assert (T.a1, T.p, lt2) in g assert (T.a2, T.p, lt1) in g def test_d_axioms(): """ Test adding datatype axioms for RDFS closure. """ g = Graph() g.add((T.a1, T.p, Literal(10, datatype=XSD.integer))) g.add((T.a2, T.p, Literal("11", datatype=XSD.string))) g.add((T.a3, T.p, Literal("t"))) # no datatype owlrl.DeductiveClosure(owlrl.RDFS_Semantics, datatype_axioms=True).expand(g) assert (Literal(10, datatype=XSD.integer), RDF.type, XSD.integer) in g assert (Literal("11", datatype=XSD.string), RDF.type, XSD.string) in g assert next(g.subjects(Literal("t"), RDF.type), None) is None