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/07/19 20:17:30 UTC
svn commit: r1148469 [2/2] - in
/incubator/stanbol/trunk/ontologymanager/ontonet/src:
main/java/org/apache/stanbol/ontologymanager/ontonet/api/registry/
main/java/org/apache/stanbol/ontologymanager/ontonet/api/registry/io/
main/java/org/apache/stanbol/...
Copied: incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/registry/model/RegistryLibraryImpl.java (from r1147966, incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/registry/models/RegistryLibrary.java)
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/registry/model/RegistryLibraryImpl.java?p2=incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/registry/model/RegistryLibraryImpl.java&p1=incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/registry/models/RegistryLibrary.java&r1=1147966&r2=1148469&rev=1148469&view=diff
==============================================================================
--- incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/registry/models/RegistryLibrary.java (original)
+++ incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/registry/model/RegistryLibraryImpl.java Tue Jul 19 18:17:23 2011
@@ -1,64 +1,44 @@
/*
-* 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.registry.models;
-
-
-import java.util.ArrayList;
-
-
-public class RegistryLibrary extends AbstractRegistryItem {
-
- private ArrayList<AbstractRegistryItem> children;
-
- public RegistryLibrary(String name) {
- super(name);
- children = new ArrayList<AbstractRegistryItem>();
- }
-
- public void addChild(AbstractRegistryItem child) {
- children.add(child);
- child.setParent(this);
- }
-
- public void removeChild(RegistryItem child) {
- children.remove(child);
- child.setParent(null);
- }
-
- public void removeChildren(){
- children = new ArrayList<AbstractRegistryItem>();
- }
- public RegistryItem[] getChildren() {
- return children
- .toArray(new AbstractRegistryItem[children.size()]);
- }
-
- public boolean hasChildren() {
- return children.size() > 0;
- }
-
- @Override
- public boolean isLibrary() {
- return true;
- }
-
- @Override
- public boolean isOntology() {
- return false;
- }
+ * 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.registry.model;
+
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import org.apache.stanbol.ontologymanager.ontonet.api.registry.models.Library;
+
+public class RegistryLibraryImpl extends AbstractRegistryItem implements Library {
+
+ public RegistryLibraryImpl(String name) {
+ super(name);
+ }
+
+ public RegistryLibraryImpl(String name, URL url) throws URISyntaxException {
+ super(name, url);
+ }
+
+ @Override
+ public boolean isLibrary() {
+ return true;
+ }
+
+ @Override
+ public boolean isOntology() {
+ return false;
+ }
}
Copied: incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/registry/model/RegistryOntologyImpl.java (from r1147966, incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/registry/models/RegistryOntology.java)
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/registry/model/RegistryOntologyImpl.java?p2=incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/registry/model/RegistryOntologyImpl.java&p1=incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/registry/models/RegistryOntology.java&r1=1147966&r2=1148469&rev=1148469&view=diff
==============================================================================
--- incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/registry/models/RegistryOntology.java (original)
+++ incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/registry/model/RegistryOntologyImpl.java Tue Jul 19 18:17:23 2011
@@ -1,36 +1,50 @@
/*
-* 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.registry.models;
-
-
-
-public class RegistryOntology extends AbstractRegistryItem {
-
- public RegistryOntology(String name) {
- super(name);
- }
-
- @Override
- public boolean isLibrary() {
- return false;
- }
-
- @Override
- public boolean isOntology() {
- return true;
- }
+ * 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.registry.model;
+
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import org.apache.stanbol.ontologymanager.ontonet.api.registry.models.RegistryOntology;
+import org.semanticweb.owlapi.model.OWLOntology;
+
+public class RegistryOntologyImpl extends AbstractRegistryItem implements RegistryOntology {
+
+ public RegistryOntologyImpl(String name) {
+ super(name);
+ }
+
+ public RegistryOntologyImpl(String name, URL url) throws URISyntaxException {
+ super(name, url);
+ }
+
+ @Override
+ public boolean isLibrary() {
+ return false;
+ }
+
+ @Override
+ public boolean isOntology() {
+ return true;
+ }
+
+ @Override
+ public OWLOntology asOWLOntology() {
+ // TODO Implement me!
+ return null;
+ }
}
Modified: incubator/stanbol/trunk/ontologymanager/ontonet/src/main/resources/OSGI-INF/metatype/metatype.properties
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/ontologymanager/ontonet/src/main/resources/OSGI-INF/metatype/metatype.properties?rev=1148469&r1=1148468&r2=1148469&view=diff
==============================================================================
--- incubator/stanbol/trunk/ontologymanager/ontonet/src/main/resources/OSGI-INF/metatype/metatype.properties (original)
+++ incubator/stanbol/trunk/ontologymanager/ontonet/src/main/resources/OSGI-INF/metatype/metatype.properties Tue Jul 19 18:17:23 2011
@@ -36,4 +36,22 @@ org.apache.stanbol.ontologymanager.onton
org.apache.stanbol.ontologymanager.ontonet.onconfig.description = The physical location of the ontology storing the configuration of the Stanbol ontology network. Can be an absolute URI or a file path (either absolute or relative to the bundle resource directory).
org.apache.stanbol.ontologymanager.ontonet.ontologypaths.name = Ontology directories
-org.apache.stanbol.ontologymanager.ontonet.ontologypaths.description = The local directories for ontology sources.
\ No newline at end of file
+org.apache.stanbol.ontologymanager.ontonet.ontologypaths.description = The local directories for ontology sources.
+
+
+#===============================================================================
+#Properties defined by the Registry Manager
+#===============================================================================
+org.apache.stanbol.ontologymanager.ontonet.impl.registry.RegistryManagerImpl.name = Apache Stanbol Ontology Registry Manager
+org.apache.stanbol.ontologymanager.ontonet.impl.registry.RegistryManagerImpl.description = Manages the loading and indexing of ontology registries and libraries.
+
+org.apache.stanbol.ontologymanager.ontonet.registryCaching.name = Caching policy
+org.apache.stanbol.ontologymanager.ontonet.registryCaching.description = Specifies if ontology caching should spread across all registries or maintained separate for each registry.
+org.apache.stanbol.ontologymanager.ontonet.registryCaching.option.registry = Per Registry
+org.apache.stanbol.ontologymanager.ontonet.registryCaching.option.all = All Registries
+
+org.apache.stanbol.ontologymanager.ontonet.registryLazy.name = Lazy ontology loading
+org.apache.stanbol.ontologymanager.ontonet.registryLazy.description = If set, the ontologies referenced in a library will not be loaded until the library is requested.
+
+org.apache.stanbol.ontologymanager.ontonet.registryLocations.name = Registry locations
+org.apache.stanbol.ontologymanager.ontonet.registryLocations.description = The physical URLs of the ontology registry OWL files.
\ No newline at end of file
Modified: incubator/stanbol/trunk/ontologymanager/ontonet/src/test/java/org/apache/stanbol/ontologymanager/ontonet/registry/TestOntologyLibrary.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/ontologymanager/ontonet/src/test/java/org/apache/stanbol/ontologymanager/ontonet/registry/TestOntologyLibrary.java?rev=1148469&r1=1148468&r2=1148469&view=diff
==============================================================================
--- incubator/stanbol/trunk/ontologymanager/ontonet/src/test/java/org/apache/stanbol/ontologymanager/ontonet/registry/TestOntologyLibrary.java (original)
+++ incubator/stanbol/trunk/ontologymanager/ontonet/src/test/java/org/apache/stanbol/ontologymanager/ontonet/registry/TestOntologyLibrary.java Tue Jul 19 18:17:23 2011
@@ -29,10 +29,10 @@ import org.apache.stanbol.ontologymanage
import org.apache.stanbol.ontologymanager.ontonet.api.registry.io.LibrarySource;
import org.apache.stanbol.ontologymanager.ontonet.api.registry.models.Registry;
import org.apache.stanbol.ontologymanager.ontonet.api.registry.models.RegistryItem;
-import org.apache.stanbol.ontologymanager.ontonet.api.registry.models.RegistryLibrary;
import org.apache.stanbol.ontologymanager.ontonet.impl.ONManagerConfigurationImpl;
import org.apache.stanbol.ontologymanager.ontonet.impl.ONManagerImpl;
-import org.apache.stanbol.ontologymanager.ontonet.impl.registry.model.impl.RegistryLoaderImpl;
+import org.apache.stanbol.ontologymanager.ontonet.impl.registry.RegistryLoaderImpl;
+import org.apache.stanbol.ontologymanager.ontonet.impl.registry.model.RegistryImpl;
import org.junit.Before;
import org.junit.Test;
import org.semanticweb.owlapi.model.IRI;
@@ -40,6 +40,10 @@ import org.semanticweb.owlapi.model.OWLI
import org.semanticweb.owlapi.model.OWLOntology;
import org.semanticweb.owlapi.util.AutoIRIMapper;
+/**
+ * This class tests the correct loading of ontology libraries from an OWL repository. It also checks that
+ * ontologies referred to only by other libraries in the same repository are not loaded.
+ */
public class TestOntologyLibrary {
private String registryResource = "/ontologies/registry/krestest.owl";
@@ -49,7 +53,7 @@ public class TestOntologyLibrary {
private RegistryLoader loader;
/**
- * Reset the ontology network manager and registry loader.
+ * Reset the ontology network manager and registry loader before running each test.
*/
@Before
public void setupTest() throws Exception {
@@ -81,9 +85,9 @@ public class TestOntologyLibrary {
} catch (Exception e) {
return false;
}
- } else if (item.isLibrary() || item instanceof Registry)
+ } else if (item.isLibrary() || item instanceof RegistryImpl)
// Inspect children
- for (RegistryItem child : ((RegistryLibrary) item).getChildren()) {
+ for (RegistryItem child : ((RegistryItem) item).getChildren()) {
result |= containsOntologyRecursive(child, ontologyId);
if (result) break;
}
@@ -100,7 +104,7 @@ public class TestOntologyLibrary {
@Test
public void testLibraryLoad() throws Exception {
IRI localTestRegistry = IRI.create(getClass().getResource(registryResource));
- RegistryLibrary lib = loader.loadLibraryEager(localTestRegistry, Locations.LIBRARY_TEST2);
+ Registry lib = loader.loadLibraryEager(localTestRegistry, Locations.LIBRARY_TEST2);
assertTrue(lib.hasChildren());
// Should be in the library.
boolean hasSituation = containsOntologyRecursive(lib, Locations.ODP_SITUATION);
@@ -109,6 +113,12 @@ public class TestOntologyLibrary {
assertTrue(hasSituation && !hasTypes);
}
+ /**
+ * Tests the creation of an ontology input source from a single library. Because the test is run offline,
+ * import statements might be file URIs, so tests will not fail on this.
+ *
+ * @throws Exception
+ */
@Test
public void testLibrarySourceCreation() throws Exception {
IRI localTestRegistry = IRI.create(getClass().getResource(registryResource));