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 public class TestModelImpl extends EnhGraph implements TestModel { 17 18 19 public TestModelImpl(Graph g, Personality p) { 20 super(g,p); 21 } 22 private Triple aTriple() { 23 ClosableIterator it = null; 24 try { 25 it = graph.find(null,null,null); 26 return it.hasNext()?(Triple)it.next():null; 27 } 28 finally { 29 if (it!=null) 30 it.close(); 31 } 32 } 33 34 public TestObject anObject() { 35 return (TestObject)getNodeAs(aTriple().getObject(),TestObject.class); 36 } 37 38 public TestProperty aProperty() { 39 return (TestProperty)getNodeAs(aTriple().getPredicate(),TestProperty.class); 40 } 41 42 public TestSubject aSubject() { 43 return (TestSubject)getNodeAs(aTriple().getSubject(),TestSubject.class); 44 } 45 46 } 47 48 77 78 | Popular Tags |