1 19 20 package com.hp.hpl.jena.ontology.impl; 23 24 25 import com.hp.hpl.jena.ontology.*; 28 import com.hp.hpl.jena.rdf.model.*; 29 import com.hp.hpl.jena.util.iterator.ExtendedIterator; 30 import com.hp.hpl.jena.enhanced.*; 31 import com.hp.hpl.jena.graph.*; 32 33 34 43 public class IndividualImpl 44 extends OntResourceImpl 45 implements Individual 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 IndividualImpl( n, eg ); 62 } 63 else { 64 throw new ConversionException( "Cannot convert node " + n.toString() + " to Individual"); 65 } 66 } 67 68 public boolean canWrap( Node node, EnhGraph eg ) { 69 Profile profile = (eg instanceof OntModel) ? ((OntModel) eg).getProfile() : null; 71 return (profile != null) && profile.isSupported( node, eg, Individual.class ); 72 } 73 }; 74 75 76 77 78 79 82 85 93 public IndividualImpl( Node n, EnhGraph g ) { 94 super( n, g ); 95 } 96 97 98 101 108 public void setSameIndividualAs( Resource res ) { 109 setPropertyValue( getProfile().SAME_INDIVIDUAL_AS(), "SAME_INDIVIDUAL_AS", res ); 110 } 111 112 118 public void addSameIndividualAs( Resource res ) { 119 addPropertyValue( getProfile().SAME_INDIVIDUAL_AS(), "SAME_INDIVIDUAL_AS", res ); 120 } 121 122 129 public OntResource getSameIndividualAs() { 130 return objectAsResource( getProfile().SAME_INDIVIDUAL_AS(), "SAME_INDIVIDUAL_AS" ); 131 } 132 133 140 public ExtendedIterator listSameIndividualAs() { 141 return listAs( getProfile().SAME_INDIVIDUAL_AS(), "SAME_INDIVIDUAL_AS", OntResource.class ); 142 } 143 144 149 public boolean isSameIndividualAs( Resource res ) { 150 return hasPropertyValue( getProfile().SAME_INDIVIDUAL_AS(), "SAME_INDIVIDUAL_AS", res ); 151 } 152 153 158 public void removeSameIndividualAs( Resource res ) { 159 removePropertyValue( getProfile().SAME_INDIVIDUAL_AS(), "SAME_INDIVIDUAL_AS", res ); 160 } 161 162 163 166 170 } 171 172 173 202 203 | Popular Tags |