Modified:
/trunk/uk.ac.osswatch.simal.core/src/main/java/uk/ac/osswatch/simal/model/IDoapRelease.java
/trunk/uk.ac.osswatch.simal.core/src/main/java/uk/ac/osswatch/simal/model/jena/Release.java
/trunk/uk.ac.osswatch.simal.core/src/main/java/uk/ac/osswatch/simal/model/jena/Resource.java
=======================================
---
/trunk/uk.ac.osswatch.simal.core/src/main/java/uk/ac/osswatch/simal/model/IDoapRelease.java
Thu Sep 18 14:53:18 2008
+++
/trunk/uk.ac.osswatch.simal.core/src/main/java/uk/ac/osswatch/simal/model/IDoapRelease.java
Thu Apr 14 14:33:40 2011
@@ -1,5 +1,5 @@
/*
- * Copyright 2007 University of Oxford
+ * Copyright 2007, 2011 University of Oxford
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,8 +18,8 @@
import java.util.Set;
/**
- * A release of a project. It is a resource used to define the doap:release
- * entries of doap:Project.
+ * A release of a project. It is a resource used to define the doap:Version
+ * entries that are tied to instances of doap:Project using doap:release.
*
*/
public interface IDoapRelease extends IDoapResource {
@@ -29,4 +29,10 @@
* version number. In DOAP it corresponds to doap:revision.
*/
public Set<String> getRevisions();
-}
+
+ /**
+ * Set all the version identifiers for this release. A version
identifier is a
+ * version number. In DOAP it corresponds to doap:revision.
+ */
+ public void setRevisions(Set<String> revisions);
+}
=======================================
---
/trunk/uk.ac.osswatch.simal.core/src/main/java/uk/ac/osswatch/simal/model/jena/Release.java
Sun Jun 21 14:50:38 2009
+++
/trunk/uk.ac.osswatch.simal.core/src/main/java/uk/ac/osswatch/simal/model/jena/Release.java
Thu Apr 14 14:33:40 2011
@@ -2,7 +2,7 @@
/*
*
- Copyright 2007 University of Oxford *
+ Copyright 2007, 2011 University of Oxford *
* Licensed 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
@@ -28,7 +28,7 @@
import com.hp.hpl.jena.rdf.model.Statement;
public class Release extends DoapResource implements IDoapRelease {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = -7818587719288772500L;
public Release(com.hp.hpl.jena.rdf.model.Resource resource) {
super(resource);
@@ -42,5 +42,9 @@
}
return revisions;
}
+
+ public void setRevisions(Set<String> revisions) {
+ replaceLiteralStatements(Doap.REVISION, revisions);
+ }
}
=======================================
---
/trunk/uk.ac.osswatch.simal.core/src/main/java/uk/ac/osswatch/simal/model/jena/Resource.java
Fri Nov 12 14:36:16 2010
+++
/trunk/uk.ac.osswatch.simal.core/src/main/java/uk/ac/osswatch/simal/model/jena/Resource.java
Thu Apr 14 14:33:40 2011
@@ -37,6 +37,7 @@
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.Property;
import com.hp.hpl.jena.rdf.model.RDFWriter;
+import com.hp.hpl.jena.rdf.model.ResourceFactory;
import com.hp.hpl.jena.rdf.model.Statement;
import com.hp.hpl.jena.rdf.model.StmtIterator;
import com.hp.hpl.jena.util.ResourceUtils;
@@ -257,10 +258,7 @@
}
protected void addLiteralStatement(Property property, String literal) {
- Model model = getJenaResource().getModel();
- Statement statement = model.createStatement(getJenaResource(),
- property, literal);
- model.add(statement);
+ getJenaResource().getModel().add(getJenaResource(), property, literal);
}
protected void replaceLiteralStatements(Property property, Set<String>
literals) {
@@ -301,23 +299,29 @@
}
}
-public void addSeeAlso(URI uri) {
- com.hp.hpl.jena.rdf.model.Resource resource =
getJenaResource().getModel().createResource(uri.toASCIIString());
- getJenaResource().addProperty(RDFS.seeAlso, resource);
-}
-
-public void setComment(String comment) {
- // TODO Auto-generated method stub
-
-}
-
-public void setLabel(String label) {
- // TODO Auto-generated method stub
-
-}
-
-public void setSeeAlso(Set<URI> seeAlso) {
- // TODO Auto-generated method stub
-
-}
-}
+ public void addSeeAlso(URI uri) {
+ com.hp.hpl.jena.rdf.model.Resource resource =
getJenaResource().getModel()
+ .createResource(uri.toASCIIString());
+ getJenaResource().addProperty(RDFS.seeAlso, resource);
+ }
+
+ public void setComment(String comment) {
+ getJenaResource().removeAll(RDFS.comment);
+ getJenaResource().addLiteral(RDFS.comment, comment);
+ }
+
+ public void setLabel(String label) {
+ getJenaResource().removeAll(RDFS.label);
+ getJenaResource().addLiteral(RDFS.label, label);
+ }
+
+ public void setSeeAlso(Set<URI> seeAlsos) {
+ getJenaResource().removeAll(RDFS.seeAlso);
+ for (URI literal : seeAlsos) {
+ com.hp.hpl.jena.rdf.model.Resource seeAlso = ResourceFactory
+ .createResource(literal.toString());
+ getJenaResource().getModel()
+ .add(getJenaResource(), RDFS.seeAlso, seeAlso);
+ }
+ }
+}