You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@clerezza.apache.org by bb...@apache.org on 2011/03/23 21:59:35 UTC
svn commit: r1084740 -
/incubator/clerezza/trunk/parent/rdf.utils/src/main/java/org/apache/clerezza/rdf/utils/GraphNode.java
Author: bblfish
Date: Wed Mar 23 20:59:34 2011
New Revision: 1084740
URL: http://svn.apache.org/viewvc?rev=1084740&view=rev
Log:
CLEREZZA-472: Adding addInverseProperty method
Modified:
incubator/clerezza/trunk/parent/rdf.utils/src/main/java/org/apache/clerezza/rdf/utils/GraphNode.java
Modified: incubator/clerezza/trunk/parent/rdf.utils/src/main/java/org/apache/clerezza/rdf/utils/GraphNode.java
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/rdf.utils/src/main/java/org/apache/clerezza/rdf/utils/GraphNode.java?rev=1084740&r1=1084739&r2=1084740&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/rdf.utils/src/main/java/org/apache/clerezza/rdf/utils/GraphNode.java (original)
+++ incubator/clerezza/trunk/parent/rdf.utils/src/main/java/org/apache/clerezza/rdf/utils/GraphNode.java Wed Mar 23 20:59:34 2011
@@ -475,6 +475,7 @@ public class GraphNode {
}
}
+
/**
* Coverts the value into a typed literals and sets it as object of the
* specified property
@@ -488,6 +489,22 @@ public class GraphNode {
}
/**
+ * Adds a property to the node with the inverse of the specified predicate and object
+ * In other words <code>subject</code> will be related via the property <code>relation</code> to this node.
+ *
+ * @param predicate
+ * @param subject
+ */
+ public void addInverseProperty(UriRef predicate, Resource subject) {
+ if (subject instanceof NonLiteral) {
+ graph.add(new TripleImpl((NonLiteral) subject, predicate, resource));
+ } else {
+ throw new RuntimeException("Literals cannot be the subject of a statement");
+ }
+ }
+
+
+ /**
* creates and returns an <code>RdfList</code> for the node and
* TripleCollection represented by this object.
*