/** * <p>Answer true if the given individual is one of the enumerated individuals in the class extension * of this class.</p> * @param res An individual to test * @return True if the given individual is in the class extension for this class. * @exception OntProfileException If the {@link Profile#ONE_OF()} property is not supported in the current language profile. */ @Override public boolean hasOneOf( Resource res ) { return getOneOf().contains( res ); }
/** * <p>Answer true if the given literal is one of the enumerated literals that are the permissible values * of this datarange.</p> * @param lit A literal to test * @return True if the given literal is in the permissible values for this class. * @exception OntProfileException If the {@link Profile#ONE_OF()} property is not supported in the current language profile. */ @Override public boolean hasOneOf( Literal lit ) { return getOneOf().contains( lit ); }
/** * <p>Answer true if this Boolean class expression has the given class as an operand.</p> * @param cls A class to test * @return True if the given class is an operand to this expression. * @exception OntProfileException If the operand property is not supported in the current language profile. */ @Override public boolean hasOperand( Resource cls ) { return getOperands().contains( cls ); }
/** * <p>Answer true if this AllDifferent declaration includes <code>res</code> as one of the distinct individuals.</p> * @param res A resource to test against * @return True if <code>res</code> is declared to be distinct from the other individuals in this declation. * @exception OntProfileException If the {@link Profile#DISTINCT_MEMBERS()} property is not supported in the current language profile. */ @Override public boolean hasDistinctMember( Resource res ) { return getDistinctMembers().contains( res ); }
/** Add the given value to a list which is the value of the given property */ protected void addListPropertyValue( Property p, String name, RDFNode value ) { checkProfile( p, name ); // get the list value if (hasProperty( p )) { RDFNode cur = getRequiredProperty( p ).getObject(); if (!cur.canAs( RDFList.class )) { throw new OntologyException( "Tried to add a value to a list-valued property " + p + " but the current value is not a list: " + cur ); } RDFList values = cur.as( RDFList.class ); // now add our value to the list if (!values.contains( value )){ RDFList newValues = values.with( value ); // if the previous values was nil, the return value will be a new list if (newValues != values) { removeAll( p ); addProperty( p, newValues ); } } } else { // create a new list to hold the only value we know so far addProperty( p, ((OntModel) getModel()).createList( new RDFNode[] {value} ) ); } }