From d680edd4ad195e4a694a4268e6aa108377f5170e Mon Sep 17 00:00:00 2001 From: Simon Jupp Date: Thu, 27 Feb 2014 11:40:04 +0000 Subject: [PATCH] fixed bug where language tags were not being set on plain literals --- .../src/main/java/example/CreateSKOSExample.java | 2 +- skos-example/src/main/java/example/ReadSKOSExample.java | 9 ++++++--- .../uk/ac/manchester/cs/skos/SKOSUntypedLiteralImpl.java | 4 ++-- .../cs/skos/properties/SKOSAnnotationImpl.java | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/skos-example/src/main/java/example/CreateSKOSExample.java b/skos-example/src/main/java/example/CreateSKOSExample.java index 060b33a..fe1c067 100644 --- a/skos-example/src/main/java/example/CreateSKOSExample.java +++ b/skos-example/src/main/java/example/CreateSKOSExample.java @@ -173,7 +173,7 @@ public static void main(String[] args) throws SKOSCreationException { man.applyChanges(addList); System.err.println("writing ontology"); - man.save(vocab, SKOSFormatExt.RDFXML, URI.create("file:/Users/jupp/tmp/testskos.rdf")); + man.save(vocab, SKOSFormatExt.RDFXML, URI.create("file:/Users/jupp/tmp/testskos/testskos.rdf")); } catch (SKOSChangeException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. diff --git a/skos-example/src/main/java/example/ReadSKOSExample.java b/skos-example/src/main/java/example/ReadSKOSExample.java index 277e6f6..b050f63 100644 --- a/skos-example/src/main/java/example/ReadSKOSExample.java +++ b/skos-example/src/main/java/example/ReadSKOSExample.java @@ -1,12 +1,13 @@ package example; -import org.semanticweb.owlapi.model.IRI; -import org.semanticweb.owlapi.model.OWLOntology; +import org.semanticweb.owlapi.model.*; import org.semanticweb.skos.*; import org.semanticweb.skosapibinding.SKOSManager; import org.semanticweb.skosapibinding.SKOStoOWLConverter; import java.net.URI; +import java.util.HashSet; +import java.util.Set; /* * Copyright (C) 2007, University of Manchester @@ -46,7 +47,9 @@ public ReadSKOSExample() { final SKOSManager man = new SKOSManager(); // SKOSDataset dataSet = man.loadDatasetFromPhysicalURI(URI.create("file:/Users/simon/ontologies/skos/agrovoc_2007_SKOS/ag_skos_20070219.rdf")); -// + + ////// + // print out all concepts; for (SKOSConcept concept : dataSet.getSKOSConcepts()) { System.out.println("Concept: " + concept.getURI()); diff --git a/skos-impl/src/main/java/uk/ac/manchester/cs/skos/SKOSUntypedLiteralImpl.java b/skos-impl/src/main/java/uk/ac/manchester/cs/skos/SKOSUntypedLiteralImpl.java index 4573925..bc33a79 100644 --- a/skos-impl/src/main/java/uk/ac/manchester/cs/skos/SKOSUntypedLiteralImpl.java +++ b/skos-impl/src/main/java/uk/ac/manchester/cs/skos/SKOSUntypedLiteralImpl.java @@ -45,10 +45,10 @@ public SKOSUntypedLiteralImpl(OWLDataFactory factory, String literal, String lan this.lang = lang; this.literal = literal; if (lang == null) { - this.constant = factory.getOWLStringLiteral(literal); + this.constant = factory.getOWLLiteral(literal); } else { - this.constant = factory.getOWLStringLiteral(literal, lang); + this.constant = factory.getOWLLiteral(literal, lang); } } diff --git a/skos-impl/src/main/java/uk/ac/manchester/cs/skos/properties/SKOSAnnotationImpl.java b/skos-impl/src/main/java/uk/ac/manchester/cs/skos/properties/SKOSAnnotationImpl.java index 5000125..61aa864 100644 --- a/skos-impl/src/main/java/uk/ac/manchester/cs/skos/properties/SKOSAnnotationImpl.java +++ b/skos-impl/src/main/java/uk/ac/manchester/cs/skos/properties/SKOSAnnotationImpl.java @@ -62,7 +62,7 @@ public SKOSAnnotationImpl (OWLDataFactory factory, URI uri, SKOSLiteral literal) } else { owlAnnotation = factory.getOWLAnnotation( - factory.getOWLAnnotationProperty(IRI.create(uri)), factory.getOWLLiteral(owlLiteral.getLiteral(), OWL2Datatype.RDF_XML_LITERAL)); + factory.getOWLAnnotationProperty(IRI.create(uri)), owlLiteral); }