1 19 20 package com.hp.hpl.jena.ontology.impl; 23 24 25 26 import java.util.Iterator ; 29 30 import com.hp.hpl.jena.enhanced.EnhGraph; 31 import com.hp.hpl.jena.graph.Node; 32 import com.hp.hpl.jena.ontology.*; 33 import com.hp.hpl.jena.rdf.model.*; 34 import com.hp.hpl.jena.util.iterator.ExtendedIterator; 35 36 37 38 47 public abstract class BooleanClassDescriptionImpl 48 extends OntClassImpl 49 implements BooleanClassDescription 50 { 51 54 57 60 63 71 public BooleanClassDescriptionImpl( Node n, EnhGraph g ) { 72 super( n, g ); 73 } 74 75 76 79 81 88 public void setOperands( RDFList operands ) { 89 setPropertyValue( operator(), getOperatorName(), operands ); 90 } 91 92 97 public void addOperand( Resource cls ) { 98 addListPropertyValue( operator(), getOperatorName(), cls ); 99 } 100 101 106 public void addOperands( Iterator classes ) { 107 while (classes.hasNext()) { 108 addOperand( (Resource) classes.next() ); 109 } 110 } 111 112 117 public RDFList getOperands() { 118 return (RDFList) objectAs( operator(), getOperatorName(), RDFList.class ); 119 } 120 121 127 public ExtendedIterator listOperands() { 128 return getOperands().iterator().mapWith( new AsMapper( OntClass.class ) ); 129 } 130 131 137 public boolean hasOperand( Resource cls ) { 138 return getOperands().contains( cls ); 139 } 140 141 142 146 public void removeOperand( Resource res ) { 147 setOperands( getOperands().remove( res ) ); 148 } 149 150 155 public abstract Property operator(); 156 157 158 159 162 163 protected abstract String getOperatorName(); 164 165 166 170 } 171 172 173 202 203 204 | Popular Tags |