/** * <p>Answer true if the given property is a sub-property of this property.</p> * @param prop A property to test. * @param direct If true, only consider the direcly adjacent properties in the * property hierarchy * @return True if the given property is a sub-property of this property. */ @Override public boolean hasSubProperty( Property prop, boolean direct ) { return prop.as( OntProperty.class ).hasSuperProperty( this, direct ); }
/** * <p>Add a sub-property of this property.</p> * @param prop A property that is a sub-property of this property. * @exception OntProfileException If the {@link Profile#SUB_PROPERTY_OF()} property is not supported in the current language profile. */ @Override public void addSubProperty( Property prop ) { prop.as( OntProperty.class ).addSuperProperty( this ); }
/** * <p>Remove the given property from the sub-properties of this property. If this statement * is not true of the current model, nothing happens.</p> * @param prop A property to be removed from the sub-properties of this property * @exception OntProfileException If the {@link Profile#SUB_PROPERTY_OF()} property is not supported in the current language profile. */ @Override public void removeSubProperty( Property prop ) { prop.as( OntProperty.class ).removeSuperProperty( this ); }
/** * <p> * Answer a resource representing an generic property in this model. Effectively * this method is an alias for {@link #createProperty( String )}, except that * the return type is {@link OntProperty}, which allow more convenient access to * a property's position in the property hierarchy, domain, range, etc. * </p> * * @param uri The uri for the property. May not be null. * @return An OntProperty resource. */ @Override public OntProperty createOntProperty( String uri ) { Property p = createProperty( uri ); p.addProperty( RDF.type, getProfile().PROPERTY() ); return p.as( OntProperty.class ); }
/** * <p>Assert that this property is super-property of the given property. Any existing * statements for <code>subPropertyOf</code> on <code>prop</code> will be removed.</p> * @param prop The property that is a sub-property of this property * @exception OntProfileException If the {@link Profile#SUB_PROPERTY_OF()} property is not supported in the current language profile. */ @Override public void setSubProperty( Property prop ) { // first we have to remove all of the inverse sub-prop links checkProfile( getProfile().SUB_PROPERTY_OF(), "SUB_PROPERTY_OF" ); for (StmtIterator i = getModel().listStatements( null, getProfile().SUB_PROPERTY_OF(), this ); i.hasNext(); ) { i.removeNext(); } prop.as( OntProperty.class ).addSuperProperty( this ); }
try ontProperty = ((OntProperty) predicate.as(OntProperty.class));
private void bindProperty(Property predicate, BioPAXElement bpe, Individual individual, Model model) throws IllegalAccessException, InvocationTargetException { OntProperty ontProperty; try { ontProperty = ((OntProperty) predicate.as(OntProperty.class)); } catch (ConversionException e) { throw new IllegalBioPAXArgumentException("Unknown property! " + predicate + " bpe:" + bpe.getRDFId(), e); } String localName = ontProperty.getLocalName(); PropertyEditor editor = this.getEditorMap().getEditorForProperty(localName, bpe.getModelInterface()); if (editor != null) { checkCardinalityAndBindValue(bpe, individual, model, ontProperty, editor); } else { throw new IllegalBioPAXArgumentException( "Could not locate editor! " + predicate + " element:" + bpe.getRDFId() + " property:" + localName); } }