1 19 20 package com.hp.hpl.jena.ontology.impl; 23 24 25 26 import com.hp.hpl.jena.enhanced.*; 29 import com.hp.hpl.jena.graph.*; 30 import com.hp.hpl.jena.ontology.*; 31 import com.hp.hpl.jena.rdf.model.*; 32 33 34 43 public class HasValueRestrictionImpl 44 extends RestrictionImpl 45 implements HasValueRestriction 46 { 47 50 53 58 public static Implementation factory = new Implementation() { 59 public EnhNode wrap( Node n, EnhGraph eg ) { 60 if (canWrap( n, eg )) { 61 return new HasValueRestrictionImpl( n, eg ); 62 } 63 else { 64 throw new ConversionException( "Cannot convert node " + n + " to HasValueRestriction"); 65 } 66 } 67 68 public boolean canWrap( Node node, EnhGraph eg ) { 69 Profile profile = (eg instanceof OntModel) ? ((OntModel) eg).getProfile() : null; 72 return (profile != null) && profile.isSupported( node, eg, HasValueRestriction.class ); 73 } 74 }; 75 76 77 80 83 91 public HasValueRestrictionImpl( Node n, EnhGraph g ) { 92 super( n, g ); 93 } 94 95 96 99 101 110 public void setHasValue( RDFNode value ) { 111 setPropertyValue( getProfile().HAS_VALUE(), "HAS_VALUE", value ); 112 } 113 114 119 public RDFNode getHasValue() { 120 checkProfile( getProfile().HAS_VALUE(), "HAS_VALUE" ); 121 RDFNode n = getPropertyValue( getProfile().HAS_VALUE() ); 122 123 if (!(n instanceof Literal) && n.canAs( Individual.class )) { 125 n = n.as( Individual.class ); 126 } 127 128 return n; 129 } 130 131 138 public boolean hasValue( RDFNode value ) { 139 return hasPropertyValue( getProfile().HAS_VALUE(), "HAS_VALUE", value ); 140 } 141 142 148 public void removeHasValue( RDFNode value ) { 149 removePropertyValue( getProfile().HAS_VALUE(), "HAS_VALUE", value ); 150 } 151 152 153 156 160 } 161 162 163 192 193 | Popular Tags |