Mercurial > hg > AnnotationManager
diff src/de/mpiwg/itgroup/annotationManager/RDFHandling/RDFSearcher.java @ 2:6888ae3287b8
changed to namespace handling for users
author | dwinter |
---|---|
date | Thu, 24 Nov 2011 11:39:12 +0100 |
parents | 77530be3c747 |
children | 0be9d53a6967 |
line wrap: on
line diff
--- a/src/de/mpiwg/itgroup/annotationManager/RDFHandling/RDFSearcher.java Wed Nov 23 15:26:33 2011 +0100 +++ b/src/de/mpiwg/itgroup/annotationManager/RDFHandling/RDFSearcher.java Thu Nov 24 11:39:12 2011 +0100 @@ -10,6 +10,8 @@ import org.restlet.Context; import org.restlet.engine.component.ChildContext; +import sun.security.action.GetBooleanAction; + import de.mpiwg.itgroup.annotationManager.Errors.TripleStoreSearchError; import de.mpiwg.itgroup.annotationManager.RDFHandling.Convert.Annotation; import de.mpiwg.itgroup.nimanager.exceptions.TripleStoreHandlerException; @@ -31,6 +33,15 @@ + /** Sucht im Triplestore nach Annotationen + * @param uri Adresse der Annotierten Ressource, in der Regel nicht mit dem xpointer, sonder die URI der kompletten Ressource oder NULL oder leer + * @param user Author der Annotationen, entweder als uri der Person oder ein Username, je nachdem wie die Annotatinen angelegt wurden. + * @param limit + * @param offset + * @return + * @throws TripleStoreHandlerException + * @throws TripleStoreSearchError + */ public List<Annotation> search(String uri, String user, String limit, String offset) throws TripleStoreHandlerException, TripleStoreSearchError { @@ -46,15 +57,19 @@ //whereString +="?s <http://ontologies.mpiwg-berlin.mpg.de/annotations/docuviewerText> ?link."; if(uri!=null && !uri.equals("")){ - whereString +=String.format("?s <http://ontologies.mpiwg-berlin.mpg.de/annotations/docuviewerText> <%s>.",uri);} + whereString +=String.format("?s <http://ontologies.mpiwg-berlin.mpg.de/annotations/annotatesDocuviewerText> <%s>.",uri);} else { - whereString +=String.format("?s <http://ontologies.mpiwg-berlin.mpg.de/annotations/docuviewerText> ?uri."); + whereString +=String.format("?s <http://ontologies.mpiwg-berlin.mpg.de/annotations/annotatesDocuviewerText> ?uri."); } whereString +=String.format("?s <http://ontologies.mpiwg-berlin.mpg.de/annotations/textSelection> ?xpointer."); whereString +=String.format("?s <http://www.w3.org/2000/10/annotation-ns#body> ?annotText."); if(user!=null && !user.equals("")){ - whereString +=String.format("?s <http://www.w3.org/2000/10/annotation-ns#author> \"%s\".",user); + if (user.startsWith("http")){ + whereString +=String.format("?s <http://www.w3.org/2000/10/annotation-ns#author> <%s>.",user); + } else { + whereString +=String.format("?s <http://www.w3.org/2000/10/annotation-ns#author> \"%s\".",user); + } } else { whereString +=String.format("?s <http://www.w3.org/2000/10/annotation-ns#author> ?author."); } @@ -91,7 +106,7 @@ Annotation annot = new Annotation(result.getBinding("xpointer").getValue().stringValue(), annotUser, result.getBinding("created").getValue().stringValue(), result.getBinding("text").getValue().stringValue(), null, - annotUri); + annotUri,result.getBinding("s").getValue().stringValue()); retAnnots.add(annot); } } catch (Exception e) {