1 6 7 package com.hp.hpl.jena.enhanced.test; 8 import com.hp.hpl.jena.enhanced.*; 9 import com.hp.hpl.jena.graph.*; 10 import com.hp.hpl.jena.util.iterator.*; 11 12 16 class TestCommonImpl extends EnhNode implements TestNode { 17 18 19 TestCommonImpl(Node n, EnhGraph m ) { 20 super(n,m); 21 } 22 TestModel getModel() { 23 return (TestModel)enhGraph; 24 } 25 26 Triple findSubject() 27 { return findNode( node, null, null ); } 28 29 Triple findPredicate() 30 { return findNode( null, node, null ); } 31 32 Triple findObject() 33 { return findNode( null, null, node ); } 34 35 Triple findNode( Node s, Node p, Node o ) 36 { 37 ClosableIterator it = enhGraph.asGraph().find( s, p, o ); 38 try { return it.hasNext() ? (Triple) it.next() : null; } 39 finally { it.close(); } 40 } 41 42 public TestSubject asSubject() { 45 return (TestSubject)asInternal(TestSubject.class); 46 } 47 48 public TestObject asObject() { 49 return (TestObject)asInternal(TestObject.class); 50 } 51 52 public TestProperty asProperty() { 53 return (TestProperty)asInternal(TestProperty.class); 54 } 55 56 } 57 58 87 | Popular Tags |