1 19 20 package com.hp.hpl.jena.ontology.impl; 23 24 25 import com.hp.hpl.jena.enhanced.*; 28 import com.hp.hpl.jena.graph.*; 29 import com.hp.hpl.jena.ontology.*; 30 31 32 41 public class CardinalityQRestrictionImpl 42 extends QualifiedRestrictionImpl 43 implements CardinalityQRestriction 44 { 45 48 51 56 public static Implementation factory = new Implementation() { 57 public EnhNode wrap( Node n, EnhGraph eg ) { 58 if (canWrap( n, eg )) { 59 return new CardinalityQRestrictionImpl( n, eg ); 60 } 61 else { 62 throw new ConversionException( "Cannot convert node " + n + " to CardinalityQRestriction"); 63 } 64 } 65 66 public boolean canWrap( Node node, EnhGraph eg ) { 67 Profile profile = (eg instanceof OntModel) ? ((OntModel) eg).getProfile() : null; 69 return (profile != null) && profile.isSupported( node, eg, CardinalityQRestriction.class ); 70 } 71 }; 72 73 74 77 85 public CardinalityQRestrictionImpl( Node n, EnhGraph g ) { 86 super( n, g ); 87 } 88 89 90 93 96 103 public void setCardinalityQ( int cardinality ) { 104 setPropertyValue( getProfile().CARDINALITY_Q(), "CARDINALITY_Q", getModel().createTypedLiteral( cardinality ) ); 105 } 106 107 112 public int getCardinalityQ() { 113 return objectAsInt( getProfile().CARDINALITY_Q(), "CARDINALITY_Q" ); 114 } 115 116 122 public boolean hasCardinalityQ( int cardinality ) { 123 return hasPropertyValue( getProfile().CARDINALITY_Q(), "CARDINALITY_Q", getModel().createTypedLiteral( cardinality ) ); 124 } 125 126 133 public void removeCardinalityQ( int cardinality ) { 134 removePropertyValue( getProfile().CARDINALITY_Q(), "CARDINALITY_Q", getModel().createTypedLiteral( cardinality ) ); 135 } 136 137 138 141 145 } 146 147 173 | Popular Tags |