1 7 package com.hp.hpl.jena.rdf.arp; 8 9 13 class DAMLCollection extends CollectionAction { 14 15 16 17 static URIReference first = null; 18 static URIReference rest = null; 19 static URIReference nil = null; 20 static URIReference List = null; 21 static private String damlns = "http://www.daml.org/2001/03/daml+oil#"; 22 23 24 DAMLCollection(ParserSupport x){ 25 super(x); 26 } 27 DAMLCollection(ParserSupport x,AResourceInternal r[]){ 28 super(x); 29 rslt = r; 30 } 31 private AResourceInternal rslt[]; 32 static { 33 try { 34 nil = new URIReference(damlns+"nil"); 35 36 first = new URIReference(damlns+"first"); 37 rest = new URIReference(damlns+"rest"); 38 List = new URIReference(damlns+"List"); 39 } 40 catch (MalformedURIException e) { 41 System.err.println("Internal error: " + e.toString()); 42 e.printStackTrace(); 43 } 44 } 45 46 public void cleanUp() { 47 if (rslt[0]!=null) { 48 X.arp.endLocalScope(rslt[0]); 49 rslt[0] = null; 50 } 51 } 52 55 void terminate() { 56 rslt[0] = nil; 57 } 58 59 62 CollectionAction next(AResourceInternal head) { 63 ARPResource cell= new ARPResource(X.arp); 64 try { 65 cell.setPredicateObject( first,head, null ); 66 67 cell.setType(List); 68 } 69 finally { 70 X.arp.endLocalScope(head); 71 72 rslt[0] = cell; 73 } 74 return new DAMLTailCollection(X,cell); 75 76 } 77 78 } 79 80 | Popular Tags |