001: /*
002: * Copyright Aduna (http://www.aduna-software.com/) (c) 1997-2006.
003: *
004: * Licensed under the Aduna BSD-style license.
005: */
006: package org.openrdf.sail.inferencer.fc;
007:
008: /**
009: * Constants representing the RDF+RDFS entailment rules from the RDF Semantics
010: * W3C Recommendation (10 February 2004).
011: * See http://www.w3.org/TR/2004/REC-rdf-mt-20040210/
012: *
013: * Each entailment rule in the specification has either one or two premises. To allow
014: * the inferencer to distinguish triggering of rules for both premises, entailment rules
015: * that have two premises are represented by two separate constants, one for each premise.
016: *
017: * An additional entailment rule, X1, is added to capture list membership property assertions.
018: */
019: class RDFSRules {
020:
021: /** rule rdf1:
022: * xxx aaa yyy --> aaa rdf:type rdf:Property
023: */
024: public static final int Rdf1 = 0;
025:
026: /** rule rdfs2_1:
027: * xxx aaa yyy && (nt)
028: * aaa rdfs:domain zzz --> (t1)
029: * xxx rdf:type zzz (t2)
030: */
031: public static final int Rdfs2_1 = 1;
032:
033: /** rule rdfs2_2:
034: * aaa rdfs:domain zzz && (nt)
035: * xxx aaa yyy --> (t1)
036: * xxx rdf:type zzz (t2)
037: */
038: public static final int Rdfs2_2 = 2;
039:
040: /** rule rdfs3_1:
041: * xxx aaa uuu && (nt)
042: * aaa rdfs:range zzz --> (t1)
043: * uuu rdf:type zzz (t2)
044: */
045: public static final int Rdfs3_1 = 3;
046:
047: /** rule rdfs3_2.
048: * aaa rdfs:range zzz && (nt)
049: * xxx aaa uuu --> (t1)
050: * uuu rdf:type zzz (t2)
051: */
052: public static final int Rdfs3_2 = 4;
053:
054: /** rule rdfs4a:
055: * xxx aaa yyy --> xxx rdf:type rdfs:Resource
056: */
057: public static final int Rdfs4a = 5;
058:
059: /** rule rdfs4b:
060: * xxx aaa uuu --> uuu rdf:type rdfs:Resource
061: */
062: public static final int Rdfs4b = 6;
063:
064: /** rule rdfs5_1:
065: * aaa rdfs:subPropertyOf bbb && (nt)
066: * bbb rdfs:subPropertyOf ccc --> (t1)
067: * aaa rdfs:subPropertyOf ccc (t2)
068: *
069: * transitivity of rdfs:subPropertyOf
070: */
071: public static final int Rdfs5_1 = 7;
072:
073: /** rule rdfs5_2:
074: * bbb rdfs:subPropertyOf ccc && (nt)
075: * aaa rdfs:subPropertyOf bbb --> (t1)
076: * aaa rdfs:subPropertyOf ccc (t2)
077: *
078: * transitivity of rdfs:subPropertyOf
079: */
080: public static final int Rdfs5_2 = 8;
081:
082: /** rule rdfs6:
083: * xxx rdf:type rdf:Property --> xxx rdfs:subPropertyOf xxx
084: *
085: * reflexivity of rdfs:subPropertyOf
086: */
087: public static final int Rdfs6 = 9;
088:
089: /** rule rdfs7_1:
090: * xxx aaa yyy && (nt)
091: * aaa rdfs:subPropertyOf bbb --> (t1)
092: * xxx bbb yyy (t2)
093: */
094: public static final int Rdfs7_1 = 10;
095:
096: /** rule rdfs7_2:
097: * aaa rdfs:subPropertyOf bbb && (nt)
098: * xxx aaa yyy --> (t1)
099: * xxx bbb yyy (t2)
100: */
101: public static final int Rdfs7_2 = 11;
102:
103: /** rule rdfs8:
104: * xxx rdf:type rdfs:Class --> xxx rdfs:subClassOf rdfs:Resource
105: */
106: public static final int Rdfs8 = 12;
107:
108: /** rule rdfs9_1:
109: * xxx rdfs:subClassOf yyy && (nt)
110: * aaa rdf:type xxx --> (t1)
111: * aaa rdf:type yyy (t2)
112: */
113: public static final int Rdfs9_1 = 13;
114:
115: /** rule rdfs9_2:
116: * aaa rdf:type xxx && (nt)
117: * xxx rdfs:subClassOf yyy --> (t1)
118: * aaa rdf:type yyy (t2)
119: */
120: public static final int Rdfs9_2 = 14;
121:
122: /** rule rdfs10:
123: * xxx rdf:type rdfs:Class --> xxx rdfs:subClassOf xxx
124: *
125: * reflexivity of rdfs:subClassOf
126: */
127: public static final int Rdfs10 = 15;
128:
129: /** rule rdfs11_1:
130: * xxx rdfs:subClassOf yyy && (nt)
131: * yyy rdfs:subClassOf zzz --> (t1)
132: * xxx rdfs:subClassOf zzz (t2)
133: *
134: * transitivity of rdfs:subClassOf
135: */
136: public static final int Rdfs11_1 = 16;
137:
138: /** rule rdfs11_2:
139: * yyy rdfs:subClassOf zzz && (nt)
140: * xxx rdfs:subClassOf yyy --> (t1)
141: * xxx rdfs:subClassOf zzz (t2)
142: *
143: * transitivity of rdfs:subClassOf
144: */
145: public static final int Rdfs11_2 = 17;
146:
147: /** rule rdfs12:
148: * xxx rdf:type rdfs:ContainerMembershipProperty -->
149: * xxx rdfs:subPropertyOf rdfs:member
150: */
151: public static final int Rdfs12 = 18;
152:
153: /** rule rdfs13:
154: * xxx rdf:type rdfs:Datatype --> xxx rdfs:subClassOf rdfs:Literal
155: */
156: public static final int Rdfs13 = 19;
157:
158: /** rule X1:
159: * xxx rdf:_* yyy -->
160: * rdf:_* rdf:type rdfs:ContainerMembershipProperty
161: *
162: * This is an extra rule for list membership properties (_1, _2, _3,
163: * ...). The RDF Semantics Recommendation does not specificy a production for this, instead
164: * these statements are considered axiomatic. Since it is an infinite set it can not, in practice,
165: * be asserted axiomatically.
166: */
167: public static final int RX1 = 20;
168:
169: public static final int RULECOUNT = 21;
170:
171: public static final String[] RULENAMES = { " Rdf1", " Rdfs2_1",
172: " Rdfs2_2", " Rdfs3_1", " Rdfs3_2", " Rdfs4a", " Rdfs4b",
173: "Rdfs5_1", "Rdfs5_2", " Rdfs6", " Rdfs7_1", " Rdfs7_2",
174: " Rdfs8", " Rdfs9_1", " Rdfs9_2", " Rdfs10", " Rdfs11_1",
175: " Rdfs11_2", " Rdfs12", " Rdfs13", " RX1" };
176:
177: private static final boolean _ = false;
178:
179: private static final boolean X = true;
180:
181: /**
182: * Table of triggers for entailment rules. Each column represents the triggers for
183: * an entailment rule R, that is, it encodes which entailment rules produces statements
184: * that can be used as a premise in rule R.
185: *
186: * Example: the conclusion of rule rdfs2_1 is a statement of the form: (xxx rdf:type yyy).
187: * The premise of rule rdfs9_2 is (xxx rdf:type yyy). Hence, rule rdfs2_1 triggers rule
188: * rdfs9_2.
189: */
190: public static final boolean[][] TRIGGERS = {
191: // 1 2_2 3_2 4b 5_2 7_1 8 9_2 11_1 12 X1
192: // 2_1 3_1 4a 5_1 6 7_2 9_1 10 11_2 13
193: { _, X, _, X, _, X, _, _, _, X, X, _, _, _, X, _, _, _, _,
194: _, _ },// 1
195: { _, X, _, X, _, _, _, _, _, X, X, _, X, _, X, X, _, _, X,
196: X, _ },// 2_1
197: { _, X, _, X, _, _, _, _, _, X, X, _, X, _, X, X, _, _, X,
198: X, _ },// 2_2
199: { _, X, _, X, _, _, _, _, _, X, X, _, X, _, X, X, _, _, X,
200: X, _ },// 3_1
201: { _, X, _, X, _, _, _, _, _, X, X, _, X, _, X, X, _, _, X,
202: X, _ },// 3_2
203: { _, X, _, X, _, _, _, _, _, _, X, _, _, _, X, _, _, _, _,
204: _, _ },// 4a
205: { _, X, _, X, _, _, _, _, _, _, X, _, _, _, X, _, _, _, _,
206: _, _ },// 4b
207: { _, _, _, _, _, _, _, X, X, _, X, X, _, _, _, _, _, _, _,
208: _, _ },// 51
209: { _, _, _, _, _, _, _, X, X, _, X, X, _, _, _, _, _, _, _,
210: _, _ },// 52
211: { _, X, _, X, _, _, _, _, _, _, X, X, _, _, _, _, _, _, _,
212: _, _ },// 6
213: { _, X, X, X, X, _, _, X, X, X, X, X, X, X, X, X, X, X, X,
214: X, X },// 7_1
215: { _, X, X, X, X, _, _, X, X, X, X, X, X, X, X, X, X, X, X,
216: X, X },// 7_2
217: { _, X, _, X, _, _, _, _, _, _, X, _, _, X, _, _, X, X, _,
218: _, _ },// 8
219: { _, _, _, X, _, _, _, _, _, X, X, _, X, _, X, X, _, _, X,
220: X, _ },// 9_1
221: { _, _, _, X, _, _, _, _, _, X, X, _, X, _, X, X, _, _, X,
222: X, _ },// 9_2
223: { _, X, _, X, _, _, _, _, _, _, X, _, _, _, _, _, _, _, _,
224: _, _ },// 10
225: { _, _, _, _, _, _, _, _, _, _, X, _, _, X, _, _, X, X, _,
226: _, _ },// 11_1
227: { _, _, _, _, _, _, _, _, _, _, X, _, _, X, _, _, X, X, _,
228: _, _ },// 11_2
229: { _, X, _, X, _, _, X, X, X, _, X, X, _, _, _, _, _, _, _,
230: _, _ },// 12
231: { _, X, _, X, _, _, _, _, _, _, X, _, _, X, _, _, X, X, _,
232: _, _ },// 13
233: { _, X, _, X, _, _, _, _, _, _, X, _, _, _, X, _, _, _, X,
234: _, _ },// X1
235: };
236: }
|