You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@clerezza.apache.org by re...@apache.org on 2011/06/28 19:06:50 UTC
svn commit: r1140726 -
/incubator/clerezza/trunk/parent/platform.content/src/main/java/org/apache/clerezza/platform/content/DiscobitsTypeHandler.java
Author: reto
Date: Tue Jun 28 17:06:50 2011
New Revision: 1140726
URL: http://svn.apache.org/viewvc?rev=1140726&view=rev
Log:
CLEREZZA-585: checking that the returned GraphNodes actually contains at least one triple about the requested resource, otherwise return 404
Modified:
incubator/clerezza/trunk/parent/platform.content/src/main/java/org/apache/clerezza/platform/content/DiscobitsTypeHandler.java
Modified: incubator/clerezza/trunk/parent/platform.content/src/main/java/org/apache/clerezza/platform/content/DiscobitsTypeHandler.java
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.content/src/main/java/org/apache/clerezza/platform/content/DiscobitsTypeHandler.java?rev=1140726&r1=1140725&r2=1140726&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/platform.content/src/main/java/org/apache/clerezza/platform/content/DiscobitsTypeHandler.java (original)
+++ incubator/clerezza/trunk/parent/platform.content/src/main/java/org/apache/clerezza/platform/content/DiscobitsTypeHandler.java Tue Jun 28 17:06:50 2011
@@ -147,7 +147,7 @@ public class DiscobitsTypeHandler extend
@Produces({"*/*"})
public Object getResource(@Context UriInfo uriInfo) {
final UriRef uri = new UriRef(uriInfo.getAbsolutePath().toString());
- final GraphNode graphNode = getResourceAsGraphNode(uriInfo);
+ final GraphNode graphNode = getResourceAsGraphNode(uriInfo);
if (graphNode == null) {
return resourceUnavailable(uri, uriInfo);
}
@@ -165,7 +165,16 @@ public class DiscobitsTypeHandler extend
private GraphNode getResourceAsGraphNode(UriInfo uriInfo) {
final UriRef uri = new UriRef(uriInfo.getAbsolutePath().toString());
- return graphNodeProvider.getLocal(uri);
+ GraphNode result = graphNodeProvider.getLocal(uri);
+ //could chck if nodeContext > 0, but this would be less efficient
+ TripleCollection tc = result.getGraph();
+ if (tc.filter(uri, null, null).hasNext()) {
+ return result;
+ }
+ if (tc.filter(null, null, uri).hasNext()) {
+ return result;
+ }
+ return null;
}