You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by al...@apache.org on 2011/08/02 18:42:51 UTC
svn commit: r1153185 - in
/incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet:
api/ontology/ impl/ontology/
Author: alexdma
Date: Tue Aug 2 16:42:48 2011
New Revision: 1153185
URL: http://svn.apache.org/viewvc?rev=1153185&view=rev
Log:
STANBOL-304:
- Ontology scope factory methods deprecated in favor of variants with varargs. This will make it easier to create spaces without manually setting the top ontology.
- Documented more space-related APIs
Modified:
incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologySpace.java
incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologySpaceFactory.java
incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/SpaceType.java
incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/UnmodifiableOntologySpaceException.java
incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/ontology/CoreOntologySpaceImpl.java
incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/ontology/CustomOntologySpaceImpl.java
incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/ontology/OntologySpaceFactoryImpl.java
incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/ontology/SessionOntologySpaceImpl.java
Modified: incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologySpace.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologySpace.java?rev=1153185&r1=1153184&r2=1153185&view=diff
==============================================================================
--- incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologySpace.java (original)
+++ incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologySpace.java Tue Aug 2 16:42:48 2011
@@ -1,19 +1,19 @@
/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.stanbol.ontologymanager.ontonet.api.ontology;
import java.util.Collection;
@@ -23,168 +23,150 @@ import org.apache.stanbol.ontologymanage
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLOntology;
-
/**
- * An ontology space identifies the set of OWL ontologies that should be
- * "active" in a given context, e.g. for a certain user session or a specific
- * reasoning service. Each ontology space has an ID and a top ontology that can
- * be used as a shared resource for mutual exclusion and locking strategies.
- *
- * @author alessandro
- *
+ * An ontology space identifies the set of OWL ontologies that should be "active" in a given context, e.g. for
+ * a certain user session or a specific reasoning service. Each ontology space has an ID and a top ontology
+ * that can be used as a shared resource for mutual exclusion and locking strategies.
*/
public interface OntologySpace {
- /**
- * Adds the given ontology to the ontology space.
- *
- * @param ontology
- * the ontology to be added
- * @throws UnmodifiableOntologySpaceException
- * if the ontology space is read-only
- */
- void addOntology(OntologyInputSource ontologySource)
- throws UnmodifiableOntologySpaceException;
-
- void addOntologySpaceListener(OntologySpaceListener listener);
-
- void clearOntologySpaceListeners();
-
- /**
- * Returns a Unique Resource Identifier (URI) that identifies this ontology
- * space. For instance, this URI could be the parent of (some/most of) the
- * base URIs for the ontologies within this space.
- *
- * @return the URI that identifies this ontology space
- */
+ /**
+ * Adds the given ontology to the ontology space.
+ *
+ * @param ontology
+ * the ontology to be added
+ * @throws UnmodifiableOntologySpaceException
+ * if the ontology space is read-only
+ */
+ void addOntology(OntologyInputSource ontologySource) throws UnmodifiableOntologySpaceException;
+
+ void addOntologySpaceListener(OntologySpaceListener listener);
+
+ void clearOntologySpaceListeners();
+
+ /**
+ * Returns a Unique Resource Identifier (URI) that identifies this ontology space. For instance, this URI
+ * could be the parent of (some/most of) the base URIs for the ontologies within this space.<br/>
+ * <br/>
+ * A possible way to construct these IDs is by concatenating <code>/{spacetype}</code> (e.g.
+ * <code>/custom</code>) to the scope IRI. However, this is implementation-dependent.
+ *
+ * @return the URI that identifies this ontology space
+ */
IRI getID();
- /**
- * Returns all the ontologies encompassed by this ontology space.
- *
- * @return the set of ontologies in the ontology space
- */
+ /**
+ * Returns all the ontologies encompassed by this ontology space.
+ *
+ * @return the set of ontologies in the ontology space
+ */
Set<OWLOntology> getOntologies();
- /**
- * Returns the ontology identified by the supplied <i>logical</i> IRI, if
- * such an ontology has been loaded in this space.<br>
- * <br>
- * Note that ontologies are not identified by physical IRI here. There's no
- * need to ask KReS for ontologies by physical IRI, use a browser or some
- * other program instead!
- *
- * @param ontologyIri
- * the <i>logical</i> identifier of the ontology to query for.
- *
- * @return the requested ontology, or null if no ontology with this ID has
- * been loaded.
- */
+ /**
+ * Returns the ontology identified by the supplied <i>logical</i> IRI, if such an ontology has been loaded
+ * in this space.<br>
+ * <br>
+ * Note that ontologies are not identified by physical IRI here. There's no need to ask KReS for
+ * ontologies by physical IRI, use a browser or some other program instead!
+ *
+ * @param ontologyIri
+ * the <i>logical</i> identifier of the ontology to query for.
+ *
+ * @return the requested ontology, or null if no ontology with this ID has been loaded.
+ */
OWLOntology getOntology(IRI ontologyIri);
-
- boolean containsOntology(IRI ontologyIri);
- Collection<OntologySpaceListener> getOntologyScopeListeners();
+ boolean containsOntology(IRI ontologyIri);
+
+ Collection<OntologySpaceListener> getOntologyScopeListeners();
- /**
- * Returns the ontology that serves as a root module for this ontology
- * space.
- *
- * @return the root module of the ontology space
- */
+ /**
+ * Returns the ontology that serves as a root module for this ontology space.
+ *
+ * @return the root module of the ontology space
+ */
OWLOntology getTopOntology();
- /**
- * Determines if the ontology identified by the supplied <i>logical</i> IRI
- * has been loaded in this space.<br>
- * <br>
- * Note that ontologies are not identified by physical IRI here. There's no
- * need to ask KReS for ontologies by physical IRI, use a browser or some
- * other program instead!
- *
- * @param ontologyIri
- * the <i>logical</i> identifier of the ontology to query for.
- *
- * @return true if an ontology with this ID has been loaded in this space.
- */
+ /**
+ * Determines if the ontology identified by the supplied <i>logical</i> IRI has been loaded in this space.<br>
+ * <br>
+ * Note that ontologies are not identified by physical IRI here. There's no need to ask KReS for
+ * ontologies by physical IRI, use a browser or some other program instead!
+ *
+ * @param ontologyIri
+ * the <i>logical</i> identifier of the ontology to query for.
+ *
+ * @return true if an ontology with this ID has been loaded in this space.
+ */
boolean hasOntology(IRI ontologyIri);
- /**
- * Determines if it is no longer possible to modify this space until it is
- * torn down.
- *
- * @return true if this space is write-locked, false otherwise.
- */
+ /**
+ * Determines if it is no longer possible to modify this space until it is torn down.
+ *
+ * @return true if this space is write-locked, false otherwise.
+ */
boolean isLocked();
- boolean isSilentMissingOntologyHandling();
+ boolean isSilentMissingOntologyHandling();
- /**
- * Removes the given ontology from the ontology space, if the ontology is a
- * direct child of the top ontology. This means that the ontology must
- * neither be the top ontology for this space, nor a subtree of an imported
- * ontology. This is a conservative measure to avoid using undefined
- * entities in the space.
- *
- * @param ontology
- * the ontology to be removed
- * @throws UnmodifiableOntologySpaceException
- * if the ontology space is read-only
- */
- void removeOntology(OntologyInputSource src)
- throws OntologySpaceModificationException;
-
- void removeOntologySpaceListener(OntologySpaceListener listener);
-
- void setSilentMissingOntologyHandling(boolean silent);
-
- /**
- * Sets the supplied ontology as the root ontology that (recursively)
- * references the whole underlying ontology network. This actually
- * <i>replaces</i> the ontology to be obtained by a call to
- * <code>getTopOntology()</code> with this one, i.e. it is <code>not</code>
- * equivalent to adding this ontology to a blank network!<br>
- * <br>
- * Implementations can arbitrarily behave with respect to the unset
- * <code>createParent</code> parameter from the other method signature.
- *
- * @param ontology
- * the new top ontology.
- * @throws OntologySpaceModificationException
- * if the ontology space is read-only or the ontology could not
- * be removed.
- */
- void setTopOntology(OntologyInputSource ontologySource)
- throws UnmodifiableOntologySpaceException;
-
- /**
- * Sets the supplied ontology as the root ontology that (recursively)
- * references the whole underlying ontology network. This actually
- * <i>replaces</i> the ontology to be obtained by a call to
- * <code>getTopOntology()</code> with this one, i.e. it is <code>not</code>
- * equivalent to adding this ontology to a blank network!
- *
- * @param ontology
- * the new top ontology.
- * @param createParent
- * if true, a new ontology will be created and set as the top
- * ontology that will import this one.
- * @throws UnmodifiableOntologySpaceException
- * if the ontology space is read-only.
- */
- void setTopOntology(OntologyInputSource ontologySource,
- boolean createParent) throws UnmodifiableOntologySpaceException;
-
- /**
- * Bootstraps the ontology space. In some cases (such as with core and
- * custom spaces) this also implies write-locking its ontologies.
- */
+ /**
+ * Removes the given ontology from the ontology space, if the ontology is a direct child of the top
+ * ontology. This means that the ontology must neither be the top ontology for this space, nor a subtree
+ * of an imported ontology. This is a conservative measure to avoid using undefined entities in the space.
+ *
+ * @param ontology
+ * the ontology to be removed
+ * @throws UnmodifiableOntologySpaceException
+ * if the ontology space is read-only
+ */
+ void removeOntology(OntologyInputSource src) throws OntologySpaceModificationException;
+
+ void removeOntologySpaceListener(OntologySpaceListener listener);
+
+ void setSilentMissingOntologyHandling(boolean silent);
+
+ /**
+ * Sets the supplied ontology as the root ontology that (recursively) references the whole underlying
+ * ontology network. This actually <i>replaces</i> the ontology to be obtained by a call to
+ * <code>getTopOntology()</code> with this one, i.e. it is <code>not</code> equivalent to adding this
+ * ontology to a blank network!<br>
+ * <br>
+ * Implementations can arbitrarily behave with respect to the unset <code>createParent</code> parameter
+ * from the other method signature.
+ *
+ * @param ontology
+ * the new top ontology.
+ * @throws OntologySpaceModificationException
+ * if the ontology space is read-only or the ontology could not be removed.
+ */
+ void setTopOntology(OntologyInputSource ontologySource) throws UnmodifiableOntologySpaceException;
+
+ /**
+ * Sets the supplied ontology as the root ontology that (recursively) references the whole underlying
+ * ontology network. This actually <i>replaces</i> the ontology to be obtained by a call to
+ * <code>getTopOntology()</code> with this one, i.e. it is <code>not</code> equivalent to adding this
+ * ontology to a blank network!
+ *
+ * @param ontology
+ * the new top ontology.
+ * @param createParent
+ * if true, a new ontology will be created and set as the top ontology that will import this
+ * one.
+ * @throws UnmodifiableOntologySpaceException
+ * if the ontology space is read-only.
+ */
+ void setTopOntology(OntologyInputSource ontologySource, boolean createParent) throws UnmodifiableOntologySpaceException;
+
+ /**
+ * Bootstraps the ontology space. In some cases (such as with core and custom spaces) this also implies
+ * write-locking its ontologies.
+ */
void setUp();
- /**
- * Performs all required operations for disposing of an ontology space and
- * releasing its resources (e.g. removing the writelock).
- */
+ /**
+ * Performs all required operations for disposing of an ontology space and releasing its resources (e.g.
+ * removing the writelock).
+ */
void tearDown();
}
Modified: incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologySpaceFactory.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologySpaceFactory.java?rev=1153185&r1=1153184&r2=1153185&view=diff
==============================================================================
--- incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologySpaceFactory.java (original)
+++ incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologySpaceFactory.java Tue Aug 2 16:42:48 2011
@@ -1,74 +1,131 @@
/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.stanbol.ontologymanager.ontonet.api.ontology;
import org.apache.stanbol.ontologymanager.ontonet.api.io.OntologyInputSource;
import org.semanticweb.owlapi.model.IRI;
-
/**
- * An ontology space factory is responsible for the creation of new, readily
- * specialized ontology spaces from supplied ontology input sources.
- *
- * Implementations should not call the setup method of the ontology space once
- * it is created, so that it is not locked from editing since creation time.
- *
- * @author alessandro
+ * An ontology space factory is responsible for the creation of new, readily specialized ontology spaces from
+ * supplied ontology input sources.
*
+ * Implementations should not call the setup method of the ontology space once it is created, so that it is
+ * not locked from editing since creation time.
*/
public interface OntologySpaceFactory {
- /**
- * Creates and sets up a default core ontology space.
- *
- * @param scopeID
- * the unique identifier of the ontology scope that will
- * reference this space. It can be used for generating the
- * identifier for this ontology space.
- * @param coreSource
- * the input source for the ontologies in this space.
- * @return the generated ontology space.
- */
- CoreOntologySpace createCoreOntologySpace(IRI scopeID,
- OntologyInputSource coreSource);
-
- /**
- * Creates and sets up a default custom ontology space.
- *
- * @param scopeID
- * the unique identifier of the ontology scope that will
- * reference this space. It can be used for generating the
- * identifier for this ontology space.
- * @param customSource
- * the input source for the ontologies in this space.
- * @return the generated ontology space.
- */
- CustomOntologySpace createCustomOntologySpace(IRI scopeID,
- OntologyInputSource customSource);
-
- /**
- * Creates and sets up a default session ontology space.
- *
- * @param scopeID
- * the unique identifier of the ontology scope that will
- * reference this space. It can be used for generating the
- * identifier for this ontology space.
- * @return the generated ontology space.
- */
- SessionOntologySpace createSessionOntologySpace(IRI scopeID);
+ /**
+ * Creates and sets up a default core ontology space. Equivalent to calling
+ * <code>createOntologySpace(IRI, SpaceTypes.CORE, OntologyInputSource...)</code>.
+ *
+ * @deprecated Please use the varargs version of this method
+ * {@link #createCoreOntologySpace(IRI, OntologyInputSource...)}.
+ *
+ * @param scopeId
+ * the unique identifier of the ontology scope that will reference this space. It can be used
+ * for generating the identifier for this ontology space.
+ * @param coreSource
+ * the input source for the ontologies in this space.
+ * @return the generated ontology space.
+ */
+ CoreOntologySpace createCoreOntologySpace(IRI scopeId, OntologyInputSource coreSource);
+
+ /**
+ * Creates and sets up a default core ontology space. Equivalent to calling
+ * <code>createOntologySpace(IRI, SpaceTypes.CORE, OntologyInputSource...)</code>.
+ *
+ * @param scopeId
+ * the unique identifier of the ontology scope that will reference this space. It can be used
+ * for generating the identifier for this ontology space.
+ * @param coreSources
+ * the sources of the optional ontologies to be immediately loaded upon space creation.
+ * @return the generated ontology space.
+ */
+ CoreOntologySpace createCoreOntologySpace(IRI scopeId, OntologyInputSource... coreSources);
+
+ /**
+ * Creates and sets up a default custom ontology space. Equivalent to calling
+ * <code>createOntologySpace(IRI, SpaceTypes.CUSTOM, OntologyInputSource...)</code>.
+ *
+ * @deprecated Please use the varargs version of this method
+ * {@link #createCustomOntologySpace(IRI, OntologyInputSource...)}.
+ *
+ * @param scopeId
+ * the unique identifier of the ontology scope that will reference this space. It can be used
+ * for generating the identifier for this ontology space.
+ * @param customSource
+ * the input source for the ontologies in this space.
+ * @return the generated ontology space.
+ */
+ CustomOntologySpace createCustomOntologySpace(IRI scopeId, OntologyInputSource customSource);
+
+ /**
+ * Creates and sets up a default custom ontology space. Equivalent to calling
+ * <code>createOntologySpace(IRI, SpaceTypes.CUSTOM, OntologyInputSource...)</code>.
+ *
+ *
+ * @param scopeId
+ * the unique identifier of the ontology scope that will reference this space. It can be used
+ * for generating the identifier for this ontology space.
+ * @param customSources
+ * the sources of the optional ontologies to be immediately loaded upon space creation.
+ * @return the generated ontology space.
+ */
+ CustomOntologySpace createCustomOntologySpace(IRI scopeId, OntologyInputSource... customSources);
+
+ /**
+ * Creates an ontology space of the specified type.
+ *
+ * @param scopeId
+ * the unique identifier of the ontology scope that will reference this space. It can be used
+ * for generating the identifier for this ontology space.
+ * @param type
+ * the space type.
+ * @param ontologySources
+ * the sources of the optional ontologies to be immediately loaded upon space creation.
+ * @return the generated ontology space.
+ */
+ OntologySpace createOntologySpace(IRI scopeId, SpaceType type, OntologyInputSource... ontologySources);
+
+ /**
+ * Creates and sets up a default session ontology space. Equivalent to calling
+ * <code>createOntologySpace(IRI, SpaceTypes.SESSION)</code>.
+ *
+ * @deprecated Please use the varargs version of this method
+ * {@link #createSessionOntologySpace(IRI, OntologyInputSource...)}.
+ *
+ * @param scopeId
+ * the unique identifier of the ontology scope that will reference this space. It can be used
+ * for generating the identifier for this ontology space.
+ * @return the generated ontology space.
+ */
+ SessionOntologySpace createSessionOntologySpace(IRI scopeId);
+
+ /**
+ * Creates and sets up a default session ontology space. Equivalent to calling
+ * <code>createOntologySpace(IRI, SpaceTypes.SESSION, OntologyInputSource...)</code>.
+ *
+ * @param scopeId
+ * the unique identifier of the ontology scope that will reference this space. It can be used
+ * for generating the identifier for this ontology space.
+ * @param sessionSources
+ * the sources of the optional ontologies to be immediately loaded upon space creation.
+ * @return the generated ontology space.
+ */
+ SessionOntologySpace createSessionOntologySpace(IRI scopeId, OntologyInputSource... sessionSources);
}
Modified: incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/SpaceType.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/SpaceType.java?rev=1153185&r1=1153184&r2=1153185&view=diff
==============================================================================
--- incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/SpaceType.java (original)
+++ incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/SpaceType.java Tue Aug 2 16:42:48 2011
@@ -1,33 +1,55 @@
/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.stanbol.ontologymanager.ontonet.api.ontology;
+/**
+ * The possible types of ontology spaces managed by OntoNet.
+ */
public enum SpaceType {
- CORE("core"), CUSTOM("custom"), SESSION("session");
-
- SpaceType(String suffix) {
- this.suffix = suffix;
- }
-
- private String suffix;
-
- public String getIRISuffix() {
- return suffix;
- }
+ /**
+ * Denotes a core space (1..1). It is instantiated upon creation of the scope.
+ */
+ CORE("core"),
+
+ /**
+ * Denotes a custom space (0..1).
+ */
+ CUSTOM("custom"),
+
+ /**
+ * Denotes a session space (0..n).
+ */
+ SESSION("session");
+
+ SpaceType(String suffix) {
+ this.suffix = suffix;
+ }
+
+ private String suffix;
+
+ /**
+ * Returns the preferred string to be attached to an ontology scope IRI (assuming it ends with a hash or
+ * slash character) in order to reference the included ontology space.
+ *
+ * @return the preferred suffix for this space type.
+ */
+ public String getIRISuffix() {
+ return suffix;
+ }
}
Modified: incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/UnmodifiableOntologySpaceException.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/UnmodifiableOntologySpaceException.java?rev=1153185&r1=1153184&r2=1153185&view=diff
==============================================================================
--- incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/UnmodifiableOntologySpaceException.java (original)
+++ incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/UnmodifiableOntologySpaceException.java Tue Aug 2 16:42:48 2011
@@ -20,9 +20,6 @@ package org.apache.stanbol.ontologymanag
* Thrown whenever an attempt to modify the ontology network within a read-only
* ontology space (e.g. a core or custom space in a bootstrapped system) is
* detected and denied.
- *
- * @author alessandro
- *
*/
public class UnmodifiableOntologySpaceException extends
OntologySpaceModificationException {
Modified: incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/ontology/CoreOntologySpaceImpl.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/ontology/CoreOntologySpaceImpl.java?rev=1153185&r1=1153184&r2=1153185&view=diff
==============================================================================
--- incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/ontology/CoreOntologySpaceImpl.java (original)
+++ incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/ontology/CoreOntologySpaceImpl.java Tue Aug 2 16:42:48 2011
@@ -1,19 +1,19 @@
/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.stanbol.ontologymanager.ontonet.impl.ontology;
import org.apache.stanbol.ontologymanager.ontonet.api.ontology.CoreOntologySpace;
@@ -23,55 +23,40 @@ import org.apache.stanbol.ontologymanage
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLOntologyManager;
-
-public class CoreOntologySpaceImpl extends AbstractOntologySpaceImpl implements
- CoreOntologySpace {
-
- public static final String SUFFIX = SpaceType.CORE.getIRISuffix();
-// static {
-// SUFFIX = SpaceType.CORE.getIRISuffix();
-// }
-
- public CoreOntologySpaceImpl(IRI scopeID, ClerezzaOntologyStorage storage) {
-
- super(IRI.create(StringUtils.stripIRITerminator(scopeID) + "/"
- + SpaceType.CORE.getIRISuffix()), SpaceType.CORE/*, scopeID*/, storage);
- }
-
- public CoreOntologySpaceImpl(IRI scopeID, ClerezzaOntologyStorage storage,
- OWLOntologyManager ontologyManager) {
- super(IRI.create(StringUtils.stripIRITerminator(scopeID) + "/"
- + SpaceType.CORE.getIRISuffix()), SpaceType.CORE, /*scopeID,*/ storage,
- ontologyManager);
- }
-
-// public CoreOntologySpaceImpl(IRI scopeID, OntologyInputSource topOntology) {
-// super(IRI.create(StringUtils.stripIRITerminator(scopeID) + "/"
-// + SpaceType.CORE.getIRISuffix()), SpaceType.CORE, scopeID,
-// topOntology);
-// }
-//
-// public CoreOntologySpaceImpl(IRI scopeID, OntologyInputSource topOntology,
-// OWLOntologyManager ontologyManager) {
-// super(IRI.create(StringUtils.stripIRITerminator(scopeID) + "/"
-// + SpaceType.CORE.getIRISuffix()), SpaceType.CORE, scopeID,
-// ontologyManager, topOntology);
-// }
-
- /**
- * When set up, a core space is write-locked.
- */
- @Override
- public synchronized void setUp() {
- locked = true;
- }
-
- /**
- * When torn down, a core space releases its write-lock.
- */
- @Override
- public synchronized void tearDown() {
- locked = false;
- }
+/**
+ * Default implementation of the core ontology space.
+ */
+public class CoreOntologySpaceImpl extends AbstractOntologySpaceImpl implements CoreOntologySpace {
+
+ public static final String SUFFIX = SpaceType.CORE.getIRISuffix();
+
+ public CoreOntologySpaceImpl(IRI scopeID, ClerezzaOntologyStorage storage) {
+
+ super(IRI.create(StringUtils.stripIRITerminator(scopeID) + "/" + SpaceType.CORE.getIRISuffix()),
+ SpaceType.CORE/* , scopeID */, storage);
+ }
+
+ public CoreOntologySpaceImpl(IRI scopeID,
+ ClerezzaOntologyStorage storage,
+ OWLOntologyManager ontologyManager) {
+ super(IRI.create(StringUtils.stripIRITerminator(scopeID) + "/" + SpaceType.CORE.getIRISuffix()),
+ SpaceType.CORE, /* scopeID, */storage, ontologyManager);
+ }
+
+ /**
+ * When set up, a core space is write-locked.
+ */
+ @Override
+ public synchronized void setUp() {
+ locked = true;
+ }
+
+ /**
+ * When torn down, a core space releases its write-lock.
+ */
+ @Override
+ public synchronized void tearDown() {
+ locked = false;
+ }
}
Modified: incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/ontology/CustomOntologySpaceImpl.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/ontology/CustomOntologySpaceImpl.java?rev=1153185&r1=1153184&r2=1153185&view=diff
==============================================================================
--- incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/ontology/CustomOntologySpaceImpl.java (original)
+++ incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/ontology/CustomOntologySpaceImpl.java Tue Aug 2 16:42:48 2011
@@ -27,6 +27,9 @@ import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLOntology;
import org.semanticweb.owlapi.model.OWLOntologyManager;
+/**
+ * Default implementation of the custom ontology space.
+ */
public class CustomOntologySpaceImpl extends AbstractOntologySpaceImpl implements CustomOntologySpace {
public static final String SUFFIX = SpaceType.CUSTOM.getIRISuffix();
Modified: incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/ontology/OntologySpaceFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/ontology/OntologySpaceFactoryImpl.java?rev=1153185&r1=1153184&r2=1153185&view=diff
==============================================================================
--- incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/ontology/OntologySpaceFactoryImpl.java (original)
+++ incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/ontology/OntologySpaceFactoryImpl.java Tue Aug 2 16:42:48 2011
@@ -1,21 +1,22 @@
/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.stanbol.ontologymanager.ontonet.impl.ontology;
+import org.apache.stanbol.ontologymanager.ontonet.api.OfflineConfiguration;
import org.apache.stanbol.ontologymanager.ontonet.api.io.OntologyInputSource;
import org.apache.stanbol.ontologymanager.ontonet.api.ontology.CoreOntologySpace;
import org.apache.stanbol.ontologymanager.ontonet.api.ontology.CustomOntologySpace;
@@ -25,6 +26,7 @@ import org.apache.stanbol.ontologymanage
import org.apache.stanbol.ontologymanager.ontonet.api.ontology.OntologySpaceListener;
import org.apache.stanbol.ontologymanager.ontonet.api.ontology.ScopeRegistry;
import org.apache.stanbol.ontologymanager.ontonet.api.ontology.SessionOntologySpace;
+import org.apache.stanbol.ontologymanager.ontonet.api.ontology.SpaceType;
import org.apache.stanbol.ontologymanager.ontonet.api.ontology.UnmodifiableOntologySpaceException;
import org.apache.stanbol.ontologymanager.ontonet.impl.io.ClerezzaOntologyStorage;
import org.semanticweb.owlapi.model.IRI;
@@ -34,13 +36,15 @@ import org.slf4j.LoggerFactory;
/**
* Utility class that generates default implementations of the three types of ontology scope.
*
- * @author alessandro
- *
*/
public class OntologySpaceFactoryImpl implements OntologySpaceFactory {
protected Logger log = LoggerFactory.getLogger(getClass());
+ protected OWLOntologyManagerFactoryImpl mgrFactory;
+
+ protected OfflineConfiguration offline;
+
protected ScopeRegistry registry;
/*
@@ -48,59 +52,15 @@ public class OntologySpaceFactoryImpl im
* Stanbol)
*/
protected ClerezzaOntologyStorage storage;
-
- protected OWLOntologyManagerFactoryImpl mgrFactory;
- public OntologySpaceFactoryImpl(ScopeRegistry registry, ClerezzaOntologyStorage storage, OWLOntologyManagerFactoryImpl mgrFactory) {
+ public OntologySpaceFactoryImpl(ScopeRegistry registry,
+ ClerezzaOntologyStorage storage,
+ OWLOntologyManagerFactoryImpl mgrFactory) {
this.registry = registry;
this.storage = storage;
this.mgrFactory = mgrFactory;
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.stanbol.ontologymanager.ontonet.api.ontology.OntologySpaceFactory#createCoreOntologySpace
- * (org.semanticweb.owlapi.model.IRI,
- * org.apache.stanbol.ontologymanager.ontonet.api.io.OntologyInputSource)
- */
- @Override
- public CoreOntologySpace createCoreOntologySpace(IRI scopeID, OntologyInputSource coreSource) {
- CoreOntologySpace s = new CoreOntologySpaceImpl(scopeID, storage,mgrFactory.createOntologyManager(true));
- configureSpace(s, scopeID, coreSource);
- return s;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.stanbol.ontologymanager.ontonet.api.ontology.OntologySpaceFactory#createCustomOntologySpace
- * (org.semanticweb.owlapi.model.IRI,
- * org.apache.stanbol.ontologymanager.ontonet.api.io.OntologyInputSource)
- */
- @Override
- public CustomOntologySpace createCustomOntologySpace(IRI scopeID, OntologyInputSource customSource) {
- CustomOntologySpace s = new CustomOntologySpaceImpl(scopeID, storage,mgrFactory.createOntologyManager(true));
- configureSpace(s, scopeID, customSource);
- return s;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.stanbol.ontologymanager.ontonet.api.ontology.OntologySpaceFactory#createSessionOntologySpace
- * (org.semanticweb.owlapi.model.IRI)
- */
- @Override
- public SessionOntologySpace createSessionOntologySpace(IRI scopeID) {
- SessionOntologySpace s = new SessionOntologySpaceImpl(scopeID, storage,mgrFactory.createOntologyManager(true));
- // s.setUp();
- return s;
- }
-
/**
* Utility method for configuring ontology spaces after creating them.
*
@@ -108,7 +68,7 @@ public class OntologySpaceFactoryImpl im
* @param scopeID
* @param rootSource
*/
- private void configureSpace(OntologySpace s, IRI scopeID, OntologyInputSource rootSource) {
+ private void configureSpace(OntologySpace s, IRI scopeID, OntologyInputSource... rootSource) {
// FIXME: ensure that this is not null
OntologyScope parentScope = registry.getScope(scopeID);
@@ -116,11 +76,74 @@ public class OntologySpaceFactoryImpl im
.addOntologySpaceListener((OntologySpaceListener) parentScope);
// Set the supplied ontology's parent as the root for this space.
try {
- s.setTopOntology(rootSource, true);
+ // FIXME USE THE WHOLE ARRAY
+ s.setTopOntology(rootSource[0], true);
} catch (UnmodifiableOntologySpaceException e) {
log.error("Ontology space " + s.getID() + " was found locked at creation time!", e);
}
// s.setUp();
}
+ @Override
+ public CoreOntologySpace createCoreOntologySpace(IRI scopeId, OntologyInputSource coreSource) {
+ return createCoreOntologySpace(scopeId, new OntologyInputSource[] {coreSource});
+ }
+
+ @Override
+ public CoreOntologySpace createCoreOntologySpace(IRI scopeId, OntologyInputSource... coreSources) {
+ CoreOntologySpace s = new CoreOntologySpaceImpl(scopeId, storage,
+ mgrFactory.createOntologyManager(true));
+ configureSpace(s, scopeId, coreSources);
+ return s;
+ }
+
+ @Override
+ public CustomOntologySpace createCustomOntologySpace(IRI scopeId, OntologyInputSource customSource) {
+ return createCustomOntologySpace(scopeId, new OntologyInputSource[] {customSource});
+ }
+
+ @Override
+ public CustomOntologySpace createCustomOntologySpace(IRI scopeId, OntologyInputSource... customSources) {
+ CustomOntologySpace s = new CustomOntologySpaceImpl(scopeId, storage,
+ mgrFactory.createOntologyManager(true));
+ configureSpace(s, scopeId, customSources);
+ return s;
+ }
+
+ @Override
+ public OntologySpace createOntologySpace(IRI scopeId,
+ SpaceType type,
+ OntologyInputSource... ontologySources) {
+ switch (type) {
+ case CORE:
+ return createCoreOntologySpace(scopeId, ontologySources);
+ case CUSTOM:
+ return createCustomOntologySpace(scopeId, ontologySources);
+ case SESSION:
+ return createSessionOntologySpace(scopeId, ontologySources);
+ default:
+ return null;
+ }
+ }
+
+ @Override
+ public SessionOntologySpace createSessionOntologySpace(IRI scopeId) {
+ return createSessionOntologySpace(scopeId, new OntologyInputSource[] {});
+ }
+
+ @Override
+ public SessionOntologySpace createSessionOntologySpace(IRI scopeId, OntologyInputSource... sessionSources) {
+ SessionOntologySpace s = new SessionOntologySpaceImpl(scopeId, storage,
+ mgrFactory.createOntologyManager(true));
+ for (OntologyInputSource src : sessionSources)
+ try {
+ s.addOntology(src);
+ } catch (UnmodifiableOntologySpaceException e) {
+ // Should never happen anyway...
+ continue;
+ }
+ // s.setUp();
+ return s;
+ }
+
}
Modified: incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/ontology/SessionOntologySpaceImpl.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/ontology/SessionOntologySpaceImpl.java?rev=1153185&r1=1153184&r2=1153185&view=diff
==============================================================================
--- incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/ontology/SessionOntologySpaceImpl.java (original)
+++ incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/ontology/SessionOntologySpaceImpl.java Tue Aug 2 16:42:48 2011
@@ -1,19 +1,19 @@
/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.stanbol.ontologymanager.ontonet.impl.ontology;
import java.util.Random;
@@ -32,105 +32,84 @@ import org.semanticweb.owlapi.model.OWLO
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+/**
+ * Default implementation of the session ontology space.
+ */
+public class SessionOntologySpaceImpl extends AbstractOntologySpaceImpl implements SessionOntologySpace {
+
+ public static final String SUFFIX = SpaceType.SESSION.getIRISuffix();
+
+ public SessionOntologySpaceImpl(IRI scopeID, ClerezzaOntologyStorage store) {
+ // FIXME : sync session id with session space ID
+ super(IRI.create(StringUtils.stripIRITerminator(scopeID) + "/" + SpaceType.SESSION.getIRISuffix()
+ + "-" + new Random().nextLong()), SpaceType.SESSION, store/* , scopeID */);
-public class SessionOntologySpaceImpl extends AbstractOntologySpaceImpl
- implements SessionOntologySpace {
+ IRI iri = IRI.create(StringUtils.stripIRITerminator(getID()) + "/root.owl");
+ try {
+ setTopOntology(new RootOntologySource(ontologyManager.createOntology(iri), null), false);
+ } catch (OWLOntologyCreationException e) {
+ log.error("Could not create session space root ontology " + iri, e);
+ } catch (UnmodifiableOntologySpaceException e) {
+ // Should not happen...
+ log.error("Session space ontology " + iri
+ + " was denied modification by the space itself. This should not happen.", e);
+ }
+ }
-
- public static final String SUFFIX = SpaceType.SESSION.getIRISuffix();
-// static {
-// SUFFIX = SpaceType.SESSION.getIRISuffix();
-// }
-
- public SessionOntologySpaceImpl(IRI scopeID, ClerezzaOntologyStorage store) {
- // FIXME : sync session id with session space ID
- super(IRI.create(StringUtils.stripIRITerminator(scopeID) + "/"
- + SpaceType.SESSION.getIRISuffix() + "-"
- + new Random().nextLong()), SpaceType.SESSION, store/*, scopeID*/);
-
- IRI iri = IRI.create(StringUtils.stripIRITerminator(getID())
- + "/root.owl");
- try {
- setTopOntology(new RootOntologySource(ontologyManager
- .createOntology(iri), null), false);
- } catch (OWLOntologyCreationException e) {
- log.error("KReS :: Could not create session space root ontology "
- + iri, e);
- } catch (UnmodifiableOntologySpaceException e) {
- // Should not happen...
- log
- .error(
- "KReS :: Session space ontology "
- + iri
- + " was denied modification by the space itself. This should not happen.",
- e);
- }
- }
-
- public SessionOntologySpaceImpl(IRI scopeID, ClerezzaOntologyStorage store,
- OWLOntologyManager ontologyManager) {
-
- // FIXME : sync session id with session space ID
- super(IRI.create(StringUtils.stripIRITerminator(scopeID) + "/"
- + SpaceType.SESSION.getIRISuffix() + "-"
- + new Random().nextLong()), SpaceType.SESSION, store, /*scopeID,*/ ontologyManager);
-
- Logger log = LoggerFactory.getLogger(getClass());
- IRI iri = IRI.create(StringUtils.stripIRITerminator(getID())
- + "/root.owl");
- try {
- setTopOntology(new RootOntologySource(ontologyManager
- .createOntology(iri), null), false);
- } catch (OWLOntologyCreationException e) {
- log.error("KReS :: Could not create session space root ontology "
- + iri, e);
- } catch (UnmodifiableOntologySpaceException e) {
- // Should not happen...
- log
- .error(
- "KReS :: Session space ontology "
- + iri
- + " was denied modification by the space itself. This should not happen.",
- e);
- }
- }
-
- /**
- * Session spaces expose their ontology managers.
- */
- @Override
- public OWLOntologyManager getOntologyManager() {
- return ontologyManager;
- }
-
- /**
- * Once it is set up, a session space is write-enabled.
- */
- @Override
- public synchronized void setUp() {
- locked = false;
- }
-
- @Override
- public synchronized void tearDown() {
- // TODO Auto-generated method stub
- }
+ public SessionOntologySpaceImpl(IRI scopeID,
+ ClerezzaOntologyStorage store,
+ OWLOntologyManager ontologyManager) {
+
+ // FIXME : sync session id with session space ID
+ super(IRI.create(StringUtils.stripIRITerminator(scopeID) + "/" + SpaceType.SESSION.getIRISuffix()
+ + "-" + new Random().nextLong()), SpaceType.SESSION, store, /* scopeID, */
+ ontologyManager);
+
+ Logger log = LoggerFactory.getLogger(getClass());
+ IRI iri = IRI.create(StringUtils.stripIRITerminator(getID()) + "/root.owl");
+ try {
+ setTopOntology(new RootOntologySource(ontologyManager.createOntology(iri), null), false);
+ } catch (OWLOntologyCreationException e) {
+ log.error("Could not create session space root ontology " + iri, e);
+ } catch (UnmodifiableOntologySpaceException e) {
+ // Should not happen...
+ log.error("Session space ontology " + iri
+ + " was denied modification by the space itself. This should not happen.", e);
+ }
+ }
@Override
public void attachSpace(OntologySpace space, boolean skipRoot) throws UnmodifiableOntologySpaceException {
if (!(space instanceof SessionOntologySpace)) {
- OWLOntology o = space.getTopOntology();
- // This does the append thingy
- log.debug("Attaching " + o + " TO " + getTopOntology() + " ...");
- try {
- // It is in fact the addition of the core space top ontology to the
- // custom space, with import statements and all.
- addOntology(new RootOntologySource(o, null));
- // log.debug("ok");
- } catch (Exception ex) {
- log.error("FAILED", ex);
- }
+ OWLOntology o = space.getTopOntology();
+ // This does the append thingy
+ log.debug("Attaching " + o + " TO " + getTopOntology() + " ...");
+ try {
+ // It is in fact the addition of the core space top ontology to the
+ // custom space, with import statements and all.
+ addOntology(new RootOntologySource(o, null));
+ // log.debug("ok");
+ } catch (Exception ex) {
+ log.error("FAILED", ex);
+ }
}
}
+ @Override
+ public OWLOntologyManager getOntologyManager() {
+ // Session spaces do expose their ontology managers.
+ return ontologyManager;
+ }
+
+ @Override
+ public synchronized void setUp() {
+ // Once it is set up, a session space is write-enabled.
+ locked = false;
+ }
+
+ @Override
+ public synchronized void tearDown() {
+ // TODO Auto-generated method stub
+ }
+
}