From: <lh...@us...> - 2009-03-03 15:00:26
|
Revision: 276 http://tinytim.svn.sourceforge.net/tinytim/?rev=276&view=rev Author: lheuer Date: 2009-03-03 15:00:25 +0000 (Tue, 03 Mar 2009) Log Message: ----------- - Updated JTM 1.0 reader to the latest spec. - Writer checks first the subject identifiers and then iids and slos for a topic reference Modified Paths: -------------- tinytim-mio/trunk/lib/semagia-mio-jtm-0.9.3.jar tinytim-mio/trunk/src/main/java/org/tinytim/mio/JTMTopicMapReader.java tinytim-mio/trunk/src/main/java/org/tinytim/mio/JTMTopicMapWriter.java Modified: tinytim-mio/trunk/lib/semagia-mio-jtm-0.9.3.jar =================================================================== (Binary files differ) Modified: tinytim-mio/trunk/src/main/java/org/tinytim/mio/JTMTopicMapReader.java =================================================================== --- tinytim-mio/trunk/src/main/java/org/tinytim/mio/JTMTopicMapReader.java 2009-03-02 17:25:00 UTC (rev 275) +++ tinytim-mio/trunk/src/main/java/org/tinytim/mio/JTMTopicMapReader.java 2009-03-03 15:00:25 UTC (rev 276) @@ -28,18 +28,21 @@ * {@link TopicMapReader} implementation that deserializes * <a href="http://www.cerny-online.com/jtm/">JSON Topic Maps (JTM)</a>. * <p> - * This reader rejects JTM instances which contain just a single role or - * variant even if they are valid according to the JTM specification. + * This reader rejects JTM instances where the "item_type" is either + * "role" or "variant" even if they are valid according to the JTM specification. * </p> * <p> * Further the reader expects that at least one identity of a topic * (item identifier, subject identifier, subject locator) occurs before any - * occurrence / name. Fragments must start with a "version" property followed - * by the "item_type" property before any further properties are specified. + * occurrence / name. * </p> + * <p> + * The JTM instance must start with a "version" property followed by the + * "item_type" property before any further properties are specified. + * </p> * * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> - * @version $Rev:$ - $Date:$ + * @version $Rev$ - $Date$ */ public final class JTMTopicMapReader extends AbstractTopicMapReader { Modified: tinytim-mio/trunk/src/main/java/org/tinytim/mio/JTMTopicMapWriter.java =================================================================== --- tinytim-mio/trunk/src/main/java/org/tinytim/mio/JTMTopicMapWriter.java 2009-03-02 17:25:00 UTC (rev 275) +++ tinytim-mio/trunk/src/main/java/org/tinytim/mio/JTMTopicMapWriter.java 2009-03-03 15:00:25 UTC (rev 276) @@ -245,7 +245,9 @@ String value = XSD.ANY_URI.equals(datatype) ? datatyped.locatorValue().toExternalForm() : datatyped.getValue(); _writeKeyValue("value", value); - _writeKeyValue("datatype", datatype.toExternalForm()); + if (!XSD.STRING.equals(datatype)) { + _writeKeyValue("datatype", datatype.toExternalForm()); + } } /** @@ -409,18 +411,18 @@ * @return An IRI. */ private String _topicRef(Topic topic) { - Set<Locator> locs = topic.getItemIdentifiers(); + Set<Locator> locs = topic.getSubjectIdentifiers(); if (!locs.isEmpty()) { - return "ii:" + locs.iterator().next().toExternalForm(); - } - locs = topic.getSubjectIdentifiers(); - if (!locs.isEmpty()) { return "si:" + locs.iterator().next().toExternalForm(); } locs = topic.getSubjectLocators(); if (!locs.isEmpty()) { return "sl:" + locs.iterator().next().toExternalForm(); } + locs = topic.getItemIdentifiers(); + if (!locs.isEmpty()) { + return "ii:" + locs.iterator().next().toExternalForm(); + } return "ii:" + _baseIRI + "#" + topic.getId(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |