# HG changeset patch # User casties # Date 1335433497 -7200 # Node ID 235b91ba8dffe2c9fa2d815d9f8f2083e3bbc3af # Parent 52dff477e45f6a42f60f7587f056f8a897524ba0 on the way to new annotations... diff -r 52dff477e45f -r 235b91ba8dff .classpath --- a/.classpath Wed Apr 25 18:02:44 2012 +0200 +++ b/.classpath Thu Apr 26 11:44:57 2012 +0200 @@ -12,45 +12,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + diff -r 52dff477e45f -r 235b91ba8dff .hgignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Thu Apr 26 11:44:57 2012 +0200 @@ -0,0 +1,3 @@ + +syntax: regexp +^target$ \ No newline at end of file diff -r 52dff477e45f -r 235b91ba8dff .settings/org.eclipse.wst.common.project.facet.core.xml --- a/.settings/org.eclipse.wst.common.project.facet.core.xml Wed Apr 25 18:02:44 2012 +0200 +++ b/.settings/org.eclipse.wst.common.project.facet.core.xml Thu Apr 26 11:44:57 2012 +0200 @@ -6,5 +6,5 @@ - + diff -r 52dff477e45f -r 235b91ba8dff libs/jsontoken-1.1-SNAPSHOT.jar Binary file libs/jsontoken-1.1-SNAPSHOT.jar has changed diff -r 52dff477e45f -r 235b91ba8dff pom.xml --- a/pom.xml Wed Apr 25 18:02:44 2012 +0200 +++ b/pom.xml Thu Apr 26 11:44:57 2012 +0200 @@ -42,6 +42,13 @@ + + com.google.code.gson + gson + 1.4 + jar + compile + org.restlet.jee org.restlet diff -r 52dff477e45f -r 235b91ba8dff src/main/java/de/mpiwg/itgroup/annotationManager/Constants/NS.java --- a/src/main/java/de/mpiwg/itgroup/annotationManager/Constants/NS.java Wed Apr 25 18:02:44 2012 +0200 +++ b/src/main/java/de/mpiwg/itgroup/annotationManager/Constants/NS.java Thu Apr 26 11:44:57 2012 +0200 @@ -1,11 +1,12 @@ package de.mpiwg.itgroup.annotationManager.Constants; public class NS { - public static final String MPIWG_PERSONS = "http://entities.mpiwg-berlin.mpg.de/persons/"; - //public static String ANNOTATION_TYPE="http://www.w3.org/2000/10/annotationType#"; - public static final String ANNOTATION_NS="http://www.openannotation.org/ns/"; - public static final String DCTERMS_NS="http://www.purl.org/dc/terms/"; - public static final String RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"; - public static final String MPIWG_annot="http://entities.mpiwg-berlin.mpg.de/annotations/"; - + public static final String MPIWG_PERSONS_URL = "http://entities.mpiwg-berlin.mpg.de/persons/"; + // public static String + // ANNOTATION_TYPE="http://www.w3.org/2000/10/annotationType#"; + public static final String OAC_NS = "http://www.openannotation.org/ns/"; + public static final String DCTERMS_NS = "http://www.purl.org/dc/terms/"; + public static final String RDF_NS = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"; + public static final String MPIWG_ANNOT_URL = "http://entities.mpiwg-berlin.mpg.de/annotations/"; + } diff -r 52dff477e45f -r 235b91ba8dff src/main/java/de/mpiwg/itgroup/annotationManager/RDFHandling/Convert.java --- 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()); diff -r 52dff477e45f -r 235b91ba8dff src/main/java/de/mpiwg/itgroup/annotationManager/restlet/AddAndReadAnnotations.java --- a/src/main/java/de/mpiwg/itgroup/annotationManager/restlet/AddAndReadAnnotations.java Wed Apr 25 18:02:44 2012 +0200 +++ b/src/main/java/de/mpiwg/itgroup/annotationManager/restlet/AddAndReadAnnotations.java Thu Apr 26 11:44:57 2012 +0200 @@ -154,8 +154,8 @@ RestServer restServer = (RestServer) getApplication(); String userID= annot.creator; - if (userID.startsWith(NS.MPIWG_PERSONS)){ - userID=userID.replace(NS.MPIWG_PERSONS, ""); //entferne NAMESPACE + if (userID.startsWith(NS.MPIWG_PERSONS_URL)){ + userID=userID.replace(NS.MPIWG_PERSONS_URL, ""); //entferne NAMESPACE } String userName=restServer.getUserNameFromLdap(userID); userObject.put("name",userName); @@ -502,7 +502,7 @@ //username should be a URI, if not it will set to the MPIWG namespace defined in de.mpiwg.itgroup.annotationManager.Constants.NS String usernameOrig=username; if (!username.startsWith("http")) - username=NS.MPIWG_PERSONS+username; + username=NS.MPIWG_PERSONS_URL+username; if (mode.equals("complexAnnotation")){// Annotation mit text in externer ressource @@ -590,7 +590,7 @@ //username should be a URI, if not it will set to the MPIWG namespace defined in de.mpiwg.itgroup.annotationManager.Constants.NS if (!username.startsWith("http")) - username=NS.MPIWG_PERSONS+username; + username=NS.MPIWG_PERSONS_URL+username; return new Annotation(xpointer, username, null, text, type, url); } @@ -675,7 +675,7 @@ //username should be a URI, if not it will set to the MPIWG namespace defined in de.mpiwg.itgroup.annotationManager.Constants.NS if (!username.startsWith("http")) - username=NS.MPIWG_PERSONS+username; + username=NS.MPIWG_PERSONS_URL+username; return new Annotation(xpointer, username, null, text, null); } diff -r 52dff477e45f -r 235b91ba8dff src/main/java/de/mpiwg/itgroup/annotationManager/restlet/AnnotatorAnnotations.java --- a/src/main/java/de/mpiwg/itgroup/annotationManager/restlet/AnnotatorAnnotations.java Wed Apr 25 18:02:44 2012 +0200 +++ b/src/main/java/de/mpiwg/itgroup/annotationManager/restlet/AnnotatorAnnotations.java Thu Apr 26 11:44:57 2012 +0200 @@ -253,7 +253,7 @@ // de.mpiwg.itgroup.annotationManager.Constants.NS String usernameOrig = username; if (!username.startsWith("http")) - username = NS.MPIWG_PERSONS + username; + username = NS.MPIWG_PERSONS_URL + username; if (mode.equals("complexAnnotation")) {// Annotation mit text in externer ressource diff -r 52dff477e45f -r 235b91ba8dff src/main/java/de/mpiwg/itgroup/annotationManager/restlet/AnnotatorResourceImpl.java --- a/src/main/java/de/mpiwg/itgroup/annotationManager/restlet/AnnotatorResourceImpl.java Wed Apr 25 18:02:44 2012 +0200 +++ b/src/main/java/de/mpiwg/itgroup/annotationManager/restlet/AnnotatorResourceImpl.java Thu Apr 26 11:44:57 2012 +0200 @@ -175,8 +175,8 @@ userObject.put("uri", annot.creator); // make short user id String userID = annot.creator; - if (userID.startsWith(NS.MPIWG_PERSONS)) { - userID = userID.replace(NS.MPIWG_PERSONS, ""); // entferne NAMESPACE + if (userID.startsWith(NS.MPIWG_PERSONS_URL)) { + userID = userID.replace(NS.MPIWG_PERSONS_URL, ""); // entferne NAMESPACE } // save as id userObject.put("id", userID); @@ -321,7 +321,7 @@ if (username.startsWith("http")) { userUri = username; } else { - userUri = NS.MPIWG_PERSONS + username; + userUri = NS.MPIWG_PERSONS_URL + username; } } // TODO: should we overwrite the creator? diff -r 52dff477e45f -r 235b91ba8dff src/main/java/de/mpiwg/itgroup/annotationManager/restlet/SearchAnnotations.java --- a/src/main/java/de/mpiwg/itgroup/annotationManager/restlet/SearchAnnotations.java Wed Apr 25 18:02:44 2012 +0200 +++ b/src/main/java/de/mpiwg/itgroup/annotationManager/restlet/SearchAnnotations.java Thu Apr 26 11:44:57 2012 +0200 @@ -150,8 +150,8 @@ RestServer restServer = (RestServer) getApplication(); String userID= annot.creator; - if (userID.startsWith(NS.MPIWG_PERSONS)){ - userID=userID.replace(NS.MPIWG_PERSONS, ""); //entferne NAMESPACE + if (userID.startsWith(NS.MPIWG_PERSONS_URL)){ + userID=userID.replace(NS.MPIWG_PERSONS_URL, ""); //entferne NAMESPACE } String userName=restServer.getUserNameFromLdap(userID); userObject.put("name",userName); @@ -365,7 +365,7 @@ //username should be a URI, if not it will set to the MPIWG namespace defined in de.mpiwg.itgroup.annotationManager.Constants.NS String usernameOrig=username; if (!username.startsWith("http")) - username=NS.MPIWG_PERSONS+username; + username=NS.MPIWG_PERSONS_URL+username; if (mode.equals("complexAnnotation")){// Annotation mit text in externer ressource @@ -448,7 +448,7 @@ //username should be a URI, if not it will set to the MPIWG namespace defined in de.mpiwg.itgroup.annotationManager.Constants.NS if (!username.startsWith("http")) - username=NS.MPIWG_PERSONS+username; + username=NS.MPIWG_PERSONS_URL+username; return new Annotation(xpointer, username, null, text, type, url); } @@ -533,7 +533,7 @@ //username should be a URI, if not it will set to the MPIWG namespace defined in de.mpiwg.itgroup.annotationManager.Constants.NS if (!username.startsWith("http")) - username=NS.MPIWG_PERSONS+username; + username=NS.MPIWG_PERSONS_URL+username; return new Annotation(xpointer, username, null, text, null); }