diff --git a/.gitignore b/.gitignore index 984ca1b..f04a2c3 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,7 @@ *.idea .DS_Store *.class -*.class -target/ +target +.project +.classpath +.settings \ No newline at end of file diff --git a/distribution/pom.xml b/distribution/pom.xml index 97ce5af..23a9f76 100644 --- a/distribution/pom.xml +++ b/distribution/pom.xml @@ -5,7 +5,7 @@ skos-api skos-api - 3.1 + 3.2-SNAPSHOT 4.0.0 diff --git a/pom.xml b/pom.xml index 1bc7b3c..bc3f402 100644 --- a/pom.xml +++ b/pom.xml @@ -24,8 +24,8 @@ maven-compiler-plugin 3.1 - 1.6 - 1.6 + 1.7 + 1.7 @@ -34,7 +34,7 @@ skos-api skos-api pom - 3.1 + 3.2-SNAPSHOT skos-core skos-impl diff --git a/skos-api-onejar.jar b/skos-api-onejar.jar index b658519..1c68f4f 100644 Binary files a/skos-api-onejar.jar and b/skos-api-onejar.jar differ diff --git a/skos-core/pom.xml b/skos-core/pom.xml index 0e3b18c..716c5c1 100644 --- a/skos-core/pom.xml +++ b/skos-core/pom.xml @@ -5,7 +5,7 @@ skos-api skos-api - 3.1 + 3.2-SNAPSHOT 4.0.0 diff --git a/skos-example/pom.xml b/skos-example/pom.xml index d9036d4..f83b0f4 100644 --- a/skos-example/pom.xml +++ b/skos-example/pom.xml @@ -5,7 +5,7 @@ skos-api skos-api - 3.1 + 3.2-SNAPSHOT 4.0.0 @@ -15,7 +15,7 @@ skos-api skos-impl - 3.1 + 3.2-SNAPSHOT diff --git a/skos-example/src/main/java/example/CreateSKOSExample.java b/skos-example/src/main/java/example/CreateSKOSExample.java index fe1c067..1188465 100644 --- a/skos-example/src/main/java/example/CreateSKOSExample.java +++ b/skos-example/src/main/java/example/CreateSKOSExample.java @@ -1,13 +1,5 @@ package example; -import org.semanticweb.owlapi.model.*; -import org.semanticweb.owlapi.vocab.DublinCoreVocabulary; -import org.semanticweb.skos.*; -import org.semanticweb.skos.properties.SKOSAltLabelProperty; -import org.semanticweb.skosapibinding.SKOSFormatExt; -import org.semanticweb.skosapibinding.SKOSManager; -import org.semanticweb.skosapibinding.SKOStoOWLConverter; - import java.net.URI; import java.util.ArrayList; import java.util.List; @@ -34,6 +26,38 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +import org.semanticweb.owlapi.model.AddAxiom; +import org.semanticweb.owlapi.model.OWLDataFactory; +import org.semanticweb.owlapi.model.OWLOntologyChangeException; +import org.semanticweb.owlapi.model.OWLOntologyManager; +import org.semanticweb.owlapi.model.OWLSubAnnotationPropertyOfAxiom; +import org.semanticweb.owlapi.vocab.DublinCoreVocabulary; +import org.semanticweb.skos.AddAssertion; +import org.semanticweb.skos.SKOSAnnotation; +import org.semanticweb.skos.SKOSAnnotationAssertion; +import org.semanticweb.skos.SKOSAnnotationProperty; +import org.semanticweb.skos.SKOSChange; +import org.semanticweb.skos.SKOSChangeException; +import org.semanticweb.skos.SKOSConcept; +import org.semanticweb.skos.SKOSConceptScheme; +import org.semanticweb.skos.SKOSCreationException; +import org.semanticweb.skos.SKOSDataFactory; +import org.semanticweb.skos.SKOSDataRelationAssertion; +import org.semanticweb.skos.SKOSDataset; +import org.semanticweb.skos.SKOSEntity; +import org.semanticweb.skos.SKOSEntityAssertion; +import org.semanticweb.skos.SKOSLiteral; +import org.semanticweb.skos.SKOSObject; +import org.semanticweb.skos.SKOSObjectRelationAssertion; +import org.semanticweb.skos.SKOSResource; +import org.semanticweb.skos.SKOSStorageException; +import org.semanticweb.skos.SKOSTypedLiteral; +import org.semanticweb.skos.SKOSUntypedLiteral; +import org.semanticweb.skos.properties.SKOSAltLabelProperty; +import org.semanticweb.skosapibinding.SKOSFormatExt; +import org.semanticweb.skosapibinding.SKOSManager; +import org.semanticweb.skosapibinding.SKOStoOWLConverter; + /** * Author: Simon Jupp
* Date: Mar 4, 2008
@@ -122,10 +146,10 @@ public static void main(String[] args) throws SKOSCreationException { * here is an example adding a dc:creator and a rdfs:comment */ - SKOSAnnotation anno1 = factory.getSKOSAnnotation(DublinCoreVocabulary.DATE.getURI(), "12-07-2008"); - SKOSAnnotation anno2 = factory.getSKOSAnnotation(DublinCoreVocabulary.CREATOR.getURI(), "Simon Jupp", "en"); + SKOSAnnotation anno1 = factory.getSKOSAnnotation(DublinCoreVocabulary.DATE.getIRI().toURI(), "12-07-2008"); + SKOSAnnotation anno2 = factory.getSKOSAnnotation(DublinCoreVocabulary.CREATOR.getIRI().toURI(), "Simon Jupp", "en"); SKOSAnnotation anno3 = factory.getSKOSAnnotation(URI.create("http://my-custom-annotation.com/example"), someResource); - SKOSAnnotation anno4 = factory.getSKOSAnnotation(DublinCoreVocabulary.CREATOR.getURI(), factory.getSKOSUntypedConstant("Simon Jupp", "en")); + SKOSAnnotation anno4 = factory.getSKOSAnnotation(DublinCoreVocabulary.CREATOR.getIRI().toURI(), factory.getSKOSUntypedConstant("Simon Jupp", "en")); // todo need to work on typed on objects //factory.getSKOSAnnotationsByURI(DublinCoreVocabulary.CREATOR.getURI(), factory.getSKOSTypedConstant("String", "Simon Jupp")); diff --git a/skos-example/src/main/java/example/Example4.java b/skos-example/src/main/java/example/Example4.java index 775df31..e79c206 100644 --- a/skos-example/src/main/java/example/Example4.java +++ b/skos-example/src/main/java/example/Example4.java @@ -1,15 +1,5 @@ package example; -import org.semanticweb.owlapi.model.OWLObjectProperty; -import org.semanticweb.owlapi.model.OWLObjectPropertyExpression; -import org.semanticweb.owlapi.model.OWLOntology; -import org.semanticweb.skos.SKOSCreationException; -import org.semanticweb.skos.SKOSDataFactory; -import org.semanticweb.skos.SKOSDataset; -import org.semanticweb.skos.SKOSObjectProperty; -import org.semanticweb.skosapibinding.SKOSManager; -import org.semanticweb.skosapibinding.SKOStoOWLConverter; - import java.net.URI; /* * Copyright (C) 2007, University of Manchester @@ -34,6 +24,17 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +import org.semanticweb.owlapi.model.OWLObjectProperty; +import org.semanticweb.owlapi.model.OWLObjectPropertyExpression; +import org.semanticweb.owlapi.model.OWLOntology; +import org.semanticweb.owlapi.search.EntitySearcher; +import org.semanticweb.skos.SKOSCreationException; +import org.semanticweb.skos.SKOSDataFactory; +import org.semanticweb.skos.SKOSDataset; +import org.semanticweb.skos.SKOSObjectProperty; +import org.semanticweb.skosapibinding.SKOSManager; +import org.semanticweb.skosapibinding.SKOStoOWLConverter; + /** * Author: Simon Jupp
* Date: Aug 26, 2009
@@ -59,7 +60,7 @@ public static void main(String[] args) { // get the SKOS dataset as an owl ontology object OWLOntology onto = conv.getAsOWLOntology(dataset); //query the owl ontology for superproperties - for (OWLObjectPropertyExpression prop : owlPartOf.getSuperProperties(onto)) { + for (OWLObjectPropertyExpression prop : EntitySearcher.getSuperProperties(owlPartOf, onto)) { System.out.println(prop.asOWLObjectProperty().getIRI()); } diff --git a/skos-example/src/main/java/example/ReadInferredSKOS.java b/skos-example/src/main/java/example/ReadInferredSKOS.java index dd93944..9a45ff7 100644 --- a/skos-example/src/main/java/example/ReadInferredSKOS.java +++ b/skos-example/src/main/java/example/ReadInferredSKOS.java @@ -1,16 +1,5 @@ package example; -import org.semanticweb.owlapi.apibinding.OWLManager; -import org.semanticweb.owlapi.model.*; -import org.semanticweb.owlapi.reasoner.BufferingMode; -import org.semanticweb.owlapi.reasoner.OWLReasoner; -import org.semanticweb.owlapi.reasoner.OWLReasonerFactory; -import org.semanticweb.skos.*; -import org.semanticweb.skosapibinding.SKOSFormatExt; -import org.semanticweb.skosapibinding.SKOSManager; -import org.semanticweb.skosapibinding.SKOSReasoner; -import org.semanticweb.skosapibinding.SKOStoOWLConverter; - import java.net.URI; /* * Copyright (C) 2007, University of Manchester @@ -35,6 +24,16 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +import org.semanticweb.owlapi.model.AddImport; +import org.semanticweb.owlapi.model.IRI; +import org.semanticweb.owlapi.model.OWLImportsDeclaration; +import org.semanticweb.owlapi.model.OWLOntology; +import org.semanticweb.owlapi.model.parameters.ChangeApplied; +import org.semanticweb.skos.SKOSCreationException; +import org.semanticweb.skos.SKOSDataset; +import org.semanticweb.skosapibinding.SKOSManager; +import org.semanticweb.skosapibinding.SKOStoOWLConverter; + /** * Author: Simon Jupp
* Date: Aug 28, 2008
@@ -95,8 +94,9 @@ public static void main(String[] args) { OWLImportsDeclaration importsDec = manager.getOWLManger().getOWLDataFactory().getOWLImportsDeclaration(IRI.create ("http://www.w3.org/2004/02/skos/core")); - for (OWLOntologyChange change: manager.getOWLManger().applyChange(new AddImport(mySkosAsOWLOntology, importsDec))) { - System.out.println(change.toString()); + AddImport addImport = new AddImport(mySkosAsOWLOntology, importsDec); + if( manager.getOWLManger().applyChange(addImport)==ChangeApplied.SUCCESSFULLY) { + System.out.println(addImport.toString()); } // SKOSDataset skosCoreOntology = manager.loadDataset(URI.create("http://www.w3.org/2004/02/skos/core")); diff --git a/skos-impl/pom.xml b/skos-impl/pom.xml index f6389d4..663cdee 100644 --- a/skos-impl/pom.xml +++ b/skos-impl/pom.xml @@ -5,7 +5,7 @@ skos-api skos-api - 3.1 + 3.2-SNAPSHOT 4.0.0 @@ -16,13 +16,13 @@ skos-api skos-core - 3.1 + 3.2-SNAPSHOT net.sourceforge.owlapi - owlapi-distribution - 3.4.10 + owlapi-osgidistribution + [4.0.2,4.1) diff --git a/skos-impl/src/main/java/org/semanticweb/skosapibinding/SKOSFormatExt.java b/skos-impl/src/main/java/org/semanticweb/skosapibinding/SKOSFormatExt.java index e9d7673..b1ae1e5 100644 --- a/skos-impl/src/main/java/org/semanticweb/skosapibinding/SKOSFormatExt.java +++ b/skos-impl/src/main/java/org/semanticweb/skosapibinding/SKOSFormatExt.java @@ -1,10 +1,11 @@ package org.semanticweb.skosapibinding; -import org.coode.owlapi.manchesterowlsyntax.ManchesterOWLSyntaxOntologyFormat; -import org.coode.owlapi.turtle.TurtleOntologyFormat; -import org.semanticweb.owlapi.io.OWLXMLOntologyFormat; -import org.semanticweb.owlapi.io.RDFXMLOntologyFormat; -import org.semanticweb.owlapi.model.OWLOntologyFormat; +import org.semanticweb.owlapi.formats.ManchesterSyntaxDocumentFormatFactory; +import org.semanticweb.owlapi.formats.OWLXMLDocumentFormatFactory; +import org.semanticweb.owlapi.formats.RDFXMLDocumentFormatFactory; +import org.semanticweb.owlapi.formats.TurtleDocumentFormatFactory; +import org.semanticweb.owlapi.model.OWLDocumentFormat; +import org.semanticweb.owlapi.model.OWLDocumentFormatFactory; import org.semanticweb.skos.SKOSFormat; import org.semanticweb.skos.SKOSUnkownFormatException; @@ -41,37 +42,23 @@ public enum SKOSFormatExt implements SKOSFormat { // RDFXML(new OWLXMLVocabulary()); - RDFXML("RDFXML") , + RDFXML(new RDFXMLDocumentFormatFactory()) , - TURTRLE("TURTLE"), + TURTRLE(new TurtleDocumentFormatFactory()), - OWLXML("OWLXML"), + OWLXML(new OWLXMLDocumentFormatFactory()), - MOS("MOS"); + MOS(new ManchesterSyntaxDocumentFormatFactory()); - private String localName; + private OWLDocumentFormatFactory factory; - SKOSFormatExt(String localname) { - this.localName = localname; + SKOSFormatExt(OWLDocumentFormatFactory factory) { + this.factory=factory; } - public OWLOntologyFormat getFormat() throws SKOSUnkownFormatException { - - if (localName.equals("RDFXML")) { - return new RDFXMLOntologyFormat(); - } - else if (localName.equals("OWLXML")) { - return new OWLXMLOntologyFormat(); - } - else if (localName.equals("MOS")) { - return new ManchesterOWLSyntaxOntologyFormat(); - } - else if (localName.equals("TURTLE")) { - return new TurtleOntologyFormat(); - } - - throw new SKOSUnkownFormatException("Unknown format: " + localName); + public OWLDocumentFormat getFormat() throws SKOSUnkownFormatException { + return factory.createFormat(); } } diff --git a/skos-impl/src/main/java/org/semanticweb/skosapibinding/SKOSManager.java b/skos-impl/src/main/java/org/semanticweb/skosapibinding/SKOSManager.java index d0cf9dd..a7d0daa 100644 --- a/skos-impl/src/main/java/org/semanticweb/skosapibinding/SKOSManager.java +++ b/skos-impl/src/main/java/org/semanticweb/skosapibinding/SKOSManager.java @@ -1,15 +1,11 @@ package org.semanticweb.skosapibinding; -import org.semanticweb.owlapi.apibinding.OWLManager; -import org.semanticweb.owlapi.io.RDFXMLOntologyFormat; -import org.semanticweb.owlapi.model.*; -import org.semanticweb.owlapi.util.BidirectionalShortFormProviderAdapter; -import org.semanticweb.skos.*; -import uk.ac.manchester.cs.skos.SKOSDataFactoryImpl; -import uk.ac.manchester.cs.skos.SKOSDatasetImpl; - import java.net.URI; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; /* * Copyright (C) 2007, University of Manchester * @@ -33,6 +29,35 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +import org.semanticweb.owlapi.apibinding.OWLManager; +import org.semanticweb.owlapi.formats.RDFXMLDocumentFormat; +import org.semanticweb.owlapi.model.AddAxiom; +import org.semanticweb.owlapi.model.IRI; +import org.semanticweb.owlapi.model.OWLDocumentFormat; +import org.semanticweb.owlapi.model.OWLOntology; +import org.semanticweb.owlapi.model.OWLOntologyChange; +import org.semanticweb.owlapi.model.OWLOntologyChangeException; +import org.semanticweb.owlapi.model.OWLOntologyCreationException; +import org.semanticweb.owlapi.model.OWLOntologyManager; +import org.semanticweb.owlapi.model.OWLOntologyStorageException; +import org.semanticweb.owlapi.model.RemoveAxiom; +import org.semanticweb.owlapi.model.parameters.ChangeApplied; +import org.semanticweb.owlapi.util.BidirectionalShortFormProviderAdapter; +import org.semanticweb.skos.SKOSAssertion; +import org.semanticweb.skos.SKOSChange; +import org.semanticweb.skos.SKOSChangeException; +import org.semanticweb.skos.SKOSContentManager; +import org.semanticweb.skos.SKOSCreationException; +import org.semanticweb.skos.SKOSDataFactory; +import org.semanticweb.skos.SKOSDataset; +import org.semanticweb.skos.SKOSFormat; +import org.semanticweb.skos.SKOSInputSource; +import org.semanticweb.skos.SKOSStorageException; +import org.semanticweb.skos.SKOSUnkownFormatException; + +import uk.ac.manchester.cs.skos.SKOSDataFactoryImpl; +import uk.ac.manchester.cs.skos.SKOSDatasetImpl; + /** * Author: Simon Jupp
* Date: Mar 4, 2008
@@ -68,10 +93,7 @@ public SKOSManager (OWLOntologyManager manager) { skosVocabularies = new HashMap(); for (OWLOntology ont : man.getOntologies()) { - IRI iri = ont.getOntologyID().getOntologyIRI(); - if (iri == null) { - iri = IRI.generateDocumentIRI(); - } + IRI iri = ont.getOntologyID().getOntologyIRI().or(IRI.generateDocumentIRI()); skosVocabularies.put(iri.toURI(), new SKOSDatasetImpl(this, ont)); } } @@ -167,18 +189,18 @@ public SKOSDataFactory getSKOSDataFactory() { public void save (SKOSDataset vocab, SKOSFormat format) throws SKOSStorageException { SKOSDatasetImpl setImpl = (SKOSDatasetImpl) vocab; try { - man.saveOntology(setImpl.getAsOWLOntology(), (OWLOntologyFormat) format.getFormat()); + man.saveOntology(setImpl.getAsOWLOntology(), (OWLDocumentFormat) format.getFormat()); } catch (OWLOntologyStorageException e) { - new SKOSStorageException(e); + throw new SKOSStorageException(e); } catch (SKOSUnkownFormatException e) { - e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. + e.printStackTrace(); } } public void save (SKOSDataset vocab, SKOSFormat format, URI uri) throws SKOSStorageException { SKOSDatasetImpl setImpl = (SKOSDatasetImpl) vocab; try { - man.saveOntology(setImpl.getAsOWLOntology(), new RDFXMLOntologyFormat(), IRI.create(uri)); + man.saveOntology(setImpl.getAsOWLOntology(), new RDFXMLDocumentFormat(), IRI.create(uri)); } catch (OWLOntologyStorageException e) { new SKOSStorageException(e); } @@ -245,16 +267,18 @@ public List applyChange(SKOSChange change) throws SKOSChangeExceptio List succesfulChanges = new ArrayList(); - List OWLChange = new ArrayList(); try { - OWLAxiomChange cha; if (change.isAdd()) { AddAxiom addAx = util.getAddAxiom(); - OWLChange = man.applyChange(addAx); + if (man.applyChange(addAx) == ChangeApplied.SUCCESSFULLY) { + succesfulChanges.add(change); + } } else if (change.isRemove()) { RemoveAxiom remAx = util.getRemoveAxiom(); - OWLChange = man.applyChange(remAx); + if (man.applyChange(remAx) == ChangeApplied.SUCCESSFULLY) { + succesfulChanges.add(change); + } } } catch (OWLOntologyChangeException e) { throw new SKOSChangeException(change, e); diff --git a/skos-impl/src/main/java/uk/ac/manchester/cs/skos/SKOSDatasetImpl.java b/skos-impl/src/main/java/uk/ac/manchester/cs/skos/SKOSDatasetImpl.java index 0dacc1a..5562af1 100644 --- a/skos-impl/src/main/java/uk/ac/manchester/cs/skos/SKOSDatasetImpl.java +++ b/skos-impl/src/main/java/uk/ac/manchester/cs/skos/SKOSDatasetImpl.java @@ -1,15 +1,11 @@ package uk.ac.manchester.cs.skos; -import org.semanticweb.owlapi.model.*; -import org.semanticweb.owlapi.util.BidirectionalShortFormProviderAdapter; -import org.semanticweb.owlapi.util.PropertyAssertionValueShortFormProvider; -import org.semanticweb.skos.*; -import org.semanticweb.skos.extensions.SKOSLabelRelation; -import org.semanticweb.skosapibinding.SKOSManager; -import org.semanticweb.skosapibinding.SKOStoOWLConverter; - import java.net.URI; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; /* * Copyright (C) 2007, University of Manchester * @@ -32,6 +28,52 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +import java.util.Set; + +import org.semanticweb.owlapi.model.IRI; +import org.semanticweb.owlapi.model.OWLAnnotation; +import org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom; +import org.semanticweb.owlapi.model.OWLAnnotationObjectVisitor; +import org.semanticweb.owlapi.model.OWLAnnotationPropertyDomainAxiom; +import org.semanticweb.owlapi.model.OWLAnnotationPropertyRangeAxiom; +import org.semanticweb.owlapi.model.OWLAnnotationValue; +import org.semanticweb.owlapi.model.OWLAnonymousIndividual; +import org.semanticweb.owlapi.model.OWLAxiom; +import org.semanticweb.owlapi.model.OWLClass; +import org.semanticweb.owlapi.model.OWLClassAssertionAxiom; +import org.semanticweb.owlapi.model.OWLClassExpression; +import org.semanticweb.owlapi.model.OWLDataPropertyAssertionAxiom; +import org.semanticweb.owlapi.model.OWLDataPropertyExpression; +import org.semanticweb.owlapi.model.OWLEntity; +import org.semanticweb.owlapi.model.OWLIndividual; +import org.semanticweb.owlapi.model.OWLLiteral; +import org.semanticweb.owlapi.model.OWLNamedIndividual; +import org.semanticweb.owlapi.model.OWLObjectPropertyAssertionAxiom; +import org.semanticweb.owlapi.model.OWLObjectPropertyExpression; +import org.semanticweb.owlapi.model.OWLOntology; +import org.semanticweb.owlapi.model.OWLOntologyCreationException; +import org.semanticweb.owlapi.model.OWLOntologyManager; +import org.semanticweb.owlapi.model.OWLPropertyExpression; +import org.semanticweb.owlapi.model.OWLSubAnnotationPropertyOfAxiom; +import org.semanticweb.owlapi.search.EntitySearcher; +import org.semanticweb.owlapi.util.BidirectionalShortFormProviderAdapter; +import org.semanticweb.owlapi.util.PropertyAssertionValueShortFormProvider; +import org.semanticweb.skos.SKOSAnnotation; +import org.semanticweb.skos.SKOSConcept; +import org.semanticweb.skos.SKOSConceptScheme; +import org.semanticweb.skos.SKOSCreationException; +import org.semanticweb.skos.SKOSDataProperty; +import org.semanticweb.skos.SKOSDataRelationAssertion; +import org.semanticweb.skos.SKOSDataType; +import org.semanticweb.skos.SKOSDataset; +import org.semanticweb.skos.SKOSEntity; +import org.semanticweb.skos.SKOSLiteral; +import org.semanticweb.skos.SKOSObjectProperty; +import org.semanticweb.skos.SKOSObjectRelationAssertion; +import org.semanticweb.skos.SKOSResource; +import org.semanticweb.skos.extensions.SKOSLabelRelation; +import org.semanticweb.skosapibinding.SKOSManager; +import org.semanticweb.skosapibinding.SKOStoOWLConverter; /** * Author: Simon Jupp
@@ -92,10 +134,10 @@ public SKOSEntity getSKOSEntity(String shortForm) { } public URI getURI() { - if (owlOntology.getOntologyID().getOntologyIRI() == null) { + if (!owlOntology.getOntologyID().getOntologyIRI().isPresent()) { return URI.create("http://skosapi.sourceforge.net/anonymous/" + Math.random()); } - return owlOntology.getOntologyID().getOntologyIRI().toURI(); + return owlOntology.getOntologyID().getOntologyIRI().get().toURI(); } public Set getSKOSConceptSchemes() { @@ -192,7 +234,7 @@ public Set getSKOSObjectRelationAssertions(SKOSEnti private SKOSEntity entityCreationHandler(OWLNamedIndividual ind) { - for (OWLClassExpression desc : ind.getTypes(owlOntology)) { + for (OWLClassExpression desc : EntitySearcher.getTypes(ind, owlOntology)) { if (desc instanceof OWLClass) { @@ -392,7 +434,7 @@ public Set getSKOSAnnotations(SKOSEntity entity) { AnnotationVisitor annoVis = new AnnotationVisitor(skosManContent); - for (OWLAnnotation anno : ind.asOWLNamedIndividual().getAnnotations(owlOntology)) { + for (OWLAnnotation anno : EntitySearcher.getAnnotations(ind.asOWLNamedIndividual(), owlOntology)) { OWLAnnotationValue value = anno.getValue(); value.accept(annoVis); @@ -509,7 +551,7 @@ protected void setUpShortFormProviders () { OWLDataPropertyExpression prop2 = man.getOWLDataFactory().getOWLDataProperty(IRI.create(SKOSRDFVocabulary.ALTLABEL.getURI())); OWLDataPropertyExpression prop3 = man.getOWLDataFactory().getOWLDataProperty(IRI.create(SKOSRDFVocabulary.HIDDENLABEL.getURI())); - List> list = new ArrayList>(); + List list = new ArrayList(); list.add(prop3); list.add(prop2); list.add(prop1); diff --git a/skos-impl/src/main/java/uk/ac/manchester/cs/skos/SKOSObjectPropertyUtility.java b/skos-impl/src/main/java/uk/ac/manchester/cs/skos/SKOSObjectPropertyUtility.java index 8943cbe..224437e 100644 --- a/skos-impl/src/main/java/uk/ac/manchester/cs/skos/SKOSObjectPropertyUtility.java +++ b/skos-impl/src/main/java/uk/ac/manchester/cs/skos/SKOSObjectPropertyUtility.java @@ -1,8 +1,7 @@ package uk.ac.manchester.cs.skos; -import org.semanticweb.owlapi.model.*; - import java.net.URI; +import java.util.Collection; import java.util.HashMap; import java.util.Map; /* @@ -28,6 +27,13 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +import org.semanticweb.owlapi.model.IRI; +import org.semanticweb.owlapi.model.OWLObjectProperty; +import org.semanticweb.owlapi.model.OWLObjectPropertyExpression; +import org.semanticweb.owlapi.model.OWLOntology; +import org.semanticweb.owlapi.model.OWLOntologyManager; +import org.semanticweb.owlapi.search.EntitySearcher; + /** * Author: Simon Jupp
* Date: Mar 26, 2008
@@ -69,9 +75,10 @@ public void updateProperties() { private void processProperty(OWLObjectProperty prop, OWLOntology ont) { - if (!prop.getSuperProperties(ont).isEmpty()) { + Collection superProperties = EntitySearcher.getSuperProperties(prop, ont); + if (!superProperties.isEmpty()) { tempProperty.put(prop.getIRI().toURI(), prop); - for(OWLObjectPropertyExpression sup : prop.getSuperProperties(ont)) { + for(OWLObjectPropertyExpression sup : superProperties) { processProperty(sup.asOWLObjectProperty(), ont); } } diff --git a/skos-impl/src/main/java/uk/ac/manchester/cs/skos/SKOSTypedLiteralImpl.java b/skos-impl/src/main/java/uk/ac/manchester/cs/skos/SKOSTypedLiteralImpl.java index 40b7d1b..caacb4e 100644 --- a/skos-impl/src/main/java/uk/ac/manchester/cs/skos/SKOSTypedLiteralImpl.java +++ b/skos-impl/src/main/java/uk/ac/manchester/cs/skos/SKOSTypedLiteralImpl.java @@ -45,7 +45,7 @@ public class SKOSTypedLiteralImpl implements SKOSTypedLiteral { public SKOSTypedLiteralImpl(OWLDataFactory factory, SKOSDataType dataType, String literal) { this.literal = literal; this.type = (SKOSDataTypeImpl) dataType; - constant = factory.getOWLTypedLiteral(literal, type.getAsOWLDataType()); + constant = factory.getOWLLiteral(literal, type.getAsOWLDataType()); } public String getLiteral() {