summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Terry2013-06-25 10:33:18 (EDT)
committer David Terry2013-06-27 15:59:23 (EDT)
commit64de199f193d49e7109a68b15a47d1794f449b4f (patch)
tree0f1d430bdef8b004815fb9f610caf0271e62e4c6
parentdb3e670b234b9fb9fa9221d532263d766aba61e4 (diff)
downloadorg.eclipse.lyo.core-64de199f193d49e7109a68b15a47d1794f449b4f.zip
org.eclipse.lyo.core-64de199f193d49e7109a68b15a47d1794f449b4f.tar.gz
org.eclipse.lyo.core-64de199f193d49e7109a68b15a47d1794f449b4f.tar.bz2
Bug 411606 - Update TRS implementation to conform to the 2.0refs/changes/87/14087/3
specification (1 of 4) Change-Id: I1fa8b55eb402701ed7a2a9e7f6efd28ce19d8c2d Signed-off-by: David Terry <dgterry@us.ibm.com>
-rw-r--r--org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/Base.java174
-rw-r--r--org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/ChangeEvent.java4
-rw-r--r--org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/ChangeLog.java200
-rw-r--r--org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/EmptyChangeLog.java28
-rw-r--r--org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/Page.java80
-rw-r--r--org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/TRSConstants.java28
-rw-r--r--org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/TrackedResourceSet.java11
-rw-r--r--org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/package-info.java3
8 files changed, 328 insertions, 200 deletions
diff --git a/org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/Base.java b/org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/Base.java
index dc5bb31..b179d4b 100644
--- a/org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/Base.java
+++ b/org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/Base.java
@@ -12,23 +12,24 @@
* * Contributors:
*
* Kevin Bauer - Initial implementation
+ * David Terry - TRS 2.0 compliant implementation
*******************************************************************************/
package org.eclipse.lyo.core.trs;
+import static org.eclipse.lyo.core.trs.TRSConstants.LDP_AGGREGATE_CONTAINER;
+import static org.eclipse.lyo.core.trs.TRSConstants.LDP_NAMESPACE;
+import static org.eclipse.lyo.core.trs.TRSConstants.LDP_TERM_AGGREGATE_CONTAINER;
import static org.eclipse.lyo.core.trs.TRSConstants.RDFS_MEMBER;
import static org.eclipse.lyo.core.trs.TRSConstants.RDFS_TERM_MEMBER;
import static org.eclipse.lyo.core.trs.TRSConstants.TRS_CUTOFFEVENT;
-import static org.eclipse.lyo.core.trs.TRSConstants.TRS_NAMESPACE;
-import static org.eclipse.lyo.core.trs.TRSConstants.TRS_NEXT_PAGE;
import static org.eclipse.lyo.core.trs.TRSConstants.TRS_TERM_CUTOFFEVENT;
-import static org.eclipse.lyo.core.trs.TRSConstants.TRS_TERM_NEXT_PAGE;
-import static org.eclipse.lyo.core.trs.TRSConstants.TRS_TYPE_BASE;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.lyo.oslc4j.core.annotation.OslcDescription;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcHidden;
import org.eclipse.lyo.oslc4j.core.annotation.OslcName;
import org.eclipse.lyo.oslc4j.core.annotation.OslcNamespace;
import org.eclipse.lyo.oslc4j.core.annotation.OslcPropertyDefinition;
@@ -37,77 +38,104 @@ import org.eclipse.lyo.oslc4j.core.annotation.OslcTitle;
import org.eclipse.lyo.oslc4j.core.model.AbstractResource;
/**
- * The Base resources of a Tracked Resource Set are represented by an RDF
- * container where each member references a Resource that was in the Resource
+ * The Base of a Tracked Resource Set is a W3C Linked Data Platform (LDP)
+ * Container where each member references a Resource that was in the Resource
* Set at the time the Base was computed. HTTP GET on a Base URI returns an RDF
* container with the following structure:
*
* <pre>
-{@literal @prefix oslc_trs: <http://jazz.net/ns/trs#> .}
-{@literal @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .}
-
-{@code
-<https://.../myResources>
- oslc_trs:cutoffIdentifier "2010-10-27T17:39:31.000Z#101" ;
- rdfs:member <https://.../WorkItem/1> ;
- rdfs:member <https://.../WorkItem/2> ;
- rdfs:member <https://.../WorkItem/3> ;
- ...
- rdfs:member <https://.../WorkItem/199> ;
- rdfs:member <https://.../WorkItem/200> .
-}
-</pre>
-
-<p>Note: the oslc_trs namespace will be converted to the
-http://open-services.net/ns/core/trs# in a future version of the TRS toolkit
-once full compliance is reached.
-
-<p>Each Resource in the Resource Set MUST be referenced from the container using
-an rdfs:member predicate. The Base MAY be broken into multiple pages, in which
-case the standard OSLC paging (reference: Resource Paging) mechanism is used to
-connect one page to the next. (Note that an OSLC queryBase satisfies these
-requirements, which may allow a Server to use existing queryBases as Base
-containers, but there is no requirement that the Tracked Resource Set Base also
-be a queryBase.) The Tracked Resource Set protocol does not attach significance
-to the order in which a Server enumerates the resources in the Base or breaks
-the Base up into pages.
-
-<p>As shown above, a Base usually provides an oslc_trs:cutoffIdentifier property,
-whose value is the identifier (i.e., dcterms:identifier) of the most recent
-Change Event in the corresponding Change Log that is already reflected in the
-Base. This corresponds to the latest point in the Change Log from which a
-Client can begin incremental monitoring/updating if it wants to remain
-synchronized with further changes to the Resource Set. As mentioned above,
-the cutoff Change Event MUST appear in the non-truncated portion of the Change
-Log. When the oslc_trs:cutoffIdentifier is omitted, the Base enumerates the
-(possibly empty) Resource Set at the beginning of time.
-
-<p>The Base is only an approximation of the Resource Set. A Base might omit mention
-of a Resource that ought to have been included or include a Resource that ought
-to have been omitted. For each erroneously reported Resource in the Base, the
-Server MUST at some point include a corrective Change Event in the Change Log
-more recent that the base cutoff event. The corrective Change Event corrects the
-picture for that Resource, allowing the Client to compute the correct set of
-member Resources. A corrective Change Event might not appear in the Change Log
-that was retrieved when the Client dereferenced the Tracked Resource Set URI.
-The Client might only see a corrective Change Event when it processes the Change
-Log resource obtained by dereferencing the Tracked Resource Set URI on later
-occasions.
-
-<p>A Server MUST refer to a given resource using the exact same URI in the Base
-( rdfs:member reference) and every Change Event ( oslc_trs:changed reference)
-for that resource.
+ * {@literal @prefix trs: <http://open-services.net/ns/core/trs#> .}
+ * {@literal @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .}
+ * {@literal @prefix ldp: <http://www.w3.org/ns/ldp#> .}
*
- * @author kmbauer
- *
+ * {@code
+ * <https://.../baseResources>
+ * a ldp:AggregateContainer;
+ * trs:cutoffEvent <#1> ;
+ * rdfs:member <https://.../WorkItem/1> ;
+ * rdfs:member <https://.../WorkItem/2> ;
+ * rdfs:member <https://.../WorkItem/3> ;
+ * ...
+ * rdfs:member <https://.../WorkItem/199> ;
+ * rdfs:member <https://.../WorkItem/200> .
+ * }
+ * </pre>
+ *
+ * <p>
+ * Each Resource in the Resource Set MUST be referenced from the container using
+ * an rdfs:member predicate. The Base MAY be broken into multiple pages in which
+ * case the Server will respond with a 30x redirect message, directing the
+ * Client to the first “page resource”. The representation of a page resource
+ * will contain a subset of the Base’s rdfs:member predicates. In addition, it
+ * will contain another triple, whose subject is the page resource itself (i.e.,
+ * not the Base resource), with a reference to the next page:
+ *
+ * <pre>
+ * {@code
+ * <https://.../baseResources/page1>
+ * a ldp:Page;
+ * ldp:pageOf <https://.../baseResource>;
+ * ldp:nextPage <https://../baseResources/page2> .
+ * }
+ * </pre>
+ *
+ * <p>
+ * The last page in the list is indicated by a ldp:nextPage value of rdf:nil.
+ * The Tracked Resource Set protocol does not attach significance to the order
+ * in which a Server enumerates the resources in the Base or breaks the Base up
+ * into pages.
+ *
+ * <p>
+ * The first page of a Base MUST include a trs:cutoffEvent property, whose value
+ * is the URI of the most recent Change Event in the corresponding Change Log
+ * that is already reflected in the Base. This corresponds to the latest point
+ * in the Change Log from which a Client can begin incremental
+ * monitoring/updating if it wants to remain synchronized with further changes
+ * to the Resource Set. As mentioned above, the cutoff Change Event MUST appear
+ * in the non-truncated portion of the Change Log. When the trs:cutoffEvent is
+ * rdf:nil, the Base enumerates the (possibly empty) Resource Set at the
+ * beginning of time.
+ *
+ * <p>
+ * Because of the highly dynamic nature of the Resource Set, a Server may have
+ * difficulty enumerating the exact set of resources at a point in time. Because
+ * of that, the Base can be only an approximation of the Resource Set. A Base
+ * might omit mention of a Resource that ought to have been included or include
+ * a Resource that ought to have been omitted. For each erroneously reported
+ * Resource in the Base, the Server MUST at some point include a corrective
+ * Change Event in the Change Log more recent that the base cutoff event. The
+ * corrective Change Event corrects the picture for that Resource, allowing the
+ * Client to compute the correct set of member Resources. A corrective Change
+ * Event might not appear in the Change Log that was retrieved when the Client
+ * dereferenced the Tracked Resource Set URI. The Client might only see a
+ * corrective Change Event when it processes the Change Log resource obtained by
+ * dereferencing the Tracked Resource Set URI on later occasions.
+ *
+ * <p>
+ * When a Base is broken into pages, the Client will discover and retrieve Base
+ * page resources to determine the Resources in the Base. A Client MUST retrieve
+ * all the page resources of the Base. A Client MAY retrieve the Base page
+ * resources in any order, including retrieving some Base page resources in
+ * parallel. A Client retrieves the Base page resources at its own pace, and MAY
+ * retrieve any of the Base page resources more than once. If the Server allows
+ * the representation of Base page resources to vary over time, the Server MUST
+ * ensure that the set of Resources a Client would infer as members is
+ * necessarily an approximation of the Resource Set which, when corrected by
+ * Change Events after the Base’s cutoff event, yields the correct set of member
+ * Resources in the Resource Set.
+ *
+ * <p>
+ * A Server MUST refer to a given resource using the exact same URI in the Base
+ * ( rdfs:member reference) and every Change Event ( trs:changed reference) for
+ * that resource.
*/
-@OslcNamespace(TRS_NAMESPACE)
-@OslcResourceShape(title = "Tracked Resource Set Base Shape", describes = TRS_TYPE_BASE)
+@OslcNamespace(LDP_NAMESPACE)
+@OslcName(LDP_TERM_AGGREGATE_CONTAINER)
+@OslcResourceShape(title = "Tracked Resource Set Base Shape", describes = LDP_AGGREGATE_CONTAINER)
public class Base extends AbstractResource {
private List<URI> members;
private URI cutoffEvent;
- private URI nextPage;
-
+ private Page nextPage;
/**
* @return the members
@@ -148,20 +176,22 @@ public class Base extends AbstractResource {
}
/**
+ * Return a Page object containing information about the next base page.
+ * The OslcHidden annotation works around a limitation in OSLC4J. If we do
+ * not hide the nextPage variable we get an incorrect ldp:nextPage reference
+ * in the Base.
+ *
* @return the nextPage
*/
- @OslcName(TRS_TERM_NEXT_PAGE)
- @OslcDescription("The representation of a page resource will contain a subset of the Base's rdfs:member predicates. In addition, it will contain another triple, whose subject is the page resource itself (i.e., not the Base resource), with a reference to the next page.")
- @OslcPropertyDefinition(TRS_NEXT_PAGE)
- @OslcTitle("Next Page")
- public URI getNextPage() {
+ @OslcHidden(value=true)
+ public Page getNextPage() {
return nextPage;
}
/**
* @param nextPage the nextPage to set
*/
- public void setNextPage(URI nextPage) {
+ public void setNextPage(Page nextPage) {
this.nextPage = nextPage;
}
}
diff --git a/org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/ChangeEvent.java b/org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/ChangeEvent.java
index 15bb044..8969106 100644
--- a/org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/ChangeEvent.java
+++ b/org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/ChangeEvent.java
@@ -26,7 +26,7 @@ import org.eclipse.lyo.oslc4j.core.model.AbstractResource;
import static org.eclipse.lyo.core.trs.TRSConstants.*;
/**
- * Each entry in a trs:changes list is a Local Resource representing a Change Event with the following properties:
+ * Each entry referenced by trs:change is a Local Resource representing a Change Event with the following properties:
*/
public class ChangeEvent extends AbstractResource {
private URI changed;
@@ -67,7 +67,7 @@ public class ChangeEvent extends AbstractResource {
* @return the order
*/
@OslcName(TRS_TERM_ORDER)
- @OslcDescription("The sequence in time of the Change Event. The order of Change Events sorted according to this property is the same as they appear in the trs:changes list.")
+ @OslcDescription("The sequence in time of the Change Event.")
@OslcPropertyDefinition(TRS_ORDER)
@OslcTitle("Order")
public int getOrder() {
diff --git a/org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/ChangeLog.java b/org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/ChangeLog.java
index aae7e20..13fea8c 100644
--- a/org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/ChangeLog.java
+++ b/org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/ChangeLog.java
@@ -11,10 +11,18 @@
*
* Contributors:
*
- * Kevin Bauer - Initial implementation
+ * Kevin Bauer - Initial implementation
+ * David Terry - TRS 2.0 compliant implementation
*******************************************************************************/
package org.eclipse.lyo.core.trs;
+import static org.eclipse.lyo.core.trs.TRSConstants.TRS_CHANGE;
+import static org.eclipse.lyo.core.trs.TRSConstants.TRS_NAMESPACE;
+import static org.eclipse.lyo.core.trs.TRSConstants.TRS_PREVIOUS;
+import static org.eclipse.lyo.core.trs.TRSConstants.TRS_TERM_CHANGE;
+import static org.eclipse.lyo.core.trs.TRSConstants.TRS_TERM_PREVIOUS;
+import static org.eclipse.lyo.core.trs.TRSConstants.TRS_TYPE_CHANGE_LOG;
+
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
@@ -23,124 +31,118 @@ import org.eclipse.lyo.oslc4j.core.annotation.OslcDescription;
import org.eclipse.lyo.oslc4j.core.annotation.OslcName;
import org.eclipse.lyo.oslc4j.core.annotation.OslcNamespace;
import org.eclipse.lyo.oslc4j.core.annotation.OslcPropertyDefinition;
-import org.eclipse.lyo.oslc4j.core.annotation.OslcRdfCollectionType;
import org.eclipse.lyo.oslc4j.core.annotation.OslcResourceShape;
import org.eclipse.lyo.oslc4j.core.annotation.OslcTitle;
-import static org.eclipse.lyo.core.trs.TRSConstants.*;
-
/**
- * A Change Log provides a list of changes organized in inverse chronological
- * order, most recent first. The following example illustrates the contents of
- * a Change Log:
- *
- * <pre>
-# Resource: http://cm1.example.com/trackedResourceSet
-{@literal @prefix trs: <http://jazz.net/ns/trs#> .}
-{@literal @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .}
-
-{@code
-<http://cm1.example.com/trackedResourceSet>
- a trs:TrackedResourceSet ;
- trs:base <http://cm1.example.com/baseResources> ;
- trs:changeLog [
- a trs:ChangeLog ;
- trs:changes (
- <urn:urn-3:cm1.example.com:2010-10-27T17:39:33.000Z:103>
- <urn:urn-3:cm1.example.com:2010-10-27T17:39:32.000Z:102>
- <urn:urn-3:cm1.example.com:2010-10-27T17:39:31.000Z:101>
- ) .
- ] .
-
-<urn:urn-3:cm1.example.com:2010-10-27T17:39:33.000Z:103>
- a trs:Creation ;
- trs:changed <http://cm1.example.com/bugs/23> ;
- trs:order "103"^^xsd:integer .
-
-<urn:urn-3:cm1.example.com:2010-10-27T17:39:32.000Z:102>
- a trs:Modification ;
- trs:changed <http://cm1.example.com/bugs/22> ;
- trs:order "102"^^xsd:integer .
-
-<urn:urn-3:cm1.example.com:2010-10-27T17:39:31.000Z:101>
- a trs:Deletion ;
- trs:changed <http://cm1.example.com/bugs/21> ;
- trs:order "101"^^xsd:integer .
-}
-</pre>
-
-<p>As shown, a Change Log provides a set of Change Event entries in a single-valued
-RDF collection-type property called trs:changes. An RDF collection, i.e., a
-linked list (reference: RDF Collections), is used in the Change Log to ensure
-that the entries retain their correct (inverse chronological) order.
-
-<p>Change Events MUST have URIs (i.e., they cannot be Blank Nodes) to allow Clients
-to recognize entries they have seen before. The URI is only used to identify an
-event (i.e., it need not be HTTP GETable) and therefore MAY be a URN, as shown
-in the example.
-
-<p>Each Change Event has a sequence number, trs:order; sequence numbers are
-non-negative integer values that increase over time. A Change Event entry
-carries the URI of the changed Resource, trs:changed, and an indication,
-via rdf:type (a.k.a. "a" in Turtle), of whether the Resource was added to the
-Resource Set, removed from the Resource Set, or changed state while a member of
-the Resource Set. The first entry in the Change Log, i.e., "103" in this
-example, is the most recent change. As changes continue to occur, a Server MUST
-add new Change Events to the front of the list. The sequence number
-(i.e., trs:order) of newer entries MUST be greater than previous ones. The
-sequence numbers MAY be consecutive numbers but need not be.
-
-<p>Note that the actual time of change is not included in a Change Event. Only a
-sequence number, representing the "sequence in time" of each change is provided.
-The URI of a Change Event MUST be guaranteed unique, even in the wake of a
-Server roll back where sequence numbers get reused. A time stamp MAY be used to
-generate such a URI, as in the above example, although other ways of generating
-a unique URI are also possible.
-
-<p>A Change Log represents a series of changes to its corresponding Resource Set
-over some period of time. The Change Log MUST contain Change Events for every
-Resource creation, deletion, and modification during that period. A Server MUST
-report a Resource modification event if a GET on it would return a semantically
-different response from previously. For a resource with RDF content, a
-modification is anything that would affect the set of RDF triples in a
-significant way. A Server MAY safely report a modification event even in cases
-where there would be no significant difference in response.
-
-<p>The Server SHOULD NOT report unnecessary Change Events although it might happen,
-for example, if changes occur while the base is being computed. A Client SHOULD
-ignore a creation event for a Resource that is already a member of the Resource
-Set, and SHOULD ignore a deletion or modification event for a Resource that is
-not a member of the Resource Set.
+ * A Change Log provides a list of changes. The following example illustrates
+ * the contents of a Change Log:
+ *
+ * <pre>
+ * # Resource: http://cm1.example.com/trackedResourceSet
+ * {@literal @prefix trs: <http://open-services.net/ns/core/trs#> .}
+ * {@literal @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .}
+ *
+ * {@code
+ * <http://cm1.example.com/trackedResourceSet>
+ * a trs:TrackedResourceSet ;
+ * trs:base <http://cm1.example.com/baseResources> ;
+ * trs:changeLog [
+ * a trs:ChangeLog ;
+ * trs:change <#3>, <#2>, <#1>.
+ * ] .
+ *
+ * <#3>
+ * a trs:Creation ;
+ * trs:changed <http://cm1.example.com/bugs/23> ;
+ * trs:order "103"^^xsd:integer .
+ *
+ * <#2>
+ * a trs:Modification ;
+ * trs:changed <http://cm1.example.com/bugs/22> ;
+ * trs:order "102"^^xsd:integer .
+ *
+ * <#1>
+ * a trs:Deletion ;
+ * trs:changed <http://cm1.example.com/bugs/21> ;
+ * trs:order "101"^^xsd:integer .
+ * }
+ * </pre>
+ *
+ * <p> As shown, a Change Log provides a set of Change Event entries in a
+ * multi-valued RDF property called trs:change.
+ *
+ * <p> Change Events MUST have URIs (i.e., they cannot be Blank Nodes) to allow
+ * Clients to recognize entries they have seen before. The URI is only used to
+ * identify an event (i.e., it need not be HTTP GETable).
+ *
+ * <p> Each Change Event has a sequence number, trs:order; sequence numbers are
+ * non-negative integer values that increase over time. A Change Event entry
+ * carries the URI of the changed Resource, trs:changed, and an indication, via
+ * rdf:type (a.k.a. “a” in Turtle), of whether the Resource was added to the
+ * Resource Set, removed from the Resource Set, or changed state while a member
+ * of the Resource Set. The entry with the highest trs:order value (i.e., 103 in
+ * this example) is the most recent change. As changes continue to occur, a
+ * Server MUST add new Change Events to the newest Change Log segment. The
+ * sequence number (i.e., trs:order) of newer entries MUST be greater than
+ * previous ones. The sequence numbers MAY be consecutive numbers but need not
+ * be.
+ *
+ * <p> Note that the actual time of change is not included in a Change Event. Only a
+ * sequence number, representing the “sequence in time” of each change is
+ * provided. The URI of a Change Event MUST be guaranteed unique, even in the
+ * wake of a Server roll back where sequence numbers get reused. A time stamp
+ * MAY be used to generate such a URI, as in the above example, although other
+ * ways of generating a unique URI are also possible.
+ *
+ * <p> A Change Log represents a series of changes to its corresponding Resource Set
+ * over some period of time. The Change Log MUST contain Change Events for every
+ * Resource creation, deletion, and modification during that period. A Server
+ * MUST report a Resource modification event if a GET on it would return a
+ * semantically different response from previously. For a resource with RDF
+ * content, a modification is anything that would affect the set of RDF triples
+ * in a significant way. A Server MAY safely report a modification event even in
+ * cases where there would be no significant difference in response. Some cases
+ * of modifications that would be considered semantically different from
+ * previous or significant difference would be: inserted triple, removed triple,
+ * triple replaced (new object/literal, e.g. changing boolean literal “true” to
+ * “false”), replaced vocabulary term used (e.g. change from dcterms:title to
+ * rdfs:label).
+ *
+ * <p> The Server SHOULD NOT report unnecessary Change Events although it might
+ * happen, for example, if changes occur while the base is being computed. A
+ * Client SHOULD ignore a creation event for a Resource that is already a member
+ * of the Resource Set, and SHOULD ignore a deletion or modification event for a
+ * Resource that is not a member of the Resource Set.
*/
@OslcNamespace(TRS_NAMESPACE)
@OslcResourceShape(title = "Change Log Shape", describes = TRS_TYPE_CHANGE_LOG)
public class ChangeLog extends AbstractChangeLog
{
- private List<ChangeEvent> changes;
+ private List<ChangeEvent> change;
private URI previous;
/**
- * @return the changes
+ * @return the change
*/
- @OslcName(TRS_TERM_CHANGES)
- @OslcDescription("The list of Change Event entries, ordered by decreasing Change Event trs:order. Events that occurred later appear earlier in the list.")
- @OslcPropertyDefinition(TRS_CHANGES)
- @OslcTitle("Changes")
- @OslcRdfCollectionType
- public List<ChangeEvent> getChanges() {
- if(changes == null){
- changes = new ArrayList<ChangeEvent>();
+ @OslcName(TRS_TERM_CHANGE)
+ @OslcDescription("URI references to the list of Change Event entries.")
+ @OslcPropertyDefinition(TRS_CHANGE)
+ @OslcTitle("Change")
+ public List<ChangeEvent> getChange() {
+ if(change == null){
+ change = new ArrayList<ChangeEvent>();
}
- return changes;
+ return change;
}
/**
* @param changes the changes to set
*/
- public void setChanges(List<ChangeEvent> changes) {
- this.changes = changes;
+ public void setChange(List<ChangeEvent> change) {
+ this.change = change;
}
-
+
/**
* @return the previous
*/
diff --git a/org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/EmptyChangeLog.java b/org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/EmptyChangeLog.java
index 36edacf..52f7200 100644
--- a/org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/EmptyChangeLog.java
+++ b/org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/EmptyChangeLog.java
@@ -16,9 +16,9 @@
package org.eclipse.lyo.core.trs;
import static org.eclipse.lyo.core.trs.TRSConstants.RDF_NIL;
-import static org.eclipse.lyo.core.trs.TRSConstants.TRS_CHANGES;
+import static org.eclipse.lyo.core.trs.TRSConstants.TRS_CHANGE;
import static org.eclipse.lyo.core.trs.TRSConstants.TRS_NAMESPACE;
-import static org.eclipse.lyo.core.trs.TRSConstants.TRS_TERM_CHANGES;
+import static org.eclipse.lyo.core.trs.TRSConstants.TRS_TERM_CHANGE;
import static org.eclipse.lyo.core.trs.TRSConstants.TRS_TYPE_CHANGE_LOG;
import java.net.URI;
@@ -37,7 +37,7 @@ import org.eclipse.lyo.oslc4j.core.annotation.OslcTitle;
* Change Log:
* <pre>
# Resource: http://cm1.example.com/trackedResourceSet
-{@literal @prefix trs: <http://jazz.net/ns/trs#> .}
+{@literal @prefix trs: <http://open-services.net/ns/core/trs#> .}
{@literal @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .}
{@code
@@ -59,28 +59,28 @@ of "http://www.w3.org/2000/01/rdf-schema#nil".
@OslcName("ChangeLog")
public class EmptyChangeLog extends AbstractChangeLog
{
- private URI changes;
+ private URI change;
/**
- * @return the changes
+ * @return the change
* @throws URISyntaxException
*/
- @OslcName(TRS_TERM_CHANGES)
- @OslcDescription("The list of Change Event entries, ordered by decreasing Change Event trs:order. Events that occurred later appear earlier in the list.")
- @OslcPropertyDefinition(TRS_CHANGES)
- @OslcTitle("Changes")
- public URI getChanges() throws URISyntaxException {
- if(changes == null) {
+ @OslcName(TRS_TERM_CHANGE)
+ @OslcDescription("URI references to the list of Change Event entries.")
+ @OslcPropertyDefinition(TRS_CHANGE)
+ @OslcTitle("Change")
+ public URI getChange() throws URISyntaxException {
+ if(change == null) {
return new URI(RDF_NIL);
}
- return changes;
+ return change;
}
/**
* @param changes the changes to set
*/
- public void setChanges(URI changes) {
- this.changes = changes;
+ public void setChange(URI change) {
+ this.change = change;
}
}
diff --git a/org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/Page.java b/org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/Page.java
new file mode 100644
index 0000000..311cccf
--- /dev/null
+++ b/org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/Page.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2013 IBM Corporation.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * * Contributors:
+ *
+ * David Terry - Initial implementation
+ *******************************************************************************/
+package org.eclipse.lyo.core.trs;
+
+import static org.eclipse.lyo.core.trs.TRSConstants.LDP_PAGE;
+import static org.eclipse.lyo.core.trs.TRSConstants.LDP_NAMESPACE;
+import static org.eclipse.lyo.core.trs.TRSConstants.LDP_NEXT_PAGE;
+import static org.eclipse.lyo.core.trs.TRSConstants.LDP_TERM_NEXT_PAGE;
+import static org.eclipse.lyo.core.trs.TRSConstants.LDP_TERM_PAGE_OF;
+import static org.eclipse.lyo.core.trs.TRSConstants.LDP_PAGE_OF;
+
+import java.net.URI;
+
+import org.eclipse.lyo.oslc4j.core.annotation.OslcDescription;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcName;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcNamespace;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcPropertyDefinition;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcResourceShape;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcTitle;
+import org.eclipse.lyo.oslc4j.core.model.AbstractResource;
+
+/**
+ * In TRS, the Base Resource is paginated using the W3C Linked Data Platform
+ * (LDP) Container pagination. This class defines a LDP resource.
+ */
+@OslcNamespace(LDP_NAMESPACE)
+@OslcResourceShape(title = "A Page in the Base Resource", describes = LDP_PAGE)
+public class Page extends AbstractResource {
+ private URI nextPage;
+ private Base pageOf;
+
+ /**
+ * @return the nextPage
+ */
+ @OslcName(LDP_TERM_NEXT_PAGE)
+ @OslcDescription("The representation of a page resource will contain a subset of the Base's rdfs:member predicates. In addition, it will contain another triple, whose subject is the page resource itself (i.e., not the Base resource), with a reference to the next page.")
+ @OslcPropertyDefinition(LDP_NEXT_PAGE)
+ @OslcTitle("Next Page")
+ public URI getNextPage() {
+ return nextPage;
+ }
+
+ /**
+ * @param nextPage the nextPage to set
+ */
+ public void setNextPage(URI nextPage) {
+ this.nextPage = nextPage;
+ }
+
+ /**
+ * @return the pageOf
+ */
+ @OslcName(LDP_TERM_PAGE_OF)
+ @OslcDescription("A reference back to the base resource this page belongs to.")
+ @OslcPropertyDefinition(LDP_PAGE_OF)
+ @OslcTitle("Page Of")
+ public Base getPageOf() {
+ return pageOf;
+ }
+
+ /**
+ * @param pageOf the pageOf to set
+ */
+ public void setPageOf(Base pageOf) {
+ this.pageOf = pageOf;
+ }
+}
diff --git a/org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/TRSConstants.java b/org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/TRSConstants.java
index 971df76..a4189b0 100644
--- a/org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/TRSConstants.java
+++ b/org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/TRSConstants.java
@@ -23,14 +23,14 @@ import org.eclipse.lyo.oslc4j.core.model.OslcConstants;
public interface TRSConstants extends OslcConstants {
//TRS Constants
- public static final String TRS_NAMESPACE = "http://jazz.net/ns/trs#"; //$NON-NLS-1$
+ public static final String TRS_NAMESPACE = "http://open-services.net/ns/core/trs#"; //$NON-NLS-1$
public static final String TRS_NAMESPACE_PREFIX = "trs"; //$NON-NLS-1$
//Types
- public static final String TRS_TERM_TYPE_BASE = "Base"; //$NON-NLS-1$
+ public static final String TRS_TERM_TYPE_BASE = "base"; //$NON-NLS-1$
public static final String TRS__PTERM_TYPE_BASE = TRS_NAMESPACE_PREFIX+ ':' + TRS_TERM_TYPE_BASE; //$NON-NLS-1$
public static final String TRS_TYPE_BASE = TRS_NAMESPACE + TRS_TERM_TYPE_BASE;
- public static final String TRS_TERM_TYPE_CHANGE_LOG = "Change Log"; //$NON-NLS-1$
+ public static final String TRS_TERM_TYPE_CHANGE_LOG = "changeLog"; //$NON-NLS-1$
public static final String TRS__PTERM_TYPE_CHANGE_LOG = TRS_NAMESPACE_PREFIX+ ':' + TRS_TERM_TYPE_CHANGE_LOG; //$NON-NLS-1$
public static final String TRS_TYPE_CHANGE_LOG = TRS_NAMESPACE + TRS_TERM_TYPE_CHANGE_LOG;
public static final String TRS_TERM_TYPE_CREATION = "Creation"; //$NON-NLS-1$
@@ -58,15 +58,12 @@ public interface TRSConstants extends OslcConstants {
public static final String TRS_PTERM_CHANGED = TRS_NAMESPACE_PREFIX+ ':' + TRS_TERM_CHANGED; //$NON-NLS-1$
public static final String TRS_CHANGED = TRS_NAMESPACE + TRS_TERM_CHANGED;
public static final String TRS_CHANGE_LOG = TRS_NAMESPACE + TRS_TERM_CHANGE_LOG;
- public static final String TRS_TERM_CHANGES = "changes"; //$NON-NLS-1$
- public static final String TRS_PTERM_CHANGES = TRS_NAMESPACE_PREFIX+ ':' + TRS_TERM_CHANGES; //$NON-NLS-1$
- public static final String TRS_CHANGES = TRS_NAMESPACE + TRS_TERM_CHANGES;
+ public static final String TRS_TERM_CHANGE = "change"; //$NON-NLS-1$
+ public static final String TRS_PTERM_CHANGE = TRS_NAMESPACE_PREFIX+ ':' + TRS_TERM_CHANGE; //$NON-NLS-1$
+ public static final String TRS_CHANGE = TRS_NAMESPACE + TRS_TERM_CHANGE;
public static final String TRS_TERM_CUTOFFEVENT = "cutoffEvent"; //$NON-NLS-1$
public static final String TRS_PTERM_CUTOFFEVENT = TRS_NAMESPACE_PREFIX+ ':' + TRS_TERM_CUTOFFEVENT; //$NON-NLS-1$
public static final String TRS_CUTOFFEVENT = TRS_NAMESPACE + TRS_TERM_CUTOFFEVENT;
- public static final String TRS_TERM_NEXT_PAGE = "nextPage"; //$NON-NLS-1$
- public static final String TRS_PTERM_NEXT_PAGE = TRS_NAMESPACE_PREFIX+ ':' + TRS_TERM_NEXT_PAGE; //$NON-NLS-1$
- public static final String TRS_NEXT_PAGE = TRS_NAMESPACE + TRS_TERM_NEXT_PAGE;
public static final String TRS_TERM_ORDER = "order"; //$NON-NLS-1$
public static final String TRS_PTERM_ORDER = TRS_NAMESPACE_PREFIX+ ':' + TRS_TERM_ORDER; //$NON-NLS-1$
public static final String TRS_ORDER = TRS_NAMESPACE + TRS_TERM_ORDER;
@@ -95,4 +92,17 @@ public interface TRSConstants extends OslcConstants {
public static final String RDF_NIL = RDF_NAMESPACE + RDF_TERM_NIL;
public static final String FileSep = System.getProperty("file.separator");
+
+ //LDP Constants
+ public static final String LDP_NAMESPACE_PREFIX = "ldp";
+ public static final String LDP_NAMESPACE = "http://www.w3.org/ns/ldp#";
+ public static final String LDP_TERM_AGGREGATE_CONTAINER = "AggregateContainer";
+ public static final String LDP_AGGREGATE_CONTAINER = LDP_NAMESPACE + LDP_TERM_AGGREGATE_CONTAINER;
+ public static final String LDP_TERM_PAGE = "Page";
+ public static final String LDP_PAGE = LDP_NAMESPACE + LDP_TERM_PAGE;
+ public static final String LDP_TERM_NEXT_PAGE = "nextPage"; //$NON-NLS-1$
+ public static final String LDP_NEXT_PAGE = LDP_NAMESPACE + LDP_TERM_NEXT_PAGE;
+ public static final String LDP_TERM_PAGE_OF = "pageOf";
+ public static final String LDP_PAGE_OF = LDP_NAMESPACE + LDP_TERM_PAGE_OF;
+
}
diff --git a/org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/TrackedResourceSet.java b/org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/TrackedResourceSet.java
index 814662f..21e91c2 100644
--- a/org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/TrackedResourceSet.java
+++ b/org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/TrackedResourceSet.java
@@ -16,6 +16,7 @@
package org.eclipse.lyo.core.trs;
import java.net.URI;
+import java.net.URISyntaxException;
import org.eclipse.lyo.oslc4j.core.annotation.OslcDescription;
import org.eclipse.lyo.oslc4j.core.annotation.OslcName;
@@ -34,7 +35,7 @@ import static org.eclipse.lyo.core.trs.TRSConstants.*;
* resources "on the wire" may vary):
* <pre>
# Resource: http://cm1.example.com/trackedResourceSet
-{@literal @prefix trs: <http://jazz.net/ns/trs#> .}
+{@literal @prefix trs: <http://open-services.net/ns/core/trs#> .}
{@code
<http://cm1.example.com/trackedResourceSet>
@@ -61,7 +62,7 @@ Resource Set resources and relegate the Base to separate resources.
* Tracked Resource Set with non-empty change log
*/
@OslcNamespace(TRS_NAMESPACE)
-@OslcResourceShape(title = "Tracked Resource Set Shape", describes = TRS_TYPE_TRACKED_RESOURCE_SET)
+@OslcResourceShape(title = "Tracked Resource Set Shape", describes = TRS_TYPE_TRACKED_RESOURCE_SET)
public class TrackedResourceSet extends AbstractResource
{
private AbstractChangeLog changeLog;
@@ -80,8 +81,12 @@ public class TrackedResourceSet extends AbstractResource
/**
* @param changeLog the changeLog to set
+ * @throws URISyntaxException
*/
- public void setChangeLog(AbstractChangeLog changeLog) {
+ public void setChangeLog(AbstractChangeLog changeLog) throws URISyntaxException {
+ // Make sure the About URI of the change log is null since it will
+ // become a blank node in the turtle output
+ changeLog.setAbout(null);
this.changeLog = changeLog;
}
diff --git a/org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/package-info.java b/org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/package-info.java
index 8b56b13..1a83414 100644
--- a/org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/package-info.java
+++ b/org.eclipse.lyo.core.trs/src/main/java/org/eclipse/lyo/core/trs/package-info.java
@@ -18,7 +18,8 @@
@OslcNamespaceDefinition(prefix = OslcConstants.OSLC_CORE_NAMESPACE_PREFIX, namespaceURI = OslcConstants.OSLC_CORE_NAMESPACE),
@OslcNamespaceDefinition(prefix = OslcConstants.RDF_NAMESPACE_PREFIX, namespaceURI = OslcConstants.RDF_NAMESPACE),
@OslcNamespaceDefinition(prefix = OslcConstants.RDFS_NAMESPACE_PREFIX, namespaceURI = OslcConstants.RDFS_NAMESPACE),
- @OslcNamespaceDefinition(prefix = TRSConstants.TRS_NAMESPACE_PREFIX, namespaceURI = TRSConstants.TRS_NAMESPACE) })
+ @OslcNamespaceDefinition(prefix = TRSConstants.TRS_NAMESPACE_PREFIX, namespaceURI = TRSConstants.TRS_NAMESPACE),
+ @OslcNamespaceDefinition(prefix = TRSConstants.LDP_NAMESPACE_PREFIX, namespaceURI = TRSConstants.LDP_NAMESPACE)})
package org.eclipse.lyo.core.trs;
import org.eclipse.lyo.oslc4j.core.annotation.OslcNamespaceDefinition;