1 10 package com.hp.hpl.jena.reasoner.rdfsReasoner1; 11 12 import com.hp.hpl.jena.reasoner.*; 13 import com.hp.hpl.jena.reasoner.transitiveReasoner.TransitiveReasoner; 14 import com.hp.hpl.jena.rdf.model.*; 15 import com.hp.hpl.jena.rdf.model.impl.PropertyImpl; 16 import com.hp.hpl.jena.vocabulary.*; 17 18 27 public class RDFSReasonerFactory implements ReasonerFactory { 28 29 30 private static ReasonerFactory theInstance = new RDFSReasonerFactory(); 31 32 33 public static final String URI = "http://jena.hpl.hp.com/2003/RDFSReasoner1"; 34 35 36 protected Model capabilities; 37 38 40 public static final Property scanProperties = new PropertyImpl(URI+"#", "scanProperties"); 41 42 45 public static ReasonerFactory theInstance() { 46 return theInstance; 47 } 48 49 55 public Reasoner create(Resource configuration) { 56 return new RDFSReasoner(configuration); 57 } 58 59 64 public Model getCapabilities() { 65 if (capabilities == null) { 66 capabilities = ModelFactory.createDefaultModel(); 67 Resource base = capabilities.createResource(getURI()); 68 base.addProperty(ReasonerVocabulary.nameP, "RDFS Reasoner 1") 69 .addProperty(ReasonerVocabulary.descriptionP, "Complete RDFS implementation supporting metalevel statements.\n" 70 + "Eager caching of schema information, back chaining for most entailments\n" 71 + "Can separate tbox and abox data if desired to reuse tbox caching or mix them.") 72 .addProperty(ReasonerVocabulary.configurationP, scanProperties) 73 .addProperty(ReasonerVocabulary.supportsP, RDFS.subClassOf) 74 .addProperty(ReasonerVocabulary.supportsP, RDFS.subPropertyOf) 75 .addProperty(ReasonerVocabulary.supportsP, RDFS.member) 76 .addProperty(ReasonerVocabulary.supportsP, RDFS.range) 77 .addProperty(ReasonerVocabulary.supportsP, RDFS.domain) 78 .addProperty(ReasonerVocabulary.supportsP, TransitiveReasoner.directSubClassOf) 79 .addProperty(ReasonerVocabulary.supportsP, TransitiveReasoner.directSubPropertyOf) 80 .addProperty(ReasonerVocabulary.versionP, "0.1"); 81 } 82 return capabilities; 83 } 84 85 88 public String getURI() { 89 return URI; 90 } 91 92 95 public static void main(String [] args) { 96 Resource rdfsDescr = ReasonerRegistry.theRegistry().getDescription(URI); 97 System.out.println("Reasoner: " + rdfsDescr); 98 for (StmtIterator i = rdfsDescr.listProperties(); i.hasNext(); ) { 99 Statement s = i.nextStatement(); 100 System.out.println(s.getPredicate().getLocalName() + " = " + s.getObject()); 101 } 102 } 103 } 104 105 134 135 | Popular Tags |