1 18 19 package com.hp.hpl.jena.ontology.daml.impl; 22 23 24 import com.hp.hpl.jena.ontology.*; 27 import com.hp.hpl.jena.ontology.daml.*; 28 import com.hp.hpl.jena.rdf.model.*; 29 30 31 32 40 public class LiteralAccessorImpl 41 extends PropertyAccessorImpl 42 implements LiteralAccessor 43 { 44 47 48 51 52 55 56 59 65 public LiteralAccessorImpl( Property property, OntResource val ) { 66 super( property, val ); 67 } 68 69 70 71 74 81 public Literal getValue() { 82 NodeIterator i = null; 83 try { 84 i = getAll(); 85 return (i == null || !i.hasNext()) ? null : ((Literal) i.nextNode()); 86 } 87 finally { 88 if (i != null) { 89 i.close(); 90 } 91 } 92 } 93 94 95 100 public void addValue( String value ) { 101 add( m_val.getModel().createLiteral( value ) ); 102 } 103 104 105 110 public void removeValue( String value ) { 111 remove( m_val.getModel().createLiteral( value ) ); 112 } 113 114 115 123 public boolean hasValue( String value ) { 124 return hasValue( m_val.getModel().createLiteral( value ) ); 125 } 126 127 128 129 132 133 134 138 139 } 140 141 170 171 | Popular Tags |