1 19 20 package com.hp.hpl.jena.reasoner.dig; 23 24 25 import java.util.Iterator ; 28 29 30 import com.hp.hpl.jena.graph.*; 31 import com.hp.hpl.jena.graph.Triple; 32 import com.hp.hpl.jena.reasoner.TriplePattern; 33 import com.hp.hpl.jena.reasoner.rulesys.Node_RuleVariable; 34 import com.hp.hpl.jena.util.iterator.*; 35 import com.hp.hpl.jena.vocabulary.RDF; 36 37 38 39 52 public class DIGQueryRoleHierarchyTranslator 53 extends DIGIteratedQueryTranslator 54 { 55 56 59 62 65 66 67 70 74 public DIGQueryRoleHierarchyTranslator( String predicate ) { 75 super( ALL, predicate, ALL ); 76 } 77 78 79 82 87 protected Iterator expandQuery( TriplePattern pattern, DIGAdapter da ) { 88 final Node pred = pattern.getPredicate(); 89 90 return new DIGQueryAllRolesTranslator( null, null ) 92 .find( new TriplePattern( null, RDF.type.asNode(), null ), da ) 93 .mapWith( new Map1() { 94 public Object map1( Object x ) { 95 Triple triple = (Triple) x; 96 return new TriplePattern( triple.getSubject(), pred, Node_RuleVariable.WILD ); 97 } 98 } ); 99 } 100 101 102 103 106 110 } 111 112 113 139 | Popular Tags |