Commits

Toby Inkster committed efad7be Draft

rearrange files

Comments (0)

Files changed (317)

Changes

-############################################################################
-## Changes #################################################################
-############################################################################
-
-RDF-Closure
-===========
-
-Created:      2011-02-23
-Home page:    <http://search.cpan.org/dist/RDF-Closure/>
-Bug tracker:  <http://rt.cpan.org/Dist/Display.html?Queue=RDF-Closure>
-Maintainer:   Toby Inkster <mailto:tobyink@cpan.org>
-
-0.000_03 [2011-04-06]
- - Implemented some more of OWL2 RL.
- - Some small optimisations.
-
-0.000_02 [2011-03-27] # pre-hackathon release
- - Implemented some more of OWL2 RL.
-
-0.000_01 [2011-03-14] # pi-day preview
-

Changes.ttl

-#############################################################
-
-@prefix :        <http://usefulinc.com/ns/doap#> .
-@prefix dcs:     <http://ontologi.es/doap-changeset#> .
-@prefix dc:      <http://purl.org/dc/terms/> .
-@prefix foaf:    <http://xmlns.com/foaf/0.1/> .
-@prefix my:      <http://purl.org/NET/cpan-uri/dist/RDF-Closure/> .
-@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
-@prefix toby:    <http://tobyinkster.co.uk/#> .
-@prefix xsd:     <http://www.w3.org/2001/XMLSchema#> .
-
-#############################################################
-
-<>
-
-	dc:title         "Changes" ;
-	dc:description   "Revision history for Perl extension RDF::Closure."@en ;
-	dc:subject       my:project ;
-	dc:creator       toby:i .
-
-#############################################################
-
-my:v_0-000_01
-
-	a               :Version ;
-	dc:issued       "2011-03-14"^^xsd:date ;
-	:revision       "0.000_01"^^xsd:string ;
-	:file-release   <http://backpan.cpan.org/authors/id/T/TO/TOBYINK/RDF-Closure-0.000_01.tar.gz> ;
-	rdfs:label      "pi-day preview"@en .
-
-my:v_0-000_02
-
-	a               :Version ;
-	dc:issued       "2011-03-27"^^xsd:date ;
-	:revision       "0.000_02"^^xsd:string ;
-	:file-release   <http://backpan.cpan.org/authors/id/T/TO/TOBYINK/RDF-Closure-0.000_02.tar.gz> ;
-	rdfs:label      "pre-hackathon release"@en ;
-	dcs:changeset [
-		dcs:versus my:v_0-000_01 ;
-		dcs:item   [ rdfs:label "Implemented some more of OWL2 RL."@en ]
-		] .
-
-my:v_0-000_03
-
-	a               :Version ;
-	dc:issued       "2011-04-06"^^xsd:date ;
-	:revision       "0.000_03"^^xsd:string ;
-	:file-release   <http://backpan.cpan.org/authors/id/T/TO/TOBYINK/RDF-Closure-0.000_03.tar.gz> ;
-	dcs:changeset [
-		dcs:versus my:v_0-000_02 ;
-		dcs:item   [ rdfs:label "Implemented some more of OWL2 RL."@en ] ;
-		dcs:item   [ rdfs:label "Some small optimisations."@en ]
-		] .
-
-#############################################################
-
-my:project
-
-	a               :Project ;
-	:name           "RDF-Closure" ;
-	:shortdesc      "pure Perl RDF inferencing"@en ;
-	:programming-language  "Perl" ;
-	:homepage       <https://metacpan.org/release/RDF-Closure> ;
-	:download-page  <https://metacpan.org/release/RDF-Closure> ;
-	:bug-database   <http://rt.cpan.org/Dist/Display.html?Queue=RDF-Closure> ;
-	rdfs:seeAlso    <http://www.ivan-herman.net/Misc/2008/owlrl/> ;
-	:repository     [ a :SVNRepository ; :browse <http://goddamn.co.uk/svn-web/perlmods/browse/RDF-Closure/> ] ;
-	:maintainer     toby:i ;
-	:developer      toby:i , <http://www.ivan-herman.net/foaf#me> ;
-	:documenter     toby:i ;
-	:tester         toby:i ;
-	:created        "2011-02-23"^^xsd:date ;
-	:license        <http://dev.perl.org/licenses/> ;
-	:release        my:v_0-000_01 , my:v_0-000_02 , my:v_0-000_03 .
-
-#############################################################
-
-toby:i
-
-	a               foaf:Person ;
-	foaf:name       "Toby Inkster" ;
-	foaf:homepage   <http://tobyinkster.co.uk/> ;
-	foaf:page       <https://metacpan.org/author/TOBYINK> ;
-	foaf:mbox       <mailto:tobyink@cpan.org> ;
-	<http://www.w3.org/2002/07/owl#sameAs> <http://purl.org/NET/cpan-uri/person/tobyink> .
-
-<http://www.ivan-herman.net/foaf#me>
-
-	a               foaf:Person ;
-	foaf:name       "Ivan Herman" ;
-	foaf:homepage    <http://www.ivan-herman.net/> ;
-	foaf:workplaceHomepage <http://www.w3.org/> .
-
-#############################################################

Changes.xml

-<?xml version="1.0" encoding="utf-8"?>
-<rdf:RDF xmlns:dbug="http://ontologi.es/doap-bugs#" xmlns:dc="http://purl.org/dc/terms/" xmlns:dcs="http://ontologi.es/doap-changeset#" xmlns:doap="http://usefulinc.com/ns/doap#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
-<rdf:Description rdf:nodeID="rD17FF822609211E0959CABF143DF20D5r0">
-	<dcs:item rdf:nodeID="rD17FF822609211E0959CABF143DF20D5r1"/>
-	<dcs:versus rdf:resource="http://purl.org/NET/cpan-uri/dist/RDF-Closure/v_0-000_01"/>
-</rdf:Description>
-<rdf:Description rdf:nodeID="rD17FF822609211E0959CABF143DF20D5r1">
-	<rdfs:label xml:lang="en">Implemented some more of OWL2 RL.</rdfs:label>
-</rdf:Description>
-<rdf:Description rdf:nodeID="rD17FF822609211E0959CABF143DF20D5r2">
-	<dcs:item rdf:nodeID="rD17FF822609211E0959CABF143DF20D5r3"/>
-	<dcs:item rdf:nodeID="rD17FF822609211E0959CABF143DF20D5r4"/>
-	<dcs:versus rdf:resource="http://purl.org/NET/cpan-uri/dist/RDF-Closure/v_0-000_02"/>
-</rdf:Description>
-<rdf:Description rdf:nodeID="rD17FF822609211E0959CABF143DF20D5r3">
-	<rdfs:label xml:lang="en">Implemented some more of OWL2 RL.</rdfs:label>
-</rdf:Description>
-<rdf:Description rdf:nodeID="rD17FF822609211E0959CABF143DF20D5r4">
-	<rdfs:label xml:lang="en">Some small optimisations.</rdfs:label>
-</rdf:Description>
-<rdf:Description rdf:nodeID="rD17FF822609211E0959CABF143DF20D5r5">
-	<doap:browse rdf:resource="http://goddamn.co.uk/viewvc/perlmods/RDF-Closure/"/>
-	<rdf:type rdf:resource="http://usefulinc.com/ns/doap#SVNRepository"/>
-</rdf:Description>
-<rdf:Description rdf:about="file:///home/tai/src/perlmods/RDF-Closure/Changes.ttl">
-	<dc:creator rdf:resource="http://tobyinkster.co.uk/#i"/>
-	<dc:description xml:lang="en">Revision history for Perl extension RDF::Closure.</dc:description>
-	<dc:subject rdf:resource="http://purl.org/NET/cpan-uri/dist/RDF-Closure/project"/>
-	<dc:title>Changes</dc:title>
-</rdf:Description>
-<rdf:Description rdf:about="http://purl.org/NET/cpan-uri/dist/RDF-Closure/project">
-	<doap:bug-database rdf:resource="http://rt.cpan.org/Dist/Display.html?Queue=RDF-Closure"/>
-	<doap:created rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2011-02-23</doap:created>
-	<doap:developer rdf:resource="http://tobyinkster.co.uk/#i"/>
-	<doap:developer rdf:resource="http://www.ivan-herman.net/foaf#me"/>
-	<doap:documenter rdf:resource="http://tobyinkster.co.uk/#i"/>
-	<doap:download-page rdf:resource="http://search.cpan.org/dist/RDF-Closure/"/>
-	<doap:homepage rdf:resource="http://search.cpan.org/dist/RDF-Closure/"/>
-	<doap:license rdf:resource="http://dev.perl.org/licenses/"/>
-	<doap:maintainer rdf:resource="http://tobyinkster.co.uk/#i"/>
-	<doap:name>RDF-Closure</doap:name>
-	<doap:programming-language>Perl</doap:programming-language>
-	<doap:release rdf:resource="http://purl.org/NET/cpan-uri/dist/RDF-Closure/v_0-000_01"/>
-	<doap:release rdf:resource="http://purl.org/NET/cpan-uri/dist/RDF-Closure/v_0-000_02"/>
-	<doap:release rdf:resource="http://purl.org/NET/cpan-uri/dist/RDF-Closure/v_0-000_03"/>
-	<doap:repository rdf:nodeID="rD17FF822609211E0959CABF143DF20D5r5"/>
-	<doap:shortdesc xml:lang="en">pure Perl RDF inferencing</doap:shortdesc>
-	<doap:tester rdf:resource="http://tobyinkster.co.uk/#i"/>
-	<rdf:type rdf:resource="http://usefulinc.com/ns/doap#Project"/>
-	<rdfs:seeAlso rdf:resource="http://www.ivan-herman.net/Misc/2008/owlrl/"/>
-</rdf:Description>
-<rdf:Description rdf:about="http://purl.org/NET/cpan-uri/dist/RDF-Closure/v_0-000_01">
-	<dc:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2011-03-14</dc:issued>
-	<doap:file-release rdf:resource="http://backpan.cpan.org/authors/id/T/TO/TOBYINK/RDF-Closure-0.000_01.tar.gz"/>
-	<doap:revision rdf:datatype="http://www.w3.org/2001/XMLSchema#string">0.000_01</doap:revision>
-	<rdf:type rdf:resource="http://usefulinc.com/ns/doap#Version"/>
-	<rdfs:label xml:lang="en">pi-day preview</rdfs:label>
-</rdf:Description>
-<rdf:Description rdf:about="http://purl.org/NET/cpan-uri/dist/RDF-Closure/v_0-000_02">
-	<dcs:changeset rdf:nodeID="rD17FF822609211E0959CABF143DF20D5r0"/>
-	<dc:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2011-03-27</dc:issued>
-	<doap:file-release rdf:resource="http://backpan.cpan.org/authors/id/T/TO/TOBYINK/RDF-Closure-0.000_02.tar.gz"/>
-	<doap:revision rdf:datatype="http://www.w3.org/2001/XMLSchema#string">0.000_02</doap:revision>
-	<rdf:type rdf:resource="http://usefulinc.com/ns/doap#Version"/>
-	<rdfs:label xml:lang="en">pre-hackathon release</rdfs:label>
-</rdf:Description>
-<rdf:Description rdf:about="http://purl.org/NET/cpan-uri/dist/RDF-Closure/v_0-000_03">
-	<dcs:changeset rdf:nodeID="rD17FF822609211E0959CABF143DF20D5r2"/>
-	<dc:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2011-04-06</dc:issued>
-	<doap:file-release rdf:resource="http://backpan.cpan.org/authors/id/T/TO/TOBYINK/RDF-Closure-0.000_03.tar.gz"/>
-	<doap:revision rdf:datatype="http://www.w3.org/2001/XMLSchema#string">0.000_03</doap:revision>
-	<rdf:type rdf:resource="http://usefulinc.com/ns/doap#Version"/>
-</rdf:Description>
-<rdf:Description xmlns:ns1="http://www.w3.org/2002/07/owl#" rdf:about="http://tobyinkster.co.uk/#i">
-	<rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person"/>
-	<ns1:sameAs rdf:resource="http://purl.org/NET/cpan-uri/person/tobyink"/>
-	<foaf:homepage rdf:resource="http://tobyinkster.co.uk/"/>
-	<foaf:mbox rdf:resource="mailto:tobyink@cpan.org"/>
-	<foaf:name>Toby Inkster</foaf:name>
-	<foaf:page rdf:resource="http://search.cpan.org/~tobyink/"/>
-</rdf:Description>
-<rdf:Description rdf:about="http://www.ivan-herman.net/foaf#me">
-	<rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person"/>
-	<foaf:homepage rdf:resource="http://www.ivan-herman.net/"/>
-	<foaf:name>Ivan Herman</foaf:name>
-	<foaf:workplaceHomepage rdf:resource="http://www.w3.org/"/>
-</rdf:Description>
-</rdf:RDF>

MANIFEST.SKIP

-^MANIFEST.bak$
-^Makefile.old$
-^Makefile$
-^blib/
-^pm_to_blib
-^blibdirs
-\.svn
-^example.*\.pl$
-^[^/]+\.(tar\.gz|tar\.bz2|tgz|tbz2|tbz|zip|tar)$
-^MYMETA.yml
-^lib-old
-^python
-^extra-tests

META.yml

----
-abstract: 'pure Perl RDF inferencing'
-author:
-  - 'Toby Inkster <tobyink@cpan.org>'
-build_requires:
-  ExtUtils::MakeMaker: 6.42
-  Test::More: 0.61
-configure_requires:
-  ExtUtils::MakeMaker: 6.42
-distribution_type: module
-generated_by: 'Module::Install version 1.00'
-keywords:
-  - RDF
-  - Reasoning
-  - Inference
-  - OWL
-  - RDFS
-  - Rules
-  - RL
-license: perl
-meta-spec:
-  url: http://module-build.sourceforge.net/META-spec-v1.4.html
-  version: 1.4
-name: RDF-Closure
-no_index:
-  directory:
-    - inc
-    - t
-requires:
-  Carp: 0
-  Data::UUID: 0
-  DateTime: 0
-  DateTime::Format::Strptime: 0
-  DateTime::Format::XSD: 0
-  DateTime::TimeZone: 0
-  Error: 0
-  Exporter: 0
-  MIME::Base64: 0
-  Math::BigInt: 0
-  Module::Pluggable: 0
-  Parse::RecDescent: 0
-  RDF::Trine: 0.133
-  Scalar::Util: 0
-  URI: 0
-  XML::LibXML: 0
-  common::sense: 0
-  namespace::clean: 0
-  perl: 5.8.0
-resources:
-  bugtracker: http://rt.cpan.org/Dist/Display.html?Queue=RDF-Closure
-  homepage: http://search.cpan.org/dist/RDF-Closure/
-  license: http://dev.perl.org/licenses/
-  repository: http://goddamn.co.uk/viewvc/perlmods/RDF-Closure/
-version: 0.000_04
-

README

-NAME
-    RDF::Closure - pure Perl RDF inferencing
-
-SYNOPSIS
-    @@TODO
-
-DESCRIPTION
-    This distribution is a pure Perl RDF inference engine designed as an
-    add-in for RDF::Trine. It is largely a port of Ivan Herman's Python
-    RDFClosure library, though there has been some restructuing, and there
-    are a few extras thrown in.
-
-    Where one of the Perl modules has a direct equivalent in Ivan's library,
-    this is noted in the POD.
-
-  Functions
-    This package inherits from RDF::Trine and exports the same functions,
-    plus:
-
-    *   "mk_filter($basic_filters, $ignore_contexts)"
-
-        Creates a filter (coderef) suitable for use with "sgrep" from
-        RDF::Trine::Iterator.
-
-        $basic_filters is an integer which can be assembled by
-        bitwise-OR-ing the constants "FLT_NONRDF" and "FLT_BORING".
-
-        $ignore_contexts is an arrayref of RDF::Trine::Node objects, each of
-        which represents a context that should be filtered out.
-
-          use RDF::Trine::Iterator qw[sgrep];
-          use RDF::Closure qw[iri mk_filter FLT_NONRDF FLT_BORING];
-  
-          my $foaf   = iri('http://xmlns.com/foaf/0.1/index.rdf');
-          my $filter = mk_filter(FLT_NONRDF|FLT_BORING, [$foaf]);
-  
-          my $remaining = &sgrep($filter, $model->as_stream);
-  
-          # $remaining is now an iterator which will return all triples
-          # from $model except: those in the FOAF named graph, those which
-          # are non-RDF (e.g. literal subject) and those which are boring.
-
-        Which triples are boring? Any triple of the form { ?x owl:sameAs ?x
-        .} is boring. Any triple where the subject, predicate and object
-        nodes are all in the RDF, RDFS, OWL or XSD namespaces is boring.
-        Other triples are not boring.
-
-SEE ALSO
-    RDF::Closure::Engine, RDF::Closure::Model, RDF::Trine::Parser::OwlFn.
-
-    RDF::Trine, RDF::Query.
-
-    <http://www.perlrdf.org/>.
-
-    <http://www.ivan-herman.net/Misc/2008/owlrl/>.
-
-AUTHOR
-    Toby Inkster <tobyink@cpan.org>.
-
-COPYRIGHT
-    Copyright 2011 Toby Inkster
-
-    This library is free software; you can redistribute it and/or modify it
-    under any of the following licences:
-
-    *   The Artistic License 1.0
-        <http://www.perlfoundation.org/artistic_license_1_0>.
-
-    *   The GNU General Public License Version 1
-        <http://www.gnu.org/licenses/old-licenses/gpl-1.0.txt>, or (at your
-        option) any later version.
-
-    *   The W3C Software Notice and License
-        <http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
-        >.
-
-    *   The Clarified Artistic License
-        <http://www.ncftp.com/ncftp/doc/LICENSE.txt>.
-

devel.old-lib/RDF/Closure.pm

+package RDF::Closure;
+
+
+
+1;

devel.old-lib/RDF/Closure/AxiomaticTriples.pm

+package RDF::Closure::AxiomaticTriples;
+
+use 5.008;
+use common::sense;
+
+use RDF::Trine qw[statement];
+use RDF::Trine::Namespace qw[RDF RDFS OWL XSD];
+
+use parent qw[Exporter];
+
+our @EXPORT = qw[];
+our @EXPORT_OK = qw[
+	$RDFS_Axiomatic_Triples 
+	$RDFS_D_Axiomatic_Triples_subclasses 
+	$RDFS_D_Axiomatic_Triples_types 
+	$RDFS_D_Axiomatic_Triples 
+	$OWLRL_Axiomatic_Triples   
+	$OWL_D_Axiomatic_Triples_subclasses 
+	$OWLRL_Datatypes_Disjointness 
+	$OWLRL_D_Axiomatic_Triples 
+	];
+
+#: Simple RDF axiomatic triples statement(typing of $RDF->subject, $RDF->predicate, $RDF->first, $RDF->rest, etc)
+our $_Simple_RDF_axiomatic_triples = [
+	statement($RDF->type, $RDF->type, $RDF->Property),
+	statement($RDF->subject, $RDF->type, $RDF->Property),
+	statement($RDF->predicate, $RDF->type, $RDF->Property),
+	statement($RDF->object, $RDF->type, $RDF->Property),
+	statement($RDF->first, $RDF->type, $RDF->Property),
+	statement($RDF->rest, $RDF->type, $RDF->Property),
+	statement($RDF->value, $RDF->type, $RDF->Property),
+	statement($RDF->nil, $RDF->type, $RDF->List),
+];
+
+#: RDFS axiomatic triples statement($RDFS->domain and $RDFS->range, as well as class setting for a number of RDFS symbols)
+our $_RDFS_axiomatic_triples = [
+	statement($RDF->type, $RDFS->domain, $RDFS->Resource),
+	statement($RDFS->domain, $RDFS->domain, $RDF->Property),
+	statement($RDFS->range, $RDFS->domain, $RDF->Property),
+	statement($RDFS->subPropertyOf, $RDFS->domain, $RDF->Property),
+	statement($RDFS->subClassOf, $RDFS->domain, $RDFS->Class),
+	statement($RDF->subject, $RDFS->domain, $RDF->Statement),
+	statement($RDF->predicate, $RDFS->domain, $RDF->Statement),
+	statement($RDF->object, $RDFS->domain, $RDF->Statement),
+	statement($RDFS->member, $RDFS->domain, $RDFS->Resource),
+	statement($RDF->first, $RDFS->domain, $RDF->List),
+	statement($RDF->rest, $RDFS->domain, $RDF->List),
+	statement($RDFS->seeAlso, $RDFS->domain, $RDFS->Resource),
+	statement($RDFS->isDefinedBy, $RDFS->domain, $RDFS->Resource),
+	statement($RDFS->comment, $RDFS->domain, $RDFS->Resource),
+	statement($RDFS->label, $RDFS->domain, $RDFS->Resource),
+	statement($RDF->value, $RDFS->domain, $RDFS->Resource),
+	statement($RDF->Property, $RDF->type, $RDFS->Class),
+
+	statement($RDF->type, $RDFS->range, $RDFS->Class),
+	statement($RDFS->domain, $RDFS->range, $RDFS->Class),
+	statement($RDFS->range, $RDFS->range, $RDFS->Class),
+	statement($RDFS->subPropertyOf, $RDFS->range, $RDF->Property),
+	statement($RDFS->subClassOf, $RDFS->range, $RDFS->Class),
+	statement($RDF->subject, $RDFS->range, $RDFS->Resource),
+	statement($RDF->predicate, $RDFS->range, $RDFS->Resource),
+	statement($RDF->object, $RDFS->range, $RDFS->Resource),
+	statement($RDFS->member, $RDFS->range, $RDFS->Resource),
+	statement($RDF->first, $RDFS->range, $RDFS->Resource),
+	statement($RDF->rest, $RDFS->range, $RDF->List),
+	statement($RDFS->seeAlso, $RDFS->range, $RDFS->Resource),
+	statement($RDFS->isDefinedBy, $RDFS->range, $RDFS->Resource),
+	statement($RDFS->comment, $RDFS->range, $RDFS->Literal),
+	statement($RDFS->label, $RDFS->range, $RDFS->Literal),
+	statement($RDF->value, $RDFS->range, $RDFS->Resource),
+
+	statement($RDF->Alt, $RDFS->subClassOf, $RDFS->Container),
+	statement($RDF->Bag, $RDFS->subClassOf, $RDFS->Container),
+	statement($RDF->Seq, $RDFS->subClassOf, $RDFS->Container),
+	statement($RDFS->ContainerMembershipProperty, $RDFS->subClassOf, $RDF->Property),
+
+	statement($RDFS->isDefinedBy, $RDFS->subPropertyOf, $RDFS->seeAlso),
+
+	statement($RDF->XMLLiteral, $RDF->type, $RDFS->Datatype),
+	statement($RDF->XMLLiteral, $RDFS->subClassOf, $RDFS->Literal),
+	statement($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
+	statement($RDFS->Resource, $RDF->type, $RDFS->Class),
+	statement($RDFS->Class, $RDF->type, $RDFS->Class),
+	statement($RDFS->Literal, $RDF->type, $RDFS->Class),
+	statement($RDF->XMLLiteral, $RDF->type, $RDFS->Class),
+	statement($RDFS->Datatype, $RDF->type, $RDFS->Class),
+	statement($RDF->Seq, $RDF->type, $RDFS->Class),
+	statement($RDF->Bag, $RDF->type, $RDFS->Class),
+	statement($RDF->Alt, $RDF->type, $RDFS->Class),
+	statement($RDFS->Container, $RDF->type, $RDFS->Class),
+	statement($RDF->List, $RDF->type, $RDFS->Class),
+	statement($RDFS->ContainerMembershipProperty, $RDF->type, $RDFS->Class),
+	statement($RDF->Property, $RDF->type, $RDFS->Class),
+	statement($RDF->Statement, $RDF->type, $RDFS->Class),
+
+	statement($RDFS->domain, $RDF->type, $RDF->Property),
+	statement($RDFS->range, $RDF->type, $RDF->Property),
+	statement($RDFS->subPropertyOf, $RDF->type, $RDF->Property),
+	statement($RDFS->subClassOf, $RDF->type, $RDF->Property),
+	statement($RDFS->member, $RDF->type, $RDF->Property),
+	statement($RDFS->seeAlso, $RDF->type, $RDF->Property),
+	statement($RDFS->isDefinedBy, $RDF->type, $RDF->Property),
+	statement($RDFS->comment, $RDF->type, $RDF->Property),
+	statement($RDFS->label, $RDF->type, $RDF->Property),
+];
+
+#: RDFS Axiomatic Triples all together
+our $RDFS_Axiomatic_Triples = [@$_Simple_RDF_axiomatic_triples, @$_RDFS_axiomatic_triples];
+
+#: RDFS D-entailement triples, ie, possible subclassing of various datatypes
+our $RDFS_D_Axiomatic_Triples_subclasses = [
+	# See http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#built-in-datatypes
+	statement($XSD->decimal, $RDFS->subClassOf, $RDFS->Literal),
+
+	statement($XSD->integer, $RDFS->subClassOf, $XSD->decimal),
+
+	statement($XSD->long, $RDFS->subClassOf, $XSD->integer),
+	statement($XSD->int, $RDFS->subClassOf, $XSD->long),
+	statement($XSD->short, $RDFS->subClassOf, $XSD->int),
+	statement($XSD->byte, $RDFS->subClassOf, $XSD->short),
+
+	statement($XSD->nonNegativeInteger, $RDFS->subClassOf, $XSD->integer),
+	statement($XSD->positiveInteger, $RDFS->subClassOf, $XSD->nonNegativeInteger),
+	statement($XSD->unsignedLong, $RDFS->subClassOf, $XSD->nonNegativeInteger),
+	statement($XSD->unsignedInt, $RDFS->subClassOf, $XSD->unsignedLong),
+	statement($XSD->unsignedShort, $RDFS->subClassOf, $XSD->unsignedInt),
+	statement($XSD->unsignedByte, $RDFS->subClassOf, $XSD->unsignedShort),
+
+	statement($XSD->nonPositiveInteger, $RDFS->subClassOf, $XSD->integer),
+	statement($XSD->negativeInteger, $RDFS->subClassOf, $XSD->nonPositiveInteger),
+
+	statement($XSD->normalizedString, $RDFS->subClassOf, $XSD->string),
+	statement($XSD->token, $RDFS->subClassOf, $XSD->normalizedString),
+	statement($XSD->language, $RDFS->subClassOf, $XSD->token),
+	statement($XSD->Name, $RDFS->subClassOf, $XSD->token),
+	statement($XSD->NMTOKEN, $RDFS->subClassOf, $XSD->token),
+
+	statement($XSD->NCName, $RDFS->subClassOf, $XSD->Name),
+
+	statement($XSD->dateTimeStamp, $RDFS->subClassOf, $XSD->dateTime),
+];
+
+our $RDFS_D_Axiomatic_Triples_types = [
+	statement($XSD->integer, $RDF->type, $RDFS->Datatype),
+	statement($XSD->decimal, $RDF->type, $RDFS->Datatype),
+	statement($XSD->nonPositiveInteger, $RDF->type, $RDFS->Datatype),
+	statement($XSD->nonPositiveInteger, $RDF->type, $RDFS->Datatype),
+	statement($XSD->positiveInteger, $RDF->type, $RDFS->Datatype),
+	statement($XSD->positiveInteger, $RDF->type, $RDFS->Datatype),
+	statement($XSD->long, $RDF->type, $RDFS->Datatype),
+	statement($XSD->int, $RDF->type, $RDFS->Datatype),
+	statement($XSD->short, $RDF->type, $RDFS->Datatype),
+	statement($XSD->byte, $RDF->type, $RDFS->Datatype),
+	statement($XSD->unsignedLong, $RDF->type, $RDFS->Datatype),
+	statement($XSD->unsignedInt, $RDF->type, $RDFS->Datatype),
+	statement($XSD->unsignedShort, $RDF->type, $RDFS->Datatype),
+	statement($XSD->unsignedByte, $RDF->type, $RDFS->Datatype),
+	statement($XSD->float, $RDF->type, $RDFS->Datatype),
+	statement($XSD->double, $RDF->type, $RDFS->Datatype),
+	statement($XSD->string, $RDF->type, $RDFS->Datatype),
+	statement($XSD->normalizedString, $RDF->type, $RDFS->Datatype),
+	statement($XSD->token, $RDF->type, $RDFS->Datatype),
+	statement($XSD->language, $RDF->type, $RDFS->Datatype),
+	statement($XSD->Name, $RDF->type, $RDFS->Datatype),
+	statement($XSD->NCName, $RDF->type, $RDFS->Datatype),
+	statement($XSD->NMTOKEN, $RDF->type, $RDFS->Datatype),
+	statement($XSD->boolean, $RDF->type, $RDFS->Datatype),
+	statement($XSD->hexBinary, $RDF->type, $RDFS->Datatype),
+	statement($XSD->base64Binary, $RDF->type, $RDFS->Datatype),
+	statement($XSD->anyURI, $RDF->type, $RDFS->Datatype),
+	statement($XSD->dateTimeStamp, $RDF->type, $RDFS->Datatype),
+	statement($XSD->dateTime, $RDF->type, $RDFS->Datatype),
+	statement($RDFS->Literal, $RDF->type, $RDFS->Datatype),
+	statement($RDF->XMLLiteral, $RDF->type, $RDFS->Datatype),
+];
+
+our $RDFS_D_Axiomatic_Triples = [@$RDFS_D_Axiomatic_Triples_types, @$RDFS_D_Axiomatic_Triples_subclasses];
+
+#: OWL $RDFS->Class axiomatic triples: definition of special classes
+our $_OWL_axiomatic_triples_Classes = [
+	statement($OWL->AllDifferent, $RDF->type, $RDFS->Class),
+	statement($OWL->AllDifferent, $RDFS->subClassOf, $RDFS->Resource),
+
+	statement($OWL->AllDisjointClasses, $RDF->type, $RDFS->Class),
+	statement($OWL->AllDisjointClasses, $RDFS->subClassOf, $RDFS->Resource),
+
+	statement($OWL->AllDisjointProperties, $RDF->type, $RDFS->Class),
+	statement($OWL->AllDisjointProperties, $RDFS->subClassOf, $RDFS->Resource),
+
+	statement($OWL->Annotation, $RDF->type, $RDFS->Class),
+	statement($OWL->Annotation, $RDFS->subClassOf, $RDFS->Resource),
+
+	statement($OWL->AnnotationProperty, $RDF->type, $RDFS->Class),
+	statement($OWL->AnnotationProperty, $RDFS->subClassOf, $RDF->Property),
+
+	statement($OWL->AsymmetricProperty, $RDF->type, $RDFS->Class),
+	statement($OWL->AsymmetricProperty, $RDFS->subClassOf, $RDF->Property),
+
+	statement($OWL->Class, $RDF->type, $RDFS->Class),
+	statement($OWL->Class, $OWL->equivalentClass, $RDFS->Class),
+
+#	statement($OWL->DataRange, $RDF->type, $RDFS->Class),
+#	statement($OWL->DataRange, $OWL->equivalentClass, $RDFS->Datatype),
+
+	statement($RDFS->Datatype, $RDF->type, $RDFS->Class),
+
+	statement($OWL->DatatypeProperty, $RDF->type, $RDFS->Class),
+	statement($OWL->DatatypeProperty, $RDFS->subClassOf, $RDF->Property),
+
+	statement($OWL->DeprecatedClass, $RDF->type, $RDFS->Class),
+	statement($OWL->DeprecatedClass, $RDFS->subClassOf, $RDFS->Class),
+
+	statement($OWL->DeprecatedProperty, $RDF->type, $RDFS->Class),
+	statement($OWL->DeprecatedProperty, $RDFS->subClassOf, $RDF->Property),
+
+	statement($OWL->FunctionalProperty, $RDF->type, $RDFS->Class),
+	statement($OWL->FunctionalProperty, $RDFS->subClassOf, $RDF->Property),
+
+	statement($OWL->InverseFunctionalProperty, $RDF->type, $RDFS->Class),
+	statement($OWL->InverseFunctionalProperty, $RDFS->subClassOf, $RDF->Property),
+
+	statement($OWL->IrreflexiveProperty, $RDF->type, $RDFS->Class),
+	statement($OWL->IrreflexiveProperty, $RDFS->subClassOf, $RDF->Property),
+
+	statement($RDFS->Literal, $RDF->type, $RDFS->Datatype),
+
+#	statement($OWL->NamedIndividual, $RDF->type, $RDFS->Class),
+#	statement($OWL->NamedIndividual, $OWL->equivalentClass, $RDFS->Resource),
+
+	statement($OWL->NegativePropertyAssertion, $RDF->type, $RDFS->Class),
+	statement($OWL->NegativePropertyAssertion, $RDFS->subClassOf, $RDFS->Resource),
+
+	statement($OWL->Nothing, $RDF->type, $RDFS->Class),
+	statement($OWL->Nothing, $RDFS->subClassOf, $OWL->Thing ),
+
+	statement($OWL->ObjectProperty, $RDF->type, $RDFS->Class),
+	statement($OWL->ObjectProperty, $OWL->equivalentClass, $RDF->Property),
+
+	statement($OWL->Ontology, $RDF->type, $RDFS->Class),
+	statement($OWL->Ontology, $RDFS->subClassOf, $RDFS->Resource),
+
+	statement($OWL->OntologyProperty, $RDF->type, $RDFS->Class),
+	statement($OWL->OntologyProperty, $RDFS->subClassOf, $RDF->Property),
+
+	statement($RDF->Property, $RDF->type, $RDFS->Class),
+
+	statement($OWL->ReflexiveProperty, $RDF->type, $RDFS->Class),
+	statement($OWL->ReflexiveProperty, $RDFS->subClassOf, $RDF->Property),
+
+	statement($OWL->Restriction, $RDF->type, $RDFS->Class),
+	statement($OWL->Restriction, $RDFS->subClassOf, $RDFS->Class),
+
+
+	statement($OWL->SymmetricProperty, $RDF->type, $RDFS->Class),
+	statement($OWL->SymmetricProperty, $RDFS->subClassOf, $RDF->Property),
+
+	statement($OWL->Thing, $RDF->type, $RDFS->Class),
+	statement($OWL->Thing, $RDFS->subClassOf, $RDFS->Resource),
+
+	statement($OWL->TransitiveProperty, $RDF->type, $RDFS->Class),
+	statement($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
+	statement($OWL->AllDisjointProperties, $RDF->type, $OWL->Class),
+	statement($OWL->AllDisjointClasses, $RDF->type, $OWL->Class),
+	statement($OWL->AllDisjointProperties, $RDF->type, $OWL->Class),
+	statement($OWL->Annotation, $RDF->type, $OWL->Class),
+	statement($OWL->AsymmetricProperty, $RDF->type, $OWL->Class),
+	statement($OWL->Axiom, $RDF->type, $OWL->Class),
+	statement($OWL->DataRange, $RDF->type, $OWL->Class),
+	statement($RDFS->Datatype, $RDF->type, $OWL->Class),
+	statement($OWL->DatatypeProperty, $RDF->type, $OWL->Class),
+	statement($OWL->DeprecatedClass, $RDF->type, $OWL->Class),
+	statement($OWL->DeprecatedClass, $RDFS->subClassOf, $OWL->Class),
+	statement($OWL->DeprecatedProperty, $RDF->type, $OWL->Class),
+	statement($OWL->FunctionalProperty, $RDF->type, $OWL->Class),
+	statement($OWL->InverseFunctionalProperty, $RDF->type, $OWL->Class),
+	statement($OWL->IrreflexiveProperty, $RDF->type, $OWL->Class),
+	statement($OWL->NamedIndividual, $RDF->type, $OWL->Class),
+	statement($OWL->NegativePropertyAssertion, $RDF->type, $OWL->Class),
+	statement($OWL->Nothing, $RDF->type, $OWL->Class),
+	statement($OWL->ObjectProperty, $RDF->type, $OWL->Class),
+	statement($OWL->Ontology, $RDF->type, $OWL->Class),
+	statement($OWL->OntologyProperty, $RDF->type, $OWL->Class),
+	statement($RDF->Property, $RDF->type, $OWL->Class),
+	statement($OWL->ReflexiveProperty, $RDF->type, $OWL->Class),
+	statement($OWL->Restriction, $RDF->type, $OWL->Class),
+	statement($OWL->Restriction, $RDFS->subClassOf, $OWL->Class),
+#	statement(SelfRestriction, $RDF->type, $OWL->Class),
+	statement($OWL->SymmetricProperty, $RDF->type, $OWL->Class),
+	statement($OWL->Thing, $RDF->type, $OWL->Class),
+	statement($OWL->TransitiveProperty, $RDF->type, $OWL->Class),
+];
+
+#: OWL $RDF->Property axiomatic triples: definition of domains and ranges
+our $_OWL_axiomatic_triples_Properties = [
+	statement($OWL->allValuesFrom, $RDF->type, $RDF->Property),
+	statement($OWL->allValuesFrom, $RDFS->domain, $OWL->Restriction),
+	statement($OWL->allValuesFrom, $RDFS->range, $RDFS->Class),
+
+	statement($OWL->assertionProperty, $RDF->type, $RDF->Property),
+	statement($OWL->assertionProperty, $RDFS->domain, $OWL->NegativePropertyAssertion),
+	statement($OWL->assertionProperty, $RDFS->range, $RDF->Property),
+
+	statement($OWL->backwardCompatibleWith, $RDF->type, $OWL->OntologyProperty),
+	statement($OWL->backwardCompatibleWith, $RDF->type, $OWL->AnnotationProperty),
+	statement($OWL->backwardCompatibleWith, $RDFS->domain, $OWL->Ontology),
+	statement($OWL->backwardCompatibleWith, $RDFS->range, $OWL->Ontology),
+
+#	statement($OWL->bottomDataProperty, $RDF->type, DatatypeProperty),
+#
+#	statement($OWL->bottomObjectProperty, $RDF->type, ObjectProperty),
+
+#	statement($OWL->cardinality, $RDF->type, $RDF->Property),
+#	statement($OWL->cardinality, $RDFS->domain, $OWL->Restriction),
+#	statement($OWL->cardinality, $RDFS->range, $XSD->nonNegativeInteger),
+
+	statement($RDFS->comment, $RDF->type, $OWL->AnnotationProperty),
+	statement($RDFS->comment, $RDFS->domain, $RDFS->Resource),
+	statement($RDFS->comment, $RDFS->range, $RDFS->Literal),
+
+	statement($OWL->complementOf, $RDF->type, $RDF->Property),
+	statement($OWL->complementOf, $RDFS->domain, $RDFS->Class),
+	statement($OWL->complementOf, $RDFS->range, $RDFS->Class),
+
+#
+#	statement($OWL->datatypeComplementOf, $RDF->type, $RDF->Property),
+#	statement($OWL->datatypeComplementOf, $RDFS->domain, $RDFS->Datatype),
+#	statement($OWL->datatypeComplementOf, $RDFS->range, $RDFS->Datatype),
+
+	statement($OWL->deprecated, $RDF->type, $OWL->AnnotationProperty),
+	statement($OWL->deprecated, $RDFS->domain, $RDFS->Resource),
+	statement($OWL->deprecated, $RDFS->range, $RDFS->Resource),
+
+	statement($OWL->differentFrom, $RDF->type, $RDF->Property),
+	statement($OWL->differentFrom, $RDFS->domain, $RDFS->Resource),
+	statement($OWL->differentFrom, $RDFS->range, $RDFS->Resource),
+
+#	statement($OWL->disjointUnionOf, $RDF->type, $RDF->Property),
+#	statement($OWL->disjointUnionOf, $RDFS->domain, $RDFS->Class),
+#	statement($OWL->disjointUnionOf, $RDFS->range, $RDF->List),
+
+	statement($OWL->disjointWith, $RDF->type, $RDF->Property),
+	statement($OWL->disjointWith, $RDFS->domain, $RDFS->Class),
+	statement($OWL->disjointWith, $RDFS->range, $RDFS->Class),
+
+	statement($OWL->distinctMembers, $RDF->type, $RDF->Property),
+	statement($OWL->distinctMembers, $RDFS->domain, $OWL->AllDifferent),
+	statement($OWL->distinctMembers, $RDFS->range, $RDF->List),
+
+	statement($OWL->equivalentClass, $RDF->type, $RDF->Property),
+	statement($OWL->equivalentClass, $RDFS->domain, $RDFS->Class),
+	statement($OWL->equivalentClass, $RDFS->range, $RDFS->Class),
+
+	statement($OWL->equivalentProperty, $RDF->type, $RDF->Property),
+	statement($OWL->equivalentProperty, $RDFS->domain, $RDF->Property),
+	statement($OWL->equivalentProperty, $RDFS->range, $RDF->Property),
+
+	statement($OWL->hasKey, $RDF->type, $RDF->Property),
+	statement($OWL->hasKey, $RDFS->domain, $RDFS->Class),
+	statement($OWL->hasKey, $RDFS->range, $RDF->List),
+
+	statement($OWL->hasValue, $RDF->type, $RDF->Property),
+	statement($OWL->hasValue, $RDFS->domain, $OWL->Restriction),
+	statement($OWL->hasValue, $RDFS->range, $RDFS->Resource),
+
+	statement($OWL->imports, $RDF->type, $OWL->OntologyProperty),
+	statement($OWL->imports, $RDFS->domain, $OWL->Ontology),
+	statement($OWL->imports, $RDFS->range, $OWL->Ontology),
+
+	statement($OWL->incompatibleWith, $RDF->type, $OWL->OntologyProperty),
+	statement($OWL->incompatibleWith, $RDF->type, $OWL->AnnotationProperty),
+	statement($OWL->incompatibleWith, $RDFS->domain, $OWL->Ontology),
+	statement($OWL->incompatibleWith, $RDFS->range, $OWL->Ontology),
+
+	statement($OWL->intersectionOf, $RDF->type, $RDF->Property),
+	statement($OWL->intersectionOf, $RDFS->domain, $RDFS->Class),
+	statement($OWL->intersectionOf, $RDFS->range, $RDF->List),
+
+	statement($OWL->inverseOf, $RDF->type, $RDF->Property),
+	statement($OWL->inverseOf, $RDFS->domain, $RDF->Property),
+	statement($OWL->inverseOf, $RDFS->range, $RDF->Property),
+
+	statement($RDFS->isDefinedBy, $RDF->type, $OWL->AnnotationProperty),
+	statement($RDFS->isDefinedBy, $RDFS->domain, $RDFS->Resource),
+	statement($RDFS->isDefinedBy, $RDFS->range, $RDFS->Resource),
+
+	statement($RDFS->label, $RDF->type, $OWL->AnnotationProperty),
+	statement($RDFS->label, $RDFS->domain, $RDFS->Resource),
+	statement($RDFS->label, $RDFS->range, $RDFS->Literal),
+
+	statement($OWL->maxCardinality, $RDF->type, $RDF->Property),
+	statement($OWL->maxCardinality, $RDFS->domain, $OWL->Restriction),
+	statement($OWL->maxCardinality, $RDFS->range, $XSD->nonNegativeInteger),
+
+	statement($OWL->maxQualifiedCardinality, $RDF->type, $RDF->Property),
+	statement($OWL->maxQualifiedCardinality, $RDFS->domain, $OWL->Restriction),
+	statement($OWL->maxQualifiedCardinality, $RDFS->range, $XSD->nonNegativeInteger),
+
+	statement($OWL->members, $RDF->type, $RDF->Property),
+	statement($OWL->members, $RDFS->domain, $RDFS->Resource),
+	statement($OWL->members, $RDFS->range, $RDF->List),
+
+#	statement($OWL->minCardinality, $RDF->type, $RDF->Property),
+#	statement($OWL->minCardinality, $RDFS->domain, $OWL->Restriction),
+#	statement($OWL->minCardinality, $RDFS->range, $XSD->nonNegativeInteger),
+
+#	statement($OWL->minQualifiedCardinality, $RDF->type, $RDF->Property),
+#	statement($OWL->minQualifiedCardinality, $RDFS->domain, $OWL->Restriction),
+#	statement($OWL->minQualifiedCardinality, $RDFS->range, $XSD->nonNegativeInteger),
+
+#	statement($OWL->annotatedTarget, $RDF->type, $RDF->Property),
+#	statement($OWL->annotatedTarget, $RDFS->domain, $RDFS->Resource),
+#	statement($OWL->annotatedTarget, $RDFS->range, $RDFS->Resource),
+
+	statement($OWL->onClass, $RDF->type, $RDF->Property),
+	statement($OWL->onClass, $RDFS->domain, $OWL->Restriction),
+	statement($OWL->onClass, $RDFS->range, $RDFS->Class),
+
+#	statement($OWL->onDataRange, $RDF->type, $RDF->Property),
+#	statement($OWL->onDataRange, $RDFS->domain, $OWL->Restriction),
+#	statement($OWL->onDataRange, $RDFS->range, $RDFS->Datatype),
+
+	statement($OWL->onDatatype, $RDF->type, $RDF->Property),
+	statement($OWL->onDatatype, $RDFS->domain, $RDFS->Datatype),
+	statement($OWL->onDatatype, $RDFS->range, $RDFS->Datatype),
+
+	statement($OWL->oneOf, $RDF->type, $RDF->Property),
+	statement($OWL->oneOf, $RDFS->domain, $RDFS->Class),
+	statement($OWL->oneOf, $RDFS->range, $RDF->List),
+
+	statement($OWL->onProperty, $RDF->type, $RDF->Property),
+	statement($OWL->onProperty, $RDFS->domain, $OWL->Restriction),
+	statement($OWL->onProperty, $RDFS->range, $RDF->Property),
+
+#	statement($OWL->onProperties, $RDF->type, $RDF->Property),
+#	statement($OWL->onProperties, $RDFS->domain, $OWL->Restriction),
+#	statement($OWL->onProperties, $RDFS->range, $RDF->List),
+
+#	statement($OWL->annotatedProperty, $RDF->type, $RDF->Property),
+#	statement($OWL->annotatedProperty, $RDFS->domain, $RDFS->Resource),
+#	statement($OWL->annotatedProperty, $RDFS->range, $RDF->Property),
+
+	statement($OWL->priorVersion, $RDF->type, $OWL->OntologyProperty),
+	statement($OWL->priorVersion, $RDF->type, $OWL->AnnotationProperty),
+	statement($OWL->priorVersion, $RDFS->domain, $OWL->Ontology),
+	statement($OWL->priorVersion, $RDFS->range, $OWL->Ontology),
+
+	statement($OWL->propertyChainAxiom, $RDF->type, $RDF->Property),
+	statement($OWL->propertyChainAxiom, $RDFS->domain, $RDF->Property),
+	statement($OWL->propertyChainAxiom, $RDFS->range, $RDF->List),
+
+#	statement($OWL->propertyDisjointWith, $RDF->type, $RDF->Property),
+#	statement($OWL->propertyDisjointWith, $RDFS->domain, $RDF->Property),
+#	statement($OWL->propertyDisjointWith, $RDFS->range, $RDF->Property),
+#
+#	statement($OWL->qualifiedCardinality, $RDF->type, $RDF->Property),
+#	statement($OWL->qualifiedCardinality, $RDFS->domain, $OWL->Restriction),
+#	statement($OWL->qualifiedCardinality, $RDFS->range, $XSD->nonNegativeInteger),
+
+	statement($OWL->sameAs, $RDF->type, $RDF->Property),
+	statement($OWL->sameAs, $RDFS->domain, $RDFS->Resource),
+	statement($OWL->sameAs, $RDFS->range, $RDFS->Resource),
+
+	statement($RDFS->seeAlso, $RDF->type, $OWL->AnnotationProperty),
+	statement($RDFS->seeAlso, $RDFS->domain, $RDFS->Resource),
+	statement($RDFS->seeAlso, $RDFS->range, $RDFS->Resource),
+
+	statement($OWL->someValuesFrom, $RDF->type, $RDF->Property),
+	statement($OWL->someValuesFrom, $RDFS->domain, $OWL->Restriction),
+	statement($OWL->someValuesFrom, $RDFS->range, $RDFS->Class),
+
+	statement($OWL->sourceIndividual, $RDF->type, $RDF->Property),
+	statement($OWL->sourceIndividual, $RDFS->domain, $OWL->NegativePropertyAssertion),
+	statement($OWL->sourceIndividual, $RDFS->range, $RDFS->Resource),
+#
+#	statement($OWL->annotatedSource, $RDF->type, $RDF->Property),
+#	statement($OWL->annotatedSource, $RDFS->domain, $RDFS->Resource),
+#	statement($OWL->annotatedSource, $RDFS->range, $RDFS->Resource),
+#
+	statement($OWL->targetIndividual, $RDF->type, $RDF->Property),
+	statement($OWL->targetIndividual, $RDFS->domain, $OWL->NegativePropertyAssertion),
+	statement($OWL->targetIndividual, $RDFS->range, $RDFS->Resource),
+
+	statement($OWL->targetValue, $RDF->type, $RDF->Property),
+	statement($OWL->targetValue, $RDFS->domain, $OWL->NegativePropertyAssertion),
+	statement($OWL->targetValue, $RDFS->range, $RDFS->Literal),
+
+#	statement($OWL->topDataProperty, $RDF->type, DatatypeProperty),
+#	statement($OWL->topDataProperty, $RDFS->domain, $RDFS->Resource),
+#	statement($OWL->topDataProperty, $RDFS->range, $RDFS->Literal),
+#
+#	statement($OWL->topObjectProperty, $RDF->type, ObjectProperty),
+#	statement($OWL->topObjectProperty, $RDFS->domain, $RDFS->Resource),
+#	statement($OWL->topObjectProperty, $RDFS->range, $RDFS->Resource),
+
+	statement($OWL->unionOf, $RDF->type, $RDF->Property),
+	statement($OWL->unionOf, $RDFS->domain, $RDFS->Class),
+	statement($OWL->unionOf, $RDFS->range, $RDF->List),
+
+	statement($OWL->versionInfo, $RDF->type, $OWL->AnnotationProperty),
+	statement($OWL->versionInfo, $RDFS->domain, $RDFS->Resource),
+	statement($OWL->versionInfo, $RDFS->range, $RDFS->Resource),
+
+	statement($OWL->versionIRI, $RDF->type, $OWL->AnnotationProperty),
+	statement($OWL->versionIRI, $RDFS->domain, $RDFS->Resource),
+	statement($OWL->versionIRI, $RDFS->range, $RDFS->Resource),
+
+	statement($OWL->withRestrictions, $RDF->type, $RDF->Property),
+	statement($OWL->withRestrictions, $RDFS->domain, $RDFS->Datatype),
+	statement($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
+	statement($OWL->allValuesFrom, $RDFS->range, $OWL->Class),
+	statement($OWL->complementOf, $RDFS->domain, $OWL->Class),
+	statement($OWL->complementOf, $RDFS->range, $OWL->Class),
+
+#	statement($OWL->datatypeComplementOf, $RDFS->domain, $OWL->DataRange),
+#	statement($OWL->datatypeComplementOf, $RDFS->range, $OWL->DataRange),
+	statement($OWL->disjointUnionOf, $RDFS->domain, $OWL->Class),
+	statement($OWL->disjointWith, $RDFS->domain, $OWL->Class),
+	statement($OWL->disjointWith, $RDFS->range, $OWL->Class),
+	statement($OWL->equivalentClass, $RDFS->domain, $OWL->Class),
+	statement($OWL->equivalentClass, $RDFS->range, $OWL->Class),
+	statement($OWL->hasKey, $RDFS->domain, $OWL->Class),
+	statement($OWL->intersectionOf, $RDFS->domain, $OWL->Class),
+	statement($OWL->onClass, $RDFS->range, $OWL->Class),
+#	statement($OWL->onDataRange, $RDFS->range, $OWL->DataRange),
+	statement($OWL->onDatatype, $RDFS->domain, $OWL->DataRange),
+	statement($OWL->onDatatype, $RDFS->range, $OWL->DataRange),
+	statement($OWL->oneOf, $RDFS->domain, $OWL->Class),
+	statement($OWL->someValuesFrom, $RDFS->range, $OWL->Class),
+	statement($OWL->unionOf, $RDFS->range, $OWL->Class),
+#	statement($OWL->withRestrictions, $RDFS->domain, $OWL->DataRange)
+];
+
+#: OWL RL axiomatic triples: combination of the RDFS triples plus the OWL specific ones
+our $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...:-)
+our $_OWL_axiomatic_triples_Facets = [
+	# langPattern
+	statement($XSD->length,$RDF->type,$RDF->Property),
+	statement($XSD->maxExclusive,$RDF->type,$RDF->Property),
+	statement($XSD->maxInclusive,$RDF->type,$RDF->Property),
+	statement($XSD->maxLength,$RDF->type,$RDF->Property),
+	statement($XSD->minExclusive,$RDF->type,$RDF->Property),
+	statement($XSD->minInclusive,$RDF->type,$RDF->Property),
+	statement($XSD->minLength,$RDF->type,$RDF->Property),
+	statement($XSD->pattern,$RDF->type,$RDF->Property),
+
+	statement($XSD->length,$RDFS->domain,$RDFS->Resource),
+	statement($XSD->maxExclusive,$RDFS->domain,$RDFS->Resource),
+	statement($XSD->maxInclusive,$RDFS->domain,$RDFS->Resource),
+	statement($XSD->maxLength,$RDFS->domain,$RDFS->Resource),
+	statement($XSD->minExclusive,$RDFS->domain,$RDFS->Resource),
+	statement($XSD->minInclusive,$RDFS->domain,$RDFS->Resource),
+	statement($XSD->minLength,$RDFS->domain,$RDFS->Resource),
+	statement($XSD->pattern,$RDFS->domain,$RDFS->Resource),
+	statement($XSD->length,$RDFS->domain,$RDFS->Resource),
+
+	statement($XSD->maxExclusive,$RDFS->range,$RDFS->Literal),
+	statement($XSD->maxInclusive,$RDFS->range,$RDFS->Literal),
+	statement($XSD->maxLength,$RDFS->range,$RDFS->Literal),
+	statement($XSD->minExclusive,$RDFS->range,$RDFS->Literal),
+	statement($XSD->minInclusive,$RDFS->range,$RDFS->Literal),
+	statement($XSD->minLength,$RDFS->range,$RDFS->Literal),
+	statement($XSD->pattern,$RDFS->range,$RDFS->Literal),
+];
+
+#: OWL D-entailement triples statement(additionally to the RDFS ones), ie, possible subclassing of various extra datatypes
+our $_OWL_D_Axiomatic_Triples_types = [
+	statement($RDF->PlainLiteral, $RDF->type, $RDFS->Datatype)
+];
+
+our $OWL_D_Axiomatic_Triples_subclasses = [
+	statement($XSD->string, $RDFS->subClassOf, $RDF->PlainLiteral),
+	statement($XSD->normalizedString, $RDFS->subClassOf, $RDF->PlainLiteral),
+	statement($XSD->token, $RDFS->subClassOf, $RDF->PlainLiteral),
+	statement($XSD->Name, $RDFS->subClassOf, $RDF->PlainLiteral),
+	statement($XSD->NCName, $RDFS->subClassOf, $RDF->PlainLiteral),
+	statement($XSD->NMTOKEN, $RDFS->subClassOf, $RDF->PlainLiteral)
+];
+
+our $OWLRL_Datatypes_Disjointness = [
+	statement($XSD->anyURI, $OWL->disjointWith, $XSD->base64Binary),
+	statement($XSD->anyURI, $OWL->disjointWith, $XSD->boolean),
+	statement($XSD->anyURI, $OWL->disjointWith, $XSD->dateTime),
+	statement($XSD->anyURI, $OWL->disjointWith, $XSD->decimal),
+	statement($XSD->anyURI, $OWL->disjointWith, $XSD->double),
+	statement($XSD->anyURI, $OWL->disjointWith, $XSD->float),
+	statement($XSD->anyURI, $OWL->disjointWith, $XSD->hexBinary),
+	statement($XSD->anyURI, $OWL->disjointWith, $XSD->string),
+	statement($XSD->anyURI, $OWL->disjointWith, $RDF->PlainLiteral),
+	statement($XSD->anyURI, $OWL->disjointWith, $RDF->XMLLiteral),
+
+	statement($XSD->base64Binary, $OWL->disjointWith, $XSD->boolean),
+	statement($XSD->base64Binary, $OWL->disjointWith, $XSD->dateTime),
+	statement($XSD->base64Binary, $OWL->disjointWith, $XSD->decimal),
+	statement($XSD->base64Binary, $OWL->disjointWith, $XSD->double),
+	statement($XSD->base64Binary, $OWL->disjointWith, $XSD->float),
+	statement($XSD->base64Binary, $OWL->disjointWith, $XSD->hexBinary),
+	statement($XSD->base64Binary, $OWL->disjointWith, $XSD->string),
+	statement($XSD->base64Binary, $OWL->disjointWith, $RDF->PlainLiteral),
+	statement($XSD->base64Binary, $OWL->disjointWith, $RDF->XMLLiteral),
+
+	statement($XSD->boolean, $OWL->disjointWith, $XSD->dateTime),
+	statement($XSD->boolean, $OWL->disjointWith, $XSD->decimal),
+	statement($XSD->boolean, $OWL->disjointWith, $XSD->double),
+	statement($XSD->boolean, $OWL->disjointWith, $XSD->float),
+	statement($XSD->boolean, $OWL->disjointWith, $XSD->hexBinary),
+	statement($XSD->boolean, $OWL->disjointWith, $XSD->string),
+	statement($XSD->boolean, $OWL->disjointWith, $RDF->PlainLiteral),
+	statement($XSD->boolean, $OWL->disjointWith, $RDF->XMLLiteral),
+
+	statement($XSD->dateTime, $OWL->disjointWith, $XSD->decimal),
+	statement($XSD->dateTime, $OWL->disjointWith, $XSD->double),
+	statement($XSD->dateTime, $OWL->disjointWith, $XSD->float),
+	statement($XSD->dateTime, $OWL->disjointWith, $XSD->hexBinary),
+	statement($XSD->dateTime, $OWL->disjointWith, $XSD->string),
+	statement($XSD->dateTime, $OWL->disjointWith, $RDF->PlainLiteral),
+	statement($XSD->dateTime, $OWL->disjointWith, $RDF->XMLLiteral),
+
+	statement($XSD->decimal, $OWL->disjointWith, $XSD->double),
+	statement($XSD->decimal, $OWL->disjointWith, $XSD->float),
+	statement($XSD->decimal, $OWL->disjointWith, $XSD->hexBinary),
+	statement($XSD->decimal, $OWL->disjointWith, $XSD->string),
+	statement($XSD->decimal, $OWL->disjointWith, $RDF->PlainLiteral),
+	statement($XSD->decimal, $OWL->disjointWith, $RDF->XMLLiteral),
+
+	statement($XSD->double, $OWL->disjointWith, $XSD->float),
+	statement($XSD->double, $OWL->disjointWith, $XSD->hexBinary),
+	statement($XSD->double, $OWL->disjointWith, $XSD->string),
+	statement($XSD->double, $OWL->disjointWith, $RDF->PlainLiteral),
+	statement($XSD->double, $OWL->disjointWith, $RDF->XMLLiteral),
+
+	statement($XSD->float, $OWL->disjointWith, $XSD->hexBinary),
+	statement($XSD->float, $OWL->disjointWith, $XSD->string),
+	statement($XSD->float, $OWL->disjointWith, $RDF->PlainLiteral),
+	statement($XSD->float, $OWL->disjointWith, $RDF->XMLLiteral),
+
+	statement($XSD->hexBinary, $OWL->disjointWith, $XSD->string),
+	statement($XSD->hexBinary, $OWL->disjointWith, $RDF->PlainLiteral),
+	statement($XSD->hexBinary, $OWL->disjointWith, $RDF->XMLLiteral),
+
+	statement($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
+our $OWLRL_D_Axiomatic_Triples = [@$RDFS_D_Axiomatic_Triples, @$_OWL_D_Axiomatic_Triples_types, @$OWL_D_Axiomatic_Triples_subclasses, @$OWLRL_Datatypes_Disjointness];
+
+1;

devel.old-lib/RDF/Closure/Core.pm

+package RDF::Closure::Core;
+
+use 5.008;
+use common::sense;
+
+use Data::UUID;
+use Error qw[:try];
+use RDF::Trine;
+use RDF::Trine::Namespace qw[RDF RDFS OWL XSD];
+
+use constant {
+	TRUE    => 1,
+	FALSE   => 0,
+	};
+
+our $debugGlobal = FALSE;
+
+use namespace::clean;
+
+# TOBYINK: addition
+sub new
+{
+	my ($class, @args) = @_;
+	my $self = bless {}, $class;
+	return $self->__init__(@args);
+}
+
+sub __init__
+{
+	my ($self, $graph, $axioms, $daxioms, $rdfs) = @_;
+	$rdfs = FALSE unless defined $rdfs;
+	
+	$self->{_debug} = $debugGlobal;
+
+	# Calculate the maximum 'n' value for the '_i' type predicates (see Horst's paper)	
+	# TOBYINK - this seems like a poor technique. better to just grep all statements to
+	#           find the highest one?
+	{
+		my $n      = 0;
+		my $maxnum = 0;
+		my $cont   = TRUE;
+		while ($cont)
+		{
+			$cont = FALSE;
+			my $predicate = $RDF->uri(sprintf('_%d', $n));
+			if ($graph->count_statements(undef, $predicate, undef))
+			{
+				$maxnum = $n++;
+				$cont   = TRUE;
+			}
+		}
+		$self->{IMaxNum} = $maxnum;
+	}
+	
+	$self->{graph}   = $graph;
+	$self->{axioms}  = $axioms;
+	$self->{daxioms} = $daxioms;
+	$self->{rdfs}    = $rdfs;
+	$self->{error_messages} = [];
+	$self->empty_stored_triples;
+	
+	# TOBYINK: addition
+	{
+		my $uuid      = Data::UUID->new;
+		my $throwaway = sub {
+			RDF::Trine::Node::Resource->new(sprintf('urn:uuid:%s', $uuid->create_str));
+			};
+		$self->{error_context}    = $throwaway->();
+		$self->{inferred_context} = $throwaway->();
+		$self->{imported_context} = $throwaway->();
+		$self->{axiom_context}    = $throwaway->();
+		$self->{daxiom_context}   = $throwaway->();
+		$self->{uri_generator}    = $throwaway;
+	}
+	
+	return $self;
+}
+
+# TOBYINK: addition
+sub graph
+{
+	my ($self) = @_;
+	return $self->{graph};
+}
+
+sub add_error
+{
+	my ($self, $message) = @_;
+	
+	printf("** %s\n", $message)
+		if $self->{_debug};
+	
+	push @{ $self->{error_messages} }, $message
+		unless grep { $message eq $_ } @{ $self->{error_messages} };
+		
+	return $self;
+}
+
+sub pre_process
+{
+	my ($self) = @_;
+	return $self;
+}
+
+sub post_process
+{
+	my ($self) = @_;
+	return $self;
+}
+
+sub rules
+{
+	my ($self, $t, $cycle_num) = @_;
+	throw Error "This method should not be called directly; subclasses should override it.";
+}
+
+sub add_axioms
+{
+	my ($self) = @_;
+	throw Error "This method should not be called directly; subclasses should override it.";
+}
+
+sub add_daxioms
+{
+	my ($self) = @_;
+	throw Error "This method should not be called directly; subclasses should override it.";
+}
+
+sub one_time_rules
+{
+	my ($self) = @_;
+	return $self;
+}
+
+sub get_literal_value
+{
+	my ($self, $node) = @_;
+	
+	return $node->literal_value if $node->is_literal;
+	return '????';
+}
+
+sub empty_stored_triples
+{
+	my ($self) = @_;
+	$self->{added_triples} = [];
+	return $self;
+}
+
+sub flush_stored_triples
+{
+	my ($self) = @_;
+	
+	$self->graph->add_statement($_, $self->{inferred_context})
+		foreach @{ $self->{added_triples} };
+	
+	$self->empty_stored_triples;
+}
+
+sub store_triple
+{
+	my $self = shift;
+	if ($_[0]->isa('RDF::Trine::Statement'))
+	{
+		foreach (@_)
+		{
+			next if $self->graph->count_statements($_->subject, $_->predicate, $_->object);
+			printf("%s\n", $_->sse) if $self->{_debug};
+			push @{ $self->{added_triples} }, $_;
+		}
+	}
+	else
+	{
+		my $st = RDF::Trine::Statement->new(@_);
+		return $self->store_triple($st);
+	}
+	return $self;
+}
+
+sub closure
+{
+	my ($self) = @_;
+	
+	$self->pre_process;
+	$self->add_axioms    if $self->{axioms};
+	$self->add_daxioms   if $self->{daxioms};
+	$self->flush_stored_triples;
+	$self->one_time_rules;
+	$self->flush_stored_triples;
+	
+	my $new_cycle = TRUE;
+	my $cycle_num = 0;
+	my $error_messages = [];
+	while ($new_cycle)
+	{
+		$cycle_num++;
+		printf("----- Cycle #%d\n", $cycle_num) if $self->{_debug};
+		
+		my $iterator = $self->graph->get_statements;
+		while (my $t = $iterator->next)
+		{
+			$self->rules($t, $cycle_num);
+		}
+		$new_cycle = scalar @{ $self->{added_triples} };
+		$self->flush_stored_triples;
+	}
+
+	$self->post_process;
+	$self->flush_stored_triples;
+	
+	my $ERRNS = RDF::Trine::Namespace->new("http://www.daml.org/2002/03/agents/agent-ont#");
+	foreach my $m (@{ $self->{error_messages} })
+	{
+		my $message = RDF::Trine::Node::Blank->new;
+		$self->graph->add_statement(
+			RDF::Trine::Statement->new($message, $RDF->type, $ERRNS->ErrorMessage),
+			$self->{error_context},
+			);
+		$self->graph->add_statement(
+			RDF::Trine::Statement->new($message, $ERRNS->error, RDF::Trine::Node::Literal->new($message, 'en')),
+			$self->{error_context},
+			);
+	}
+
+	return $self;
+}
+
+1;

devel.old-lib/RDF/Closure/OWL2RL.pm

+package RDF::Closure::OWL2RL;
+
+use 5.008;
+use common::sense;
+
+use Error qw[:try];
+use RDF::Trine qw[statement iri];
+use RDF::Trine::Namespace qw[RDF RDFS OWL XSD];
+use RDF::Closure::AxiomaticTriples qw[
+	$OWLRL_Datatypes_Disjointness
+	$OWLRL_Axiomatic_Triples
+	$OWLRL_D_Axiomatic_Triples
+	];
+use RDF::Closure::XsdDatatypes qw[
+	$OWL_RL_Datatypes
+	$OWL_Datatype_Subsumptions
+	];
+use Scalar::Util qw[blessed];
+
+use constant {
+	TRUE    => 1,
+	FALSE   => 0,
+	};
+use namespace::clean;
+
+use parent qw[RDF::Closure::Core];
+
+our $OWLRL_Annotation_properties = [
+	$OWL->label,
+	$OWL->comment,
+	$OWL->seeAlso,
+	$OWL->isDefinedBy,
+	$OWL->deprecated,
+	$OWL->versionInfo,
+	$OWL->priorVersion,
+	$OWL->backwardCompatibleWith,
+	$OWL->incompatibleWith,
+	];
+
+sub __init__
+{
+	my ($self, @args) = @_;
+	$self->SUPER::__init__(@args);
+	$self->{bnodes} = [];
+	return $self;
+}
+
+sub _list
+{
+	my ($self, $l) = @_;
+	return [ $self->graph->get_list($l) ];
+}
+
+sub _get_resource_or_literal
+{
+	my ($self, $node) = @_;
+	$node; # ????
+}
+
+sub post_process
+{
+	# Python version removes bnode predicate triples, but I'm going to keep them.
+}
+
+sub add_axioms
+{
+	my ($self) = @_;
+	$self->graph->add_statement($_) foreach @$OWLRL_Axiomatic_Triples;
+}
+
+sub add_daxioms
+{
+	my ($self) = @_;
+	$self->graph->add_statement($_) foreach @$OWLRL_D_Axiomatic_Triples;
+}
+
+sub _one_time_rules_datatypes
+{
+	my ($self) = @_;
+	
+	my $implicit = {};
+	my $explicit = {};
+	my $used_datatypes = {};
+	
+	local *_add_to_explicit = sub
+	{
+		my ($s, $o) = map { $_->sse } @_;
+		$explicit->{$s} = {}
+			unless exists $explicit->{$s};
+		$explicit->{$s}{$o}++;
+	};
+
+	local *_append_to_explicit = sub
+	{
+		my ($s, $o) = map { $_->sse } @_;
+		$explicit->{$s} = []
+			unless exists $explicit->{$s};
+		for my $d (keys %{ $explicit->{$o} })
+		{
+			$explicit->{$s}{$d}++;
+		}
+	};
+	
+	local *_add_to_used_datatypes = sub
+	{
+		my ($d) = @_;
+		$d = $d->uri if blessed($d);
+		$used_datatypes->{$d}++;
+	};
+	
+	local *_handle_subsumptions = sub
+	{
+		my ($r, $dt) = @_;
+		if (exists $OWL_Datatype_Subsumptions->{$dt})
+		{
+			foreach my $new_dt (@{ $OWL_Datatype_Subsumptions->{$dt} })
+			{
+				$self->store_triple($r, $RDF->type, $new_dt);
+				$self->store_triple($new_dt, $RDF->type, $RDFS->Datatype);
+				_add_to_used_datatypes($new_dt);
+			}
+		}
+	};
+	
+	my %literals;
+	$self->graph->get_statements->each(sub
+	{
+		my $st    = shift;
+		my @nodes = $st->nodes;
+		foreach my $lt (@nodes[0..2])
+		{
+			next unless $lt->is_literal;
+			# We're now effectively in a foreach literal loop...
+			
+			$literals{ $lt->sse }++;
+			
+			next unless $lt->has_datatype;
+			next unless grep { $_->uri eq $lt->literal_datatype } @$OWL_RL_Datatypes;
+			
+			# RULE dt-type2
+			$self->store_triple($lt, $RDF->type, iri($lt->literal_datatype));
+			$implicit->{ $lt->sse } = $lt->literal_datatype
+				unless exists $implicit->{ $lt->sse };
+			_add_to_used_datatypes($lt->literal_datatype);
+			
+			# RULE dt-not-type
+			$self->add_error("Literal's lexical value and datatype do not match: (%s,%s)",
+				$lt->literal_value, $lt->literal_datatype)
+				if 0; # @@TODO: check literal value is valid for datatype
+		}
+	});
+	
+	# RULE dt-diff
+	# RULE dt-eq
+	foreach my $lt1 (keys %literals)
+	{
+		foreach my $lt2 (keys %literals)
+		{
+			if ($lt1 ne $lt2)
+			{
+				$lt1 = RDF::Trine::Node->from_sse($lt1);
+				$lt2 = RDF::Trine::Node->from_sse($lt2);
+				
+				if (0) # @@TODO: check if literal values are equivalent
+				{
+					$self->store_triple($lt1, $OWL->sameAs, $lt2);
+				}
+				else
+				{
+					$self->store_triple($lt1, $OWL->differentFrom, $lt2);
+				}
+			}
+		}
+	}
+	
+	# this next bit catches triples like { [] a xsd:string . }
+	$self->graph->get_statements(undef, $RDF->type, undef)->each(sub {
+		my $st = shift;
+		my ($s, $p, $o) = ($st->subject, $st->predicate, $st->object);
+		if (grep { $_->uri eq $o->uri; } @$OWL_RL_Datatypes)
+		{
+			_add_to_used_datatypes($o);
+			_add_to_explicit($s, $o)
+				unless exists $implicit->{ $s->sse };
+		}
+	});
+
+	$self->graph->get_statements(undef, $OWL->sameAs, undef)->each(sub {
+		my $st = shift;
+		my ($s, $p, $o) = ($st->subject, $st->predicate, $st->object);
+		_append_to_explicit($s, $o) if exists $explicit->{$o};
+		_append_to_explicit($o, $s) if exists $explicit->{$s};
+	});
+	
+	foreach my $dt (@$OWL_RL_Datatypes)
+	{
+		$self->store_triple($dt, $RDF->type, $RDFS->Datatype);
+	}
+	foreach my $dts (values %$explicit)
+	{
+		foreach my $dt (values %$dts)
+		{
+			$self->store_triple($dt, $RDF->type, $RDFS->Datatype);
+		}
+	}
+	
+	foreach my $r (keys %$explicit)
+	{
+		my @dtypes = values %{ $explicit->{$r} };
+		$r = RDF::Trine::Node->from_sse($r);
+		foreach my $dt (@dtypes)
+		{
+			_handle_subsumptions($r, $dt);
+		}
+	}
+	
+	foreach my $r (keys %$implicit)
+	{
+		my $dt = $implicit->{$r};
+		$r = RDF::Trine::Node->from_sse($r);
+		_handle_subsumptions($r, $dt);
+	}
+	
+	foreach my $t (@$OWLRL_Datatypes_Disjointness)
+	{
+		my ($l, $r) = ($t->subject, $t->object);
+		$self->store_triple($t)
+			if exists $used_datatypes->{$l->uri}
+			&& exists $used_datatypes->{$r->uri};
+	}
+
+	return $self;
+}
+
+sub _one_time_rules_misc
+{
+	my ($self) = @_;
+	
+	# 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
+	$self->store_triple($_, $RDF->type, $OWL->AnnotationProperty)
+		foreach @$OWLRL_Annotation_properties;
+
+	return $self;
+}
+
+sub one_time_rules
+{
+	return $_[0]
+		->_one_time_rules_misc
+		->_one_time_rules_datatypes;
+}
+
+sub rules
+{
+	my ($self, $t, $cycle_num) = @_;
+	# @@TODO
+	return $self;
+}
+
+1;

devel.old-lib/RDF/Closure/RDFS.pm

+package RDF::Closure::RDFS;
+
+use 5.008;
+use common::sense;
+
+use Error qw[:try];
+use RDF::Trine qw[statement iri];
+use RDF::Trine::Namespace qw[RDF RDFS OWL XSD];
+use RDF::Closure::AxiomaticTriples qw[$RDFS_Axiomatic_Triples $RDFS_D_Axiomatic_Triples];
+
+use constant {
+	TRUE    => 1,
+	FALSE   => 0,
+	};
+use namespace::clean;
+
+use parent qw[RDF::Closure::Core];
+
+sub add_axioms
+{
+	my ($self) = @_;
+	
+	$self->graph->add_statement($_, $self->{axiom_context})
+		foreach @$RDFS_Axiomatic_Triples;
+	
+	for my $i (1 .. $self->{IMaxNum}+1)
+	{
+		my $ci = $RDF->uri(sprintf('_%d', $i));
+		$self->graph->add_statement(statement($ci, $RDF->type, $RDF->Property, $self->{axiom_context}));
+		$self->graph->add_statement(statement($ci, $RDF->type, $RDFS->ContainerMembershipProperty, $self->{axiom_context}));
+		$self->graph->add_statement(statement($ci, $RDFS->domain, $RDFS->Resource, $self->{axiom_context}));
+		$self->graph->add_statement(statement($ci, $RDF->range, $RDFS->Resource, $self->{axiom_context}));
+	}
+}
+
+sub add_daxioms
+{
+	my ($self) = @_;
+	
+	$self->graph->add_statement($_, $self->{daxiom_context})
+		foreach @$RDFS_D_Axiomatic_Triples;
+	
+	$self->graph->get_statements->each(sub{
+		my $st = shift;
+		foreach my $node ($st->nodes)
+		{
+			if ($node->is_literal and $node->has_datatype)
+			{
+				$self->graph->add_statement(statement(
+					$node,
+					$RDF->type,
+					iri($node->literal_datatype),
+					));
+			}
+		}
+	});
+}
+
+sub one_time_rules
+{
+	my ($self) = @_;
+}
+
+sub rules
+{
+	my ($self, $t, $cycle_num) = @_;
+	
+	my ($s, $p, $o) = $t->nodes;
+	
+	# rdf1
+	$self->store_triple($p, $RDF->type, $RDF->Property);
+	
+	# rdfs4a
+	$self->store_triple($s, $RDF->type, $RDFS->Resource)
+		if $cycle_num == 1;
+
+	# rdfs4b
+	$self->store_triple($o, $RDF->type, $RDFS->Resource)
+		if $cycle_num == 1;
+	
+	if ($p->equal($RDFS->domain))
+	{
+		# rdfs2
+		my $iter = $self->graph->get_statements(undef, $s, undef);
+		while (my $st = $iter->next)
+		{
+			$self->store_triple($st->subject, $RDF->type, $o);
+		}
+	}
+	
+	elsif ($p->equal($RDFS->range))
+	{
+		# rdfs3
+		my $iter = $self->graph->get_statements(undef, $s, undef);
+		while (my $st = $iter->next)
+		{
+			$self->store_triple($st->object, $RDF->type, $o);
+		}
+	}
+
+	elsif ($p->equal($RDFS->subPropertyOf))
+	{
+		# rdfs5
+		my $iter = $self->graph->get_statements($o, $RDFS->subPropertyOf, undef);
+		while (my $st = $iter->next)
+		{
+			$self->store_triple($s, $RDFS->subPropertyOf, $st->object);
+		}
+		
+		# rdfs7
+		my $iter = $self->graph->get_statements(undef, $s, undef);
+		while (my $st = $iter->next)
+		{
+			$self->store_triple($st->subject, $o, $st->object);
+		}
+	}