1 19 20 package com.hp.hpl.jena.reasoner.dig; 23 24 25 import org.w3c.dom.Element ; 28 import org.w3c.dom.Document ; 29 30 import com.hp.hpl.jena.reasoner.TriplePattern; 31 32 33 34 47 public class DIGQueryRoleParentsTranslator 48 extends DIGQueryRoleAncestorsTranslator 49 { 50 51 54 57 60 61 64 69 public DIGQueryRoleParentsTranslator( String predicate, boolean parents ) { 70 super( predicate, parents ); 71 } 72 73 74 77 78 81 public Document translatePattern( TriplePattern pattern, DIGAdapter da ) { 82 DIGConnection dc = da.getConnection(); 83 Document query = dc.createDigVerb( DIGProfile.ASKS, da.getProfile() ); 84 85 if (m_ancestors) { 86 Element parents = da.createQueryElement( query, DIGProfile.RPARENTS ); 87 da.addClassDescription( parents, pattern.getSubject() ); 88 } 89 else { 90 Element descendants = da.createQueryElement( query, DIGProfile.RCHILDREN ); 91 da.addClassDescription( descendants, pattern.getObject() ); 92 } 93 94 return query; 95 } 96 97 98 99 102 106 } 107 108 109 135 | Popular Tags |