Author: rwesten
Date: Tue Jan 25 10:50:46 2011
New Revision: 1063221
URL: http://svn.apache.org/viewvc?rev=1063221&view=rev
Log:
The JCR Store is outdated and the RDF Triple <-> JCR Node mapping is not fully
functional.
Added three TODOs to note the locations in the code that need to be improved.
see also
http://mail-archives.apache.org/mod_mbox/incubator-stanbol-dev/201101.mbox/browser
for a more detailed description of the Situation and possible solutions
Modified:
incubator/stanbol/trunk/fise/stores/jcrstore/src/main/java/eu/iksproject/fise/store/JCRStore.java
incubator/stanbol/trunk/fise/stores/jcrstore/src/main/java/eu/iksproject/fise/store/jcr/JCRContentItem.java
Modified:
incubator/stanbol/trunk/fise/stores/jcrstore/src/main/java/eu/iksproject/fise/store/JCRStore.java
URL:
http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/stores/jcrstore/src/main/java/eu/iksproject/fise/store/JCRStore.java?rev=1063221&r1=1063220&r2=1063221&view=diff
==============================================================================
---
incubator/stanbol/trunk/fise/stores/jcrstore/src/main/java/eu/iksproject/fise/store/JCRStore.java
(original)
+++
incubator/stanbol/trunk/fise/stores/jcrstore/src/main/java/eu/iksproject/fise/store/JCRStore.java
Tue Jan 25 10:50:46 2011
@@ -176,4 +176,38 @@ public class JCRStore implements Store {
}
return null;
}
+
+ @Override
+ public MGraph getEnhancementGraph() {
+ // TODO Implement!
+ /* Rupert Westenthaler (24.01.2011)
+ * This Method was was part of the Store API when the JCR Store was
+ * implemented.
+ *
+ * Here we need to get an MGraph for all content items and add them to
+ * a single MGraph.
+ * One possibility would be to use something like an "semantic index" -
+ * an Graph that contains all the the metadata of all the content items
+ * within the JCR Store. Every time a new version of an content item is
+ * stored in the JCR Store, the old version of the content item would
+ * needed to be deleted and the new version would needed to be added to
+ * this store. In addition one would need to provide an bootstrapping
+ * functionality to build up or restore the semantic index if
necessary.
+ *
+ * An other possibility would be to implement the Clerezza Graph
+ * interface. This could be done by extending the AbstractMGraph
+ * interface and usually requires to implement the
+ * - add(Triple)
+ * - remove(Triple) and the
+ * - Iterator<Triple> filter(NonLiteral subject, UriRef predicate,
+ * Resource object) method that supports parsing null as wildcard for
+ * each of the three arguments.
+ * By doing that one really nice side effect would be, that this would
+ * also allow to execute SPARQL queries directly on the JCR Store
+ * (because Clerezza provides SPARQL functionality on top of any graph
+ * implementation).
+ */
+// return null;
+ throw new UnsupportedOperationException("This Method is not
implementad by this Store.");
+ }
}
Modified:
incubator/stanbol/trunk/fise/stores/jcrstore/src/main/java/eu/iksproject/fise/store/jcr/JCRContentItem.java
URL:
http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/stores/jcrstore/src/main/java/eu/iksproject/fise/store/jcr/JCRContentItem.java?rev=1063221&r1=1063220&r2=1063221&view=diff
==============================================================================
---
incubator/stanbol/trunk/fise/stores/jcrstore/src/main/java/eu/iksproject/fise/store/jcr/JCRContentItem.java
(original)
+++
incubator/stanbol/trunk/fise/stores/jcrstore/src/main/java/eu/iksproject/fise/store/jcr/JCRContentItem.java
Tue Jan 25 10:50:46 2011
@@ -128,6 +128,18 @@ public class JCRContentItem implements C
}
Node tripleNode = jcrNode.addNode(name);
+ /*
+ * TODO: Rupert Westenthaler 25.01.2011
+ * Using the toString method of the subject, predicate and object is
+ * not sufficient here. One needs to treat UriRefs, PlainLiterals,
+ * TypedLiterals and especially BNodes (blank nodes) differently.
+ * For Plain literals it is important to also store the language. For
+ * Typed Literals it is important to store the xsd:dataType (or even
+ * map the xsd:dataType to the according jcr:type.
+ * For BNodes one needs to keep a bidirectional mapping between the
+ * BNode instance and the JCR:Property (e.g. by using an random ID as
+ * value and map this value to an BNode instance.
+ */
tripleNode.setProperty(SUBJECT, triple.getSubject().toString());
tripleNode.setProperty(PREDICATE, triple.getPredicate().toString());
tripleNode.setProperty(OBJECT, triple.getObject().toString());
@@ -182,6 +194,18 @@ public class JCRContentItem implements C
if (childNode.hasProperty(SUBJECT)
&& childNode.hasProperty(PREDICATE)
&& childNode.hasProperty(OBJECT)) {
+ /*
+ * TODO: Rupert Westenthaler 25.01.2011
+ * Triples may use
+ * - any kind of NonLiteral as Subject (BNode or UriRef)
+ * - only an UriRef as property (Predicate)
+ * - any Resource (PlainLiteral, TypedLiteral, NBode or
UriRef)
+ * as Object.
+ * The Node representing the triple need to store the
required
+ * information and this mapping implementation need to be
+ * adapted accordingly.
+ * See also TODO for createNode(..)
+ */
graph.add(new TripleImpl(new UriRef(childNode.getProperty(
SUBJECT).getValue().getString()), new UriRef(
childNode.getProperty(PREDICATE).getValue()