throw new OntologyException( "Did not recognise this language URI, so cannot determine default model spec: " + languageURI );
/** * <p>Set the URI of the ontology to use for models that conform to * this specification.</p> * @param languageURI The new language URI * @exception OntologyException if the URI does not map to a known language profile */ public void setLanguage( String languageURI ) { m_languageURI = languageURI; m_profile = ProfileRegistry.getInstance().getProfile( m_languageURI ); if (m_profile == null) { throw new OntologyException( "Could not determine an ontology language profile for URI " + m_languageURI ); } }
/** 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} ) ); } }