1 19 20 package com.hp.hpl.jena.ontology.impl; 23 24 25 26 import com.hp.hpl.jena.enhanced.*; 29 import com.hp.hpl.jena.graph.*; 30 import com.hp.hpl.jena.ontology.*; 31 import com.hp.hpl.jena.rdf.model.*; 32 import com.hp.hpl.jena.vocabulary.*; 33 34 import java.util.*; 35 36 37 47 public class RDFSProfile 48 extends AbstractProfile 49 { 50 53 56 59 62 65 public String NAMESPACE() { return RDFS.getURI(); } 66 67 public Resource CLASS() { return RDFS.Class; } 68 public Resource RESTRICTION() { return null; } 69 public Resource THING() { return null; } 70 public Resource NOTHING() { return null; } 71 public Resource PROPERTY() { return RDF.Property; } 72 public Resource OBJECT_PROPERTY() { return null; } 73 public Resource DATATYPE_PROPERTY() { return null; } 74 public Resource TRANSITIVE_PROPERTY() { return null; } 75 public Resource SYMMETRIC_PROPERTY() { return null; } 76 public Resource FUNCTIONAL_PROPERTY() { return null; } 77 public Resource INVERSE_FUNCTIONAL_PROPERTY() { return null; } 78 public Resource ALL_DIFFERENT() { return null; } 79 public Resource ONTOLOGY() { return null; } 80 public Resource DEPRECATED_CLASS() { return null; } 81 public Resource DEPRECATED_PROPERTY() { return null; } 82 public Resource ANNOTATION_PROPERTY() { return null; } 83 public Resource ONTOLOGY_PROPERTY() { return null; } 84 public Resource LIST() { return RDF.List; } 85 public Resource NIL() { return RDF.nil; } 86 public Resource DATARANGE() { return null; } 87 88 89 public Property EQUIVALENT_PROPERTY() { return null; } 90 public Property EQUIVALENT_CLASS() { return null; } 91 public Property DISJOINT_WITH() { return null; } 92 public Property SAME_INDIVIDUAL_AS() { return null; } 93 public Property SAME_AS() { return null; } 94 public Property DIFFERENT_FROM() { return null; } 95 public Property DISTINCT_MEMBERS() { return null; } 96 public Property UNION_OF() { return null; } 97 public Property INTERSECTION_OF() { return null; } 98 public Property COMPLEMENT_OF() { return null; } 99 public Property ONE_OF() { return null; } 100 public Property ON_PROPERTY() { return null; } 101 public Property ALL_VALUES_FROM() { return null; } 102 public Property HAS_VALUE() { return null; } 103 public Property SOME_VALUES_FROM() { return null; } 104 public Property MIN_CARDINALITY() { return null; } 105 public Property MAX_CARDINALITY() { return null; } 106 public Property CARDINALITY() { return null; } 107 public Property INVERSE_OF() { return null; } 108 public Property IMPORTS() { return null; } 109 public Property PRIOR_VERSION() { return null; } 110 public Property BACKWARD_COMPATIBLE_WITH() { return null; } 111 public Property INCOMPATIBLE_WITH() { return null; } 112 public Property SUB_PROPERTY_OF() { return RDFS.subPropertyOf; } 113 public Property SUB_CLASS_OF() { return RDFS.subClassOf; } 114 public Property DOMAIN() { return RDFS.domain; } 115 public Property RANGE() { return RDFS.range; } 116 public Property FIRST() { return RDF.first; } 117 public Property REST() { return RDF.rest; } 118 public Property MIN_CARDINALITY_Q() { return null; } 119 public Property MAX_CARDINALITY_Q() { return null; } 120 public Property CARDINALITY_Q() { return null; } 121 public Property HAS_CLASS_Q() { return null; } 122 123 public Property VERSION_INFO() { return null; } 125 public Property LABEL() { return RDFS.label; } 126 public Property COMMENT() { return RDFS.comment; } 127 public Property SEE_ALSO() { return RDFS.seeAlso; } 128 public Property IS_DEFINED_BY() { return RDFS.isDefinedBy; } 129 130 131 protected Resource[][] aliasTable() { 132 return new Resource[][] { 133 {} 134 }; 135 } 136 137 138 public Iterator getAxiomTypes() { 139 return Arrays.asList( 140 new Resource[] { 141 } 142 ).iterator(); 143 } 144 145 146 public Iterator getAnnotationProperties() { 147 return Arrays.asList( 148 new Resource[] { 149 RDFS.label, 150 RDFS.seeAlso, 151 RDFS.comment, 152 RDFS.isDefinedBy 153 } 154 ).iterator(); 155 } 156 157 public Iterator getClassDescriptionTypes() { 158 return Arrays.asList( 159 new Resource[] { 160 RDFS.Class } 161 ).iterator(); 162 } 163 164 165 180 public boolean isSupported( Node n, EnhGraph g, Class type ) { 181 if (g instanceof OntModel) { 182 OntModel m = (OntModel) g; 183 184 if (!m.strictMode()) { 185 return true; 187 } 188 else { 189 SupportsCheck check = (SupportsCheck) s_supportsChecks.get( type ); 191 192 return (check == null) || check.doCheck( n, g ); 194 } 195 } 196 else { 197 return false; 198 } 199 } 200 201 207 public String getLabel() { 208 return "RDFS"; 209 } 210 211 214 215 219 220 protected static class SupportsCheck 221 { 222 public boolean doCheck( Node n, EnhGraph g ) { 223 return true; 224 } 225 } 226 227 228 231 private static Object [][] s_supportsCheckTable = new Object [][] { 232 { OntClass.class, new SupportsCheck() { 234 public boolean doCheck( Node n, EnhGraph g ) { 235 return g.asGraph().contains( n, RDF.type.asNode(), RDFS.Class.asNode() ) || 236 n.equals( RDFS.Resource.asNode() ) || 238 g.asGraph().contains( Node.ANY, RDFS.domain.asNode(), n ) || 239 g.asGraph().contains( Node.ANY, RDFS.range.asNode(), n ) 240 ; 241 } 242 } 243 }, 244 { RDFList.class, new SupportsCheck() { 245 public boolean doCheck( Node n, EnhGraph g ) { 246 return n.equals( RDF.nil.asNode() ) || 247 g.asGraph().contains( n, RDF.type.asNode(), RDF.List.asNode() ); 248 } 249 } 250 }, 251 { OntProperty.class, new SupportsCheck() { 252 public boolean doCheck( Node n, EnhGraph g ) { 253 return g.asGraph().contains( n, RDF.type.asNode(), RDF.Property.asNode() ); 254 } 255 } 256 }, 257 }; 258 259 260 263 264 protected static HashMap s_supportsChecks = new HashMap(); 265 266 static { 267 for (int i = 0; i < s_supportsCheckTable.length; i++) { 269 s_supportsChecks.put( s_supportsCheckTable[i][0], s_supportsCheckTable[i][1] ); 270 } 271 } 272 273 277 } 278 279 280 309 | Popular Tags |