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 MinCardinalityRestrictionImpl 43 extends RestrictionImpl 44 implements MinCardinalityRestriction 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 MinCardinalityRestrictionImpl( n, eg ); 61 } 62 else { 63 throw new ConversionException( "Cannot convert node " + n + " to MinCardinalityRestriction"); 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, MinCardinalityRestriction.class ); 72 } 73 }; 74 75 76 79 82 90 public MinCardinalityRestrictionImpl( Node n, EnhGraph g ) { 91 super( n, g ); 92 } 93 94 97 99 106 public void setMinCardinality( int cardinality ) { 107 setPropertyValue( getProfile().MIN_CARDINALITY(), "MIN_CARDINALITY", getModel().createTypedLiteral( cardinality ) ); 108 } 109 110 115 public int getMinCardinality() { 116 return objectAsInt( getProfile().MIN_CARDINALITY(), "MIN_CARDINALITY" ); 117 } 118 119 125 public boolean hasMinCardinality( int cardinality ) { 126 return hasPropertyValue( getProfile().MIN_CARDINALITY(), "MIN_CARDINALITY", getModel().createTypedLiteral( cardinality ) ); 127 } 128 129 135 public void removeMinCardinality( int cardinality ) { 136 removePropertyValue( getProfile().MIN_CARDINALITY(), "MIN_CARDINALITY", getModel().createTypedLiteral( cardinality ) ); 137 } 138 139 140 141 144 148 } 149 150 151 180 | Popular Tags |