summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphleal@br.ibm.com2013-07-26 10:13:52 (EDT)
committer Samuel Padgett2013-07-26 11:09:27 (EDT)
commit2cb8007c3c14084850a562be9d6c499abf89bfb9 (patch)
tree5378ca38296610efe1465c5107610c2f72dc6f96
parent0250045e739389f96b3460a4489055eade135295 (diff)
downloadorg.eclipse.lyo.core-2cb8007c3c14084850a562be9d6c499abf89bfb9.zip
org.eclipse.lyo.core-2cb8007c3c14084850a562be9d6c499abf89bfb9.tar.gz
org.eclipse.lyo.core-2cb8007c3c14084850a562be9d6c499abf89bfb9.tar.bz2
Bug 413266 - Add support to query result list as Containerrefs/changes/91/14891/2
Add org.eclipse.lyo.oslc4j.queryResultListAsContainer property to control the result type. Set it to "true" for type rdfs:Container. Change-Id: If3e203f5f0ddb7af8e4474d28d8091fc475e875b Signed-off-by: phleal@br.ibm.com <phleal@br.ibm.com>
-rw-r--r--org.eclipse.lyo.oslc4j.core/src/org/eclipse/lyo/oslc4j/core/OSLC4JConstants.java8
-rw-r--r--org.eclipse.lyo.oslc4j.core/src/org/eclipse/lyo/oslc4j/core/OSLC4JUtils.java10
-rw-r--r--org.eclipse.lyo.oslc4j.core/src/org/eclipse/lyo/oslc4j/core/model/OslcConstants.java2
-rw-r--r--org.eclipse.lyo.oslc4j.provider.jena/src/org/eclipse/lyo/oslc4j/provider/jena/JenaModelHelper.java9
-rw-r--r--org.eclipse.lyo.oslc4j.provider.json4j/src/org/eclipse/lyo/oslc4j/provider/json4j/JsonHelper.java18
5 files changed, 46 insertions, 1 deletions
diff --git a/org.eclipse.lyo.oslc4j.core/src/org/eclipse/lyo/oslc4j/core/OSLC4JConstants.java b/org.eclipse.lyo.oslc4j.core/src/org/eclipse/lyo/oslc4j/core/OSLC4JConstants.java
index a5e490b..62c7e00 100644
--- a/org.eclipse.lyo.oslc4j.core/src/org/eclipse/lyo/oslc4j/core/OSLC4JConstants.java
+++ b/org.eclipse.lyo.oslc4j.core/src/org/eclipse/lyo/oslc4j/core/OSLC4JConstants.java
@@ -33,4 +33,12 @@ public interface OSLC4JConstants {
public static final String OSLC4J_SELECTED_PROPERTIES = "org.eclipse.lyo.oslc4j.selected.properties";
public static final String OSLC4J_NEXT_PAGE = "org.eclipse.lyo.oslc4j.next.page";
public static final String OSLC4J_TOTAL_COUNT = "org.eclipse.lyo.oslc4j.total.count";
+
+ /**
+ * System property {@value} : When "true", the query result list type will be
+ * http://www.w3.org/2000/01/rdf-schema#Container, otherwise it will
+ * have no type. No type is the default.
+ *
+ */
+ public static final String OSLC4J_QUERY_RESULT_LIST_AS_CONTAINER = "org.eclipse.lyo.oslc4j.queryResultListAsContainer";
}
diff --git a/org.eclipse.lyo.oslc4j.core/src/org/eclipse/lyo/oslc4j/core/OSLC4JUtils.java b/org.eclipse.lyo.oslc4j.core/src/org/eclipse/lyo/oslc4j/core/OSLC4JUtils.java
index d1c8bf7..abc4b8c 100644
--- a/org.eclipse.lyo.oslc4j.core/src/org/eclipse/lyo/oslc4j/core/OSLC4JUtils.java
+++ b/org.eclipse.lyo.oslc4j.core/src/org/eclipse/lyo/oslc4j/core/OSLC4JUtils.java
@@ -199,4 +199,14 @@ public class OSLC4JUtils {
}
return retVal;
}
+
+ /**
+ * Return if the query result list type will be
+ * http://www.w3.org/2000/01/rdf-schema#Container or there will be no type.
+ * Default is no type.
+ */
+ public static boolean isQueryResultListAsContainer()
+ {
+ return "true".equals(System.getProperty(OSLC4JConstants.OSLC4J_QUERY_RESULT_LIST_AS_CONTAINER, "false"));
+ }
}
diff --git a/org.eclipse.lyo.oslc4j.core/src/org/eclipse/lyo/oslc4j/core/model/OslcConstants.java b/org.eclipse.lyo.oslc4j.core/src/org/eclipse/lyo/oslc4j/core/model/OslcConstants.java
index d4f1d43..511ad5f 100644
--- a/org.eclipse.lyo.oslc4j.core/src/org/eclipse/lyo/oslc4j/core/model/OslcConstants.java
+++ b/org.eclipse.lyo.oslc4j.core/src/org/eclipse/lyo/oslc4j/core/model/OslcConstants.java
@@ -53,6 +53,8 @@ public interface OslcConstants {
public static final String TYPE_SERVICE = OSLC_CORE_NAMESPACE + "Service";
public static final String TYPE_SERVICE_PROVIDER = OSLC_CORE_NAMESPACE + "ServiceProvider";
public static final String TYPE_SERVICE_PROVIDER_CATALOG = OSLC_CORE_NAMESPACE + "ServiceProviderCatalog";
+
+ public static final String TYPE_CONTAINER = RDFS_NAMESPACE + "Container";
public static final String PATH_RESOURCE_SHAPES = "resourceShapes";
diff --git a/org.eclipse.lyo.oslc4j.provider.jena/src/org/eclipse/lyo/oslc4j/provider/jena/JenaModelHelper.java b/org.eclipse.lyo.oslc4j.provider.jena/src/org/eclipse/lyo/oslc4j/provider/jena/JenaModelHelper.java
index 12beb2e..48a0673 100644
--- a/org.eclipse.lyo.oslc4j.provider.jena/src/org/eclipse/lyo/oslc4j/provider/jena/JenaModelHelper.java
+++ b/org.eclipse.lyo.oslc4j.provider.jena/src/org/eclipse/lyo/oslc4j/provider/jena/JenaModelHelper.java
@@ -173,7 +173,14 @@ public final class JenaModelHelper
if (descriptionAbout != null)
{
- descriptionResource = model.createResource(descriptionAbout);
+ if(OSLC4JUtils.isQueryResultListAsContainer())
+ {
+ descriptionResource = model.createResource(descriptionAbout, RDFS.Container);
+ }
+ else
+ {
+ descriptionResource = model.createResource(descriptionAbout);
+ }
if (responseInfoAbout != null)
{
diff --git a/org.eclipse.lyo.oslc4j.provider.json4j/src/org/eclipse/lyo/oslc4j/provider/json4j/JsonHelper.java b/org.eclipse.lyo.oslc4j.provider.json4j/src/org/eclipse/lyo/oslc4j/provider/json4j/JsonHelper.java
index e669687..9ec2d4b 100644
--- a/org.eclipse.lyo.oslc4j.provider.json4j/src/org/eclipse/lyo/oslc4j/provider/json4j/JsonHelper.java
+++ b/org.eclipse.lyo.oslc4j.provider.json4j/src/org/eclipse/lyo/oslc4j/provider/json4j/JsonHelper.java
@@ -197,6 +197,24 @@ public final class JsonHelper
resultJSONObject.put(rdfPrefix + JSON_PROPERTY_DELIMITER + JSON_PROPERTY_SUFFIX_ABOUT,
descriptionAbout);
+
+ /* Support for Container rdf:type */
+ if(OSLC4JUtils.isQueryResultListAsContainer()){
+ final JSONArray containerTypesJSONArray = new JSONArray();
+
+ final JSONObject containerTypeJSONObject = new JSONObject();
+
+
+ containerTypeJSONObject.put(rdfPrefix + JSON_PROPERTY_DELIMITER + JSON_PROPERTY_SUFFIX_RESOURCE,
+ OslcConstants.TYPE_CONTAINER);
+
+
+ containerTypesJSONArray.add(containerTypeJSONObject);
+
+ resultJSONObject.put(rdfPrefix + JSON_PROPERTY_DELIMITER + JSON_PROPERTY_SUFFIX_TYPE,
+ containerTypesJSONArray);
+ }
+
resultJSONObject.put(rdfsPrefix + JSON_PROPERTY_DELIMITER + JSON_PROPERTY_SUFFIX_MEMBER,
jsonArray);