1 10 package com.hp.hpl.jena.reasoner.rulesys.impl; 11 12 import com.hp.hpl.jena.reasoner.rulesys.*; 13 import com.hp.hpl.jena.reasoner.*; 14 import com.hp.hpl.jena.graph.*; 15 import com.hp.hpl.jena.vocabulary.RDF; 16 import com.hp.hpl.jena.vocabulary.RDFS; 17 import com.hp.hpl.jena.util.iterator.ExtendedIterator; 18 19 import java.util.*; 20 21 28 public class RDFSCMPPreprocessHook implements RulePreprocessHook { 29 30 41 public void run(FBRuleInfGraph infGraph, Finder dataFind, Graph inserts) { 42 ExtendedIterator it = dataFind.find(new TriplePattern(null, null, null)); 43 HashSet properties = new HashSet(); 44 String memberPrefix = RDF.getURI() + "_"; 45 while (it.hasNext()) { 46 Triple triple = (Triple)it.next(); 47 Node prop = triple.getPredicate(); 48 if (prop.equals(RDF.type.getNode()) && prop.equals(RDF.Property.getNode()) ) { 49 prop = triple.getSubject(); 50 } 51 if (properties.add(prop)) { 52 if (prop.getURI().startsWith(memberPrefix)) { 53 inserts.add(new Triple(prop, RDF.type.getNode(), RDFS.ContainerMembershipProperty.getNode())); 55 } 56 } 57 } 58 } 59 60 } 61 62 63 64 | Popular Tags |