1 19 20 package com.hp.hpl.jena.reasoner.dig; 23 24 25 import org.w3c.dom.*; 28 29 import com.hp.hpl.jena.rdf.model.Model; 30 import com.hp.hpl.jena.reasoner.TriplePattern; 31 import com.hp.hpl.jena.util.iterator.*; 32 33 34 35 47 public class DIGQueryInstancesTranslator 48 extends DIGQueryTranslator 49 { 50 51 54 57 60 61 64 68 public DIGQueryInstancesTranslator( String predicate ) { 69 super( ALL, predicate, null ); 70 } 71 72 73 76 77 80 public Document translatePattern( TriplePattern pattern, DIGAdapter da ) { 81 DIGConnection dc = da.getConnection(); 82 Document query = dc.createDigVerb( DIGProfile.ASKS, da.getProfile() ); 83 84 Element instances = da.createQueryElement( query, DIGProfile.INSTANCES ); 85 da.addClassDescription( instances, pattern.getObject() ); 86 87 return query; 88 } 89 90 94 public Document translatePattern( TriplePattern pattern, DIGAdapter da, Model premises ) { 95 DIGConnection dc = da.getConnection(); 96 Document query = dc.createDigVerb( DIGProfile.ASKS, da.getProfile() ); 97 98 Element instances = da.createQueryElement( query, DIGProfile.INSTANCES ); 99 100 if (pattern.getObject().isBlank()) { 101 da.addClassDescription( instances, pattern.getObject(), premises ); 102 } 103 else { 104 da.addClassDescription( instances, pattern.getObject() ); 105 } 106 107 return query; 108 } 109 110 113 public ExtendedIterator translateResponseHook( Document response, TriplePattern query, DIGAdapter da ) { 114 return translateIndividualSetResponse( response, query, false ); 116 } 117 118 119 public boolean checkObject( com.hp.hpl.jena.graph.Node object, DIGAdapter da, Model premises ) { 120 return da.isConcept( object, premises ); 121 } 122 123 124 127 131 } 132 133 134 160 | Popular Tags |