diff src/main/java/de/mpiwg/itgroup/annotationManager/RDFHandling/Convert.java @ 26:235b91ba8dff

on the way to new annotations...
author casties
date Thu, 26 Apr 2012 11:44:57 +0200
parents 52dff477e45f
children b4a798d417fe
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/itgroup/annotationManager/RDFHandling/Convert.java	Wed Apr 25 18:02:44 2012 +0200
+++ b/src/main/java/de/mpiwg/itgroup/annotationManager/RDFHandling/Convert.java	Thu Apr 26 11:44:57 2012 +0200
@@ -66,9 +66,11 @@
         if (annotationUrl == null) {
             annotationUrl = createRessourceURL("annot:");
         }
-        // type
-        // TODO: where to get types?
-        retQuad.add(new LiteralQuadruple(annotationUrl, NS.RDF + "type", annot.type, context));
+
+        // annotation class
+        retQuad.add(new Quadruple(annotationUrl, NS.RDF_NS + "type", NS.OAC_NS + "Annotation", context));
+        // TODO: what types?
+        //retQuad.add(new LiteralQuadruple(annotationUrl, NS.RDF + "type", annot.type, context));
 
         // author
         if (annot.creator.startsWith("http")) {
@@ -84,23 +86,28 @@
         }
         retQuad.add(new LiteralQuadruple(annotationUrl, NS.DCTERMS_NS + "created", annot.time, context));
 
-        String[] xpointerSplitted = annot.xpointer.split("#");
-
+        // target (full URL)
+        retQuad.add(new Quadruple(annot.xpointer, NS.RDF_NS + "type", NS.OAC_NS + "Target", context));
+        // is target of annotation
+        retQuad.add(new Quadruple(annotationUrl, NS.OAC_NS + "hasTarget", annot.xpointer, context));
+        
+        // now add the xpointers
+        /* String[] xpointerSplitted = annot.xpointer.split("#");
         if (xpointerSplitted.length > 2) {
             throw new XPointerError();
         }
-
-        // now add the xpointers
-        retQuad.add(new Quadruple(annotationUrl, NS.MPIWG_annot + "annotatesDocuviewerText", xpointerSplitted[0], context));
-        retQuad.add(new Quadruple(annotationUrl, NS.MPIWG_annot + "textSelection", annot.xpointer, context));
+        retQuad.add(new Quadruple(annotationUrl, NS.MPIWG_ANNOT_URL + "annotatesDocuviewerText", xpointerSplitted[0], context));
+        retQuad.add(new Quadruple(annotationUrl, NS.MPIWG_ANNOT_URL + "textSelection", annot.xpointer, context));
+        */
 
-        String annotationtext = createRessourceURL("annotText:");
-
-        retQuad.add(new Quadruple(annotationUrl, NS.ANNOTATION_NS + "body", annotationtext, context));
+        // annotation body
+        String annotationtext = createRessourceURL("annotationBody:");
+        
+        retQuad.add(new Quadruple(annotationUrl, NS.OAC_NS + "Body", annotationtext, context));
 
-        retQuad.add(new Quadruple(annotationtext, NS.RDF + "type", NS.MPIWG_annot + "StandardTextNote", context));
+        retQuad.add(new Quadruple(annotationtext, NS.RDF_NS + "type", NS.MPIWG_ANNOT_URL + "StandardTextNote", context));
 
-        retQuad.add(new LiteralQuadruple(annotationtext, NS.MPIWG_annot + "containsText", annot.text, context));
+        retQuad.add(new LiteralQuadruple(annotationtext, NS.MPIWG_ANNOT_URL + "containsText", annot.text, context));
 
         for (Quadruple ret : retQuad) {
             logger.debug(ret.toString());
@@ -145,17 +152,17 @@
         }
 
         // TODO: check type
-        retQuad.add(new Quadruple(annotation, NS.RDF + "type", NS.ANNOTATION_TYPE + annot.type, context));
+        retQuad.add(new Quadruple(annotation, NS.RDF_NS + "type", NS.ANNOTATION_TYPE + annot.type, context));
 
         // add author
         if (annot.creator.startsWith("http")) {
-            retQuad.add(new Quadruple(annotation, NS.ANNOTATION_NS + "author", annot.creator, context));
+            retQuad.add(new Quadruple(annotation, NS.OAC_NS + "author", annot.creator, context));
         } else {
-            retQuad.add(new LiteralQuadruple(annotation, NS.ANNOTATION_NS + "author", annot.creator, context));
+            retQuad.add(new LiteralQuadruple(annotation, NS.OAC_NS + "author", annot.creator, context));
         }
 
         // creation time
-        retQuad.add(new LiteralQuadruple(annotation, NS.ANNOTATION_NS + "created", annot.time, context));
+        retQuad.add(new LiteralQuadruple(annotation, NS.OAC_NS + "created", annot.time, context));
 
         String[] xpointerSplitted = annot.xpointer.split("#");
 
@@ -164,14 +171,14 @@
         }
 
         // now add the xpointers
-        retQuad.add(new Quadruple(annotation, NS.MPIWG_annot + "annotatesDocuviewerText", xpointerSplitted[0], context));
-        retQuad.add(new Quadruple(annotation, NS.MPIWG_annot + "textSelection", annot.xpointer, context));
+        retQuad.add(new Quadruple(annotation, NS.MPIWG_ANNOT_URL + "annotatesDocuviewerText", xpointerSplitted[0], context));
+        retQuad.add(new Quadruple(annotation, NS.MPIWG_ANNOT_URL + "textSelection", annot.xpointer, context));
 
         // String annotationtext =createRessourceURL("annotText:");
 
-        retQuad.add(new Quadruple(annotation, NS.ANNOTATION_NS + "body", annot.url, context));
+        retQuad.add(new Quadruple(annotation, NS.OAC_NS + "body", annot.url, context));
 
-        retQuad.add(new Quadruple(annot.url, NS.RDF + "type", NS.MPIWG_annot + "ExtendedAnnotation", context));
+        retQuad.add(new Quadruple(annot.url, NS.RDF_NS + "type", NS.MPIWG_ANNOT_URL + "ExtendedAnnotation", context));
 
         for (Quadruple ret : retQuad) {
             logger.debug(ret.toString());