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 32 33 42 public class MaxCardinalityRestrictionImpl 43 extends RestrictionImpl 44 implements MaxCardinalityRestriction 45 { 46 49 52 57 public static Implementation factory = new Implementation() { 58 public EnhNode wrap( Node n, EnhGraph eg ) { 59 if (canWrap( n, eg )) { 60 return new MaxCardinalityRestrictionImpl( n, eg ); 61 } 62 else { 63 throw new ConversionException( "Cannot convert node " + n + " to MaxCardinalityRestriction"); 64 } 65 } 66 67 public boolean canWrap( Node node, EnhGraph eg ) { 68 Profile profile = (eg instanceof OntModel) ? ((OntModel) eg).getProfile() : null; 71 return (profile != null) && profile.isSupported( node, eg, MaxCardinalityRestriction.class ); 72 } 73 }; 74 75 76 79 82 90 public MaxCardinalityRestrictionImpl( Node n, EnhGraph g ) { 91 super( n, g ); 92 } 93 94 97 99 106 public void setMaxCardinality( int cardinality ) { 107 setPropertyValue( getProfile().MAX_CARDINALITY(), "MAX_CARDINALITY", getModel().createTypedLiteral( cardinality ) ); 108 } 109 110 115 public int getMaxCardinality() { 116 return objectAsInt( getProfile().MAX_CARDINALITY(), "MAX_CARDINALITY" ); 117 } 118 119 125 public boolean hasMaxCardinality( int cardinality ) { 126 return hasPropertyValue( getProfile().MAX_CARDINALITY(), "MAX_CARDINALITY", getModel().createTypedLiteral( cardinality ) ); 127 } 128 129 135 public void removeMaxCardinality( int cardinality ) { 136 removePropertyValue( getProfile().MAX_CARDINALITY(), "MAX_CARDINALITY", getModel().createTypedLiteral( cardinality ) ); 137 } 138 139 140 143 147 } 148 149 150 179 | Popular Tags |