0
|
1 //TODO: handle XML-Post des Annoteaprotocolls http://www.w3.org/2001/Annotea/User/Protocol.html
|
|
2
|
|
3 package de.mpiwg.itgroup.annotationManager.restlet;
|
|
4
|
|
5 import java.io.IOException;
|
|
6 import java.io.UnsupportedEncodingException;
|
|
7 import java.net.URLDecoder;
|
|
8 import java.net.URLEncoder;
|
|
9 import java.util.ArrayList;
|
|
10 import java.util.List;
|
|
11 import java.util.regex.Matcher;
|
|
12 import java.util.regex.Pattern;
|
|
13
|
|
14 import org.apache.log4j.Logger;
|
|
15 import org.json.JSONArray;
|
|
16 import org.json.JSONException;
|
|
17 import org.json.JSONObject;
|
|
18 import org.restlet.data.ClientInfo;
|
|
19 import org.restlet.data.Form;
|
|
20 import org.restlet.data.MediaType;
|
|
21 import org.restlet.data.Status;
|
|
22 import org.restlet.ext.json.JsonRepresentation;
|
|
23 import org.restlet.representation.Representation;
|
|
24 import org.restlet.representation.StringRepresentation;
|
|
25 import org.restlet.resource.Get;
|
|
26 import org.restlet.resource.Options;
|
|
27 import org.restlet.resource.Post;
|
|
28 import org.restlet.resource.ServerResource;
|
|
29 import org.restlet.security.User;
|
|
30
|
2
|
31 import de.mpiwg.itgroup.annotationManager.Constants.NS;
|
0
|
32 import de.mpiwg.itgroup.annotationManager.Errors.TripleStoreSearchError;
|
|
33 import de.mpiwg.itgroup.annotationManager.Errors.TripleStoreStoreError;
|
|
34 import de.mpiwg.itgroup.annotationManager.RDFHandling.Convert;
|
|
35 import de.mpiwg.itgroup.annotationManager.RDFHandling.Convert.Annotation;
|
|
36 import de.mpiwg.itgroup.annotationManager.RDFHandling.RDFSearcher;
|
|
37 import de.mpiwg.itgroup.nimanager.exceptions.TripleStoreHandlerException;
|
|
38
|
|
39 public class AddAndSearchAnnotations extends ServerResource {
|
|
40
|
|
41 private Logger logger = Logger.getRootLogger();
|
|
42
|
|
43 /**
|
|
44 *
|
|
45 * json hash: username: name des users xpointer: xpointer auf den Ausschnitt
|
|
46 * (incl. der URL des Dokumentes) text: text der annotation annoturl: url
|
|
47 * auf eine Annotation falls extern
|
|
48 *
|
|
49 * @return
|
|
50 */
|
|
51
|
|
52
|
|
53 @Options
|
|
54 public void doOptions(Representation entity) {
|
|
55 Form responseHeaders = (Form) getResponse().getAttributes().get(
|
|
56 "org.restlet.http.headers");
|
|
57 if (responseHeaders == null) {
|
|
58 responseHeaders = new Form();
|
|
59 getResponse().getAttributes().put("org.restlet.http.headers",
|
|
60 responseHeaders);
|
|
61 }
|
|
62 responseHeaders.add("Access-Control-Allow-Origin", "*");
|
|
63 responseHeaders.add("Access-Control-Allow-Methods", "POST,OPTIONS,GET");
|
|
64 responseHeaders.add("Access-Control-Allow-Headers", "X-Requested-With, Content-Type, X-Annotator-Account-Id, X-Annotator-User-Id, X-Annotator-Auth-Token-Valid-Until, X-Annotator-Auth-Token");
|
|
65 responseHeaders.add("Access-Control-Allow-Credentials", "false");
|
|
66 responseHeaders.add("Access-Control-Max-Age", "60");
|
|
67 }
|
|
68
|
2
|
69 @Get("html")
|
|
70 public Representation doGetHTML(Representation entity){
|
|
71
|
|
72 doOptions(entity);
|
|
73 Form form = getRequest().getResourceRef().getQueryAsForm();
|
|
74 String uri = form.getFirstValue("uri");
|
|
75 String user = form.getFirstValue("user");
|
|
76
|
|
77 String limit=form.getFirstValue("limit");
|
|
78 String offset=form.getFirstValue("offset");
|
|
79
|
|
80
|
|
81 //
|
|
82 RDFSearcher searcher = new RDFSearcher("file:///annotations"); //TODO should ge into config file
|
|
83
|
|
84 String retString="<html><body><table>";
|
|
85 String lineFormat="<tr><td>%s</td>" +
|
|
86 "<td><a href=\"%s\">%s</a></td><td>%s</td><td>%s</td><td><a href=\"%s\">%s</a></td><td><a href=\"%s\">%s</a></td></div>";
|
|
87 try {
|
|
88
|
|
89 List<Convert.Annotation> annots=searcher.search(uri,user,limit,offset);
|
|
90
|
|
91 for (Convert.Annotation annot:annots){
|
|
92
|
|
93
|
|
94 RestServer restServer = (RestServer) getApplication();
|
|
95 String userName=restServer.getUserNameFromLdap(annot.creator);
|
|
96 List<String> xpointer = new ArrayList<String>();
|
|
97
|
|
98 if (annot.xpointers==null || annot.xpointers.size()==0)
|
|
99 retString+=String.format(lineFormat, userName,annot.url,annot.url,annot.time,annot.text,annot.xpointer,annot.xpointer,annot.annotationUri,annot.annotationUri);
|
|
100 else {
|
|
101 for(String xpointerString:annot.xpointers){
|
|
102 retString+=String.format(lineFormat, userName,annot.url,annot.url,annot.time,annot.text,xpointerString,xpointerString,annot.annotationUri,annot.annotationUri);
|
|
103
|
|
104 }
|
|
105 }
|
|
106
|
|
107 }
|
|
108 } catch (TripleStoreHandlerException e) {
|
|
109 // TODO Auto-generated catch block
|
|
110 e.printStackTrace();
|
|
111 setStatus(Status.SERVER_ERROR_INTERNAL,"TripleStoreHandler Error");
|
|
112 return null;
|
|
113 } catch (TripleStoreSearchError e) {
|
|
114 // TODO Auto-generated catch block
|
|
115 e.printStackTrace();
|
|
116 setStatus(Status.SERVER_ERROR_INTERNAL,"TripleStoreSearch Error");
|
|
117 return null;
|
|
118 }
|
|
119
|
|
120 retString+="</table></body></html>";
|
|
121
|
|
122 logger.debug("sending:");
|
|
123 logger.debug(retString);
|
|
124 return new StringRepresentation(retString,MediaType.TEXT_HTML);
|
|
125 }
|
|
126
|
|
127
|
0
|
128 @Get("json")
|
2
|
129 public Representation doGetJSON(Representation entity){
|
0
|
130
|
|
131 doOptions(entity);
|
|
132 Form form = getRequest().getResourceRef().getQueryAsForm();
|
|
133 String uri = form.getFirstValue("uri");
|
|
134 String user = form.getFirstValue("user");
|
|
135
|
|
136 String limit=form.getFirstValue("limit");
|
|
137 String offset=form.getFirstValue("offset");
|
|
138
|
|
139
|
|
140 //
|
|
141 RDFSearcher searcher = new RDFSearcher("file:///annotations"); //TODO should ge into config file
|
|
142
|
|
143 JSONArray ja;
|
|
144 try {
|
|
145
|
|
146 List<Convert.Annotation> annots=searcher.search(uri,user,limit,offset);
|
|
147
|
|
148 ja = new JSONArray();
|
|
149 for (Convert.Annotation annot:annots){
|
|
150 JSONObject jo = new JSONObject();
|
|
151 jo.put("text", annot.text);
|
|
152 jo.put("uri",annot.url);
|
|
153
|
|
154 JSONObject userObject= new JSONObject();
|
|
155 userObject.put("id",annot.creator);
|
|
156
|
|
157 RestServer restServer = (RestServer) getApplication();
|
2
|
158
|
|
159 String userID= annot.creator;
|
|
160 if (userID.startsWith(NS.MPIWG_PERSONS)){
|
|
161 userID=userID.replace(NS.MPIWG_PERSONS, ""); //entferne NAMESPACE
|
|
162 }
|
|
163 String userName=restServer.getUserNameFromLdap(userID);
|
0
|
164 userObject.put("name",userName);
|
|
165
|
|
166 jo.put("user",userObject);
|
|
167
|
|
168 List<String> xpointer = new ArrayList<String>();
|
|
169
|
|
170 if (annot.xpointers==null || annot.xpointers.size()==0)
|
|
171 xpointer.add(annot.xpointer);
|
|
172 else {
|
|
173 for(String xpointerString:annot.xpointers){
|
|
174 xpointer.add(xpointerString);
|
|
175 }
|
|
176 }
|
|
177 jo.put("ranges", transformToRanges(xpointer));
|
|
178 ja.put(jo);
|
|
179 }
|
|
180 } catch (TripleStoreHandlerException e) {
|
|
181 // TODO Auto-generated catch block
|
|
182 e.printStackTrace();
|
|
183 setStatus(Status.SERVER_ERROR_INTERNAL,"TripleStoreHandler Error");
|
|
184 return null;
|
|
185 } catch (TripleStoreSearchError e) {
|
|
186 // TODO Auto-generated catch block
|
|
187 e.printStackTrace();
|
|
188 setStatus(Status.SERVER_ERROR_INTERNAL,"TripleStoreSearch Error");
|
|
189 return null;
|
|
190 } catch (JSONException e) {
|
|
191 // TODO Auto-generated catch block
|
|
192 e.printStackTrace();
|
|
193 setStatus(Status.SERVER_ERROR_INTERNAL,"JSon Error");
|
|
194 return null;
|
|
195 }
|
|
196
|
|
197 JSONObject retObject = new JSONObject();
|
|
198 try {
|
|
199 retObject.put("rows",ja);
|
|
200 retObject.put("total",ja.length());
|
|
201 } catch (JSONException e) {
|
|
202 // TODO Auto-generated catch block
|
|
203 e.printStackTrace();
|
|
204 setStatus(Status.SERVER_ERROR_INTERNAL,"JSon Error");
|
|
205 return null;
|
|
206 }
|
|
207
|
|
208 logger.debug("sending:");
|
|
209 logger.debug(retObject);
|
|
210 return new JsonRepresentation(retObject);
|
|
211 }
|
|
212
|
|
213 private JSONArray transformToRanges(List<String> xpointers) {
|
|
214
|
|
215 JSONArray ja = new JSONArray();
|
|
216
|
|
217 Pattern rg = Pattern.compile("#xpointer\\(start-point\\(string-range\\(\"([^\"]*)\",([^,]*),1\\)\\)/range-to\\(end-point\\(string-range\\(\"([^\"]*)\",([^,]*),1\\)\\)\\)\\)");
|
|
218 Pattern rg1 = Pattern.compile("#xpointer\\(start-point\\(string-range\\(\"([^\"]*)\",([^,]*),1\\)\\)\\)");
|
|
219
|
|
220
|
|
221
|
|
222 try {
|
|
223 for(String xpointer:xpointers){
|
|
224 String decoded =URLDecoder.decode(xpointer,"utf-8");
|
|
225 Matcher m=rg.matcher(decoded);
|
1
|
226
|
|
227 if (m.find()){
|
0
|
228 {
|
|
229 JSONObject jo = new JSONObject();
|
|
230 jo.put("start", m.group(1));
|
|
231 jo.put("startOffset", m.group(2));
|
|
232 jo.put("end", m.group(3));
|
|
233 jo.put("endOffset", m.group(4));
|
|
234 ja.put(jo);
|
1
|
235 }
|
0
|
236 }
|
|
237 m=rg1.matcher(xpointer);
|
1
|
238 if (m.find()){
|
0
|
239 JSONObject jo = new JSONObject();
|
|
240 jo.put("start", m.group(1));
|
|
241 jo.put("startOffset", m.group(2));
|
|
242
|
|
243 ja.put(jo);
|
|
244 }
|
|
245
|
|
246
|
|
247 }
|
|
248 } catch (JSONException e) {
|
|
249 // TODO Auto-generated catch block
|
|
250 e.printStackTrace();
|
|
251 } catch (UnsupportedEncodingException e) {
|
|
252 // TODO Auto-generated catch block
|
|
253 e.printStackTrace();
|
|
254 }
|
|
255
|
|
256
|
|
257 return ja;
|
|
258
|
|
259
|
|
260
|
|
261
|
|
262
|
|
263 }
|
|
264
|
|
265 @Post("json")
|
|
266 public Representation doPostJson(Representation entity) {
|
|
267
|
|
268 String retVal = doPost(entity);
|
|
269 JSONObject jo;
|
|
270 try {
|
|
271 jo = new JSONObject("{\"annotUrl\":\"" + retVal + "\"}");
|
|
272 } catch (JSONException e) {
|
|
273 setStatus(Status.SERVER_ERROR_INTERNAL);
|
|
274 return null;
|
|
275 }
|
|
276 JsonRepresentation retRep = new JsonRepresentation(jo);
|
|
277 return retRep;
|
|
278 }
|
|
279
|
|
280 @Post("html")
|
|
281 public Representation doPostHtml(Representation entity) {
|
|
282 String retVal = doPost(entity);
|
|
283 if (retVal == null) {
|
|
284 return null;
|
|
285 }
|
|
286 String text = String.format(
|
|
287 "<html><body><a href=\"%s\">%s</a></body></html>", retVal
|
|
288 .replace(">", "").replace("<", ""),
|
|
289 retVal.replace(">", ">").replace("<", "<"));
|
|
290 Representation retRep = new StringRepresentation(text,
|
|
291 MediaType.TEXT_HTML);
|
|
292 return retRep;
|
|
293 }
|
|
294
|
|
295 public String doPost(Representation entity) {
|
|
296 Convert.Annotation annot;
|
|
297 // versuche basic authentifizierung und hole den Benutzer von dort.
|
|
298
|
|
299 // User authUser;= handleBasicAuthentification(entity);
|
|
300
|
|
301 if (entity.getMediaType().equals(MediaType.APPLICATION_JSON)) {
|
|
302
|
|
303 JsonRepresentation jrep;
|
|
304 try {
|
|
305 jrep = new JsonRepresentation(entity);
|
|
306 } catch (IOException e1) {
|
|
307 setStatus(Status.SERVER_ERROR_INTERNAL);
|
|
308 return null;
|
|
309 }
|
|
310
|
|
311 // try {
|
|
312 // logger.debug(jrep.getText());
|
|
313 // } catch (IOException e1) {
|
|
314 // // TODO Auto-generated catch block
|
|
315 // e1.printStackTrace();
|
|
316 // }
|
|
317 //
|
|
318
|
|
319 try {
|
|
320 JSONObject jo = jrep.getJsonObject();
|
|
321 String mode = jo.getString("mode"); // hole modus
|
|
322 if (mode==null || mode.equals(""))
|
|
323 mode="annotea"; // default mode (annotea) TODO make this configurable
|
|
324
|
|
325 if (mode.equals("annotator") ) { // annotator format
|
|
326 annot = handleAnnotatorSchema(jo, entity);
|
|
327 logger.debug("storing annotator object");
|
|
328 logger.debug(jo);
|
|
329 } else if (mode.equals("annotea")){
|
|
330 annot = handleAnnotea(jo, entity);
|
|
331 } else {
|
|
332 setStatus(Status.CLIENT_ERROR_BAD_REQUEST,"mode "+mode+"not supported!");
|
|
333 return null;
|
|
334 }
|
|
335
|
|
336 } catch (JSONException e) {
|
|
337 setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
|
|
338 return null;
|
|
339 }
|
|
340
|
|
341 } else if (entity.getMediaType().equals(MediaType.APPLICATION_WWW_FORM)) {
|
|
342 annot = handleForm(entity);
|
|
343
|
|
344 } else {
|
|
345 setStatus(Status.CLIENT_ERROR_UNSUPPORTED_MEDIA_TYPE);
|
|
346
|
|
347 return null;
|
|
348 }
|
|
349
|
|
350 if (annot==null){
|
|
351 return null;
|
|
352 }
|
|
353 if (annot.xpointer == null || annot.creator == null) {
|
|
354 setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
|
|
355
|
|
356 return null;
|
|
357 }
|
|
358
|
|
359
|
|
360
|
|
361 try {
|
|
362 return new Convert("file:///annotations").storeAnnotation(annot);
|
|
363 } catch (TripleStoreStoreError e) {
|
|
364 e.printStackTrace();
|
|
365 setStatus(Status.SERVER_ERROR_INTERNAL, "TripleStore Error");
|
|
366 return null;
|
|
367 }
|
|
368 }
|
|
369
|
2
|
370
|
|
371 /**
|
|
372 *
|
|
373 * @param entity should contain a form with the parameters "username", "password", "xpointer","text","uri","type"
|
|
374 *
|
|
375 * username,password is optional, if not given BasicAuthentification is used.
|
|
376 *
|
|
377 *
|
|
378 *
|
|
379 * If username given as a URI, the username will be transformed to an URI, username will be added to the MPIWG namespace defined in de.mpiwg.itgroup.annotationManager.Constants.NS
|
|
380 *
|
|
381 * @return
|
|
382 */
|
0
|
383 protected Convert.Annotation handleForm(Representation entity) {
|
|
384 Convert.Annotation annot;
|
|
385 Form form = new Form(entity);
|
|
386 String username = form.getValues("username");
|
|
387 String password = form.getValues("password");
|
|
388 String xpointer = form.getValues("xpointer");
|
|
389 String text = form.getValues("text");
|
|
390 String url = form.getValues("url");
|
|
391 String type = form.getValues("type");
|
|
392 RestServer restServer = (RestServer) getApplication();
|
|
393
|
|
394 // falls user and password nicht null sind:
|
|
395 User userFromForm = null;
|
|
396 if (username != null && password != null) {
|
|
397 if (restServer.authenticate(username, password, getRequest())) {
|
|
398 userFromForm = new User(username);
|
|
399 }
|
|
400 }
|
|
401 User authUser = null;
|
|
402
|
|
403 if (userFromForm == null) {
|
|
404 authUser = handleBasicAuthentification(entity);
|
|
405 }
|
|
406
|
|
407 // weder BasicAuth noch FormAuth
|
|
408 if (authUser == null && userFromForm == null) {
|
|
409 setStatus(Status.CLIENT_ERROR_FORBIDDEN);
|
|
410 return null;
|
|
411 }
|
|
412
|
|
413 if (userFromForm != null) {
|
|
414 username = userFromForm.getIdentifier();
|
|
415 } else {
|
|
416 username = authUser.getIdentifier();
|
|
417 }
|
|
418
|
2
|
419 //username should be a URI, if not it will set to the MPIWG namespace defined in de.mpiwg.itgroup.annotationManager.Constants.NS
|
|
420 if (!username.startsWith("http"))
|
|
421 username=NS.MPIWG_PERSONS+username;
|
|
422
|
0
|
423 annot = new Convert.Annotation(xpointer, username, null, text,
|
|
424 type, url);
|
|
425 return annot;
|
|
426 }
|
|
427
|
|
428 @Post
|
|
429 public Representation doPostHtml2(Representation entity) {
|
|
430 return doPostHtml(entity);
|
|
431 }
|
|
432
|
|
433 private User handleBasicAuthentification(Representation entity) {
|
|
434 RestServer restServer = (RestServer) getApplication();
|
|
435 if (!restServer.authenticate(getRequest(), getResponse())) {
|
|
436 // Not authenticated
|
|
437 return null;
|
|
438 }
|
|
439
|
|
440 ClientInfo ci = getRequest().getClientInfo();
|
|
441 logger.debug(ci);
|
|
442 return getRequest().getClientInfo().getUser();
|
|
443
|
|
444 }
|
|
445
|
|
446 /**
|
|
447 * using a minimal annotation format based on the annotea specification
|
|
448 *
|
|
449 * @param jo
|
|
450 * must contain xpointer, text,url,type and can contain a
|
|
451 * username, if not the username form the authentification will
|
|
452 * be used.
|
|
453 * @param authUser
|
|
454 * user object
|
2
|
455 * The username will be transformed to an URI if not given already as URI, if not it will set to the MPIWG namespace defined in de.mpiwg.itgroup.annotationManager.Constants.NS
|
|
456
|
0
|
457 * @return
|
|
458 * @throws JSONException
|
|
459 */
|
|
460 public Annotation handleAnnotea(JSONObject jo, Representation entity)
|
|
461 throws JSONException {
|
|
462
|
|
463 User authUser = handleBasicAuthentification(entity);
|
|
464 String username = jo.getString("username"); // not required, if no
|
|
465 // username given authuser
|
|
466 // will be used.
|
|
467 String xpointer = jo.getString("xpointer");
|
|
468 String text = null;
|
|
469 if (jo.has("text"))
|
|
470 text = jo.getString("text");
|
|
471
|
|
472 String url = null;
|
|
473 if (jo.has("url"))
|
|
474 url = jo.getString("url");
|
|
475
|
|
476 String type = null;
|
|
477 if (jo.has("type"))
|
|
478 type = jo.getString("type");
|
|
479
|
|
480 if (username == null)
|
|
481 username = authUser.getIdentifier();
|
|
482
|
2
|
483 //username should be a URI, if not it will set to the MPIWG namespace defined in de.mpiwg.itgroup.annotationManager.Constants.NS
|
|
484 if (!username.startsWith("http"))
|
|
485 username=NS.MPIWG_PERSONS+username;
|
|
486
|
0
|
487 return new Convert.Annotation(xpointer, username, null, text, type, url);
|
|
488 }
|
|
489
|
|
490 /**
|
|
491 * uses the specification from the annotator project.
|
|
492 *
|
|
493 * @see{https://github.com/okfn/annotator/wiki/Annotation-format The user
|
|
494 * object must
|
|
495 * contain an
|
|
496 * id and
|
|
497 * password or
|
|
498 * basic
|
|
499 * authentification
|
|
500 * is used.
|
2
|
501 * The username will be transformed to an URI if not given already as URI, if not it will set to the MPIWG namespace defined in de.mpiwg.itgroup.annotationManager.Constants.NS
|
0
|
502 * @param jo
|
|
503 * @param authUser
|
|
504 * @return
|
|
505 * @throws JSONException
|
|
506 */
|
|
507 public Convert.Annotation handleAnnotatorSchema(JSONObject jo,
|
|
508 Representation entity) throws JSONException {
|
|
509 Convert.Annotation annot;
|
|
510 String url = jo.getString("uri");
|
|
511 String text = jo.getString("text");
|
|
512
|
|
513 String username = null;
|
|
514 if (jo.has("user")) { // not required, if no username given authuser
|
|
515 // will be used otherwise username and password
|
|
516 // has to be submitted
|
|
517 JSONObject user = jo.getJSONObject("user");
|
|
518 if (user.has("id")) {
|
|
519 username = user.getString("id");
|
|
520 if(!user.has("password")){
|
|
521 User authUser = handleBasicAuthentification(entity);
|
|
522 if (authUser==null){
|
|
523 setStatus(Status.CLIENT_ERROR_FORBIDDEN);
|
|
524 return null;
|
|
525 }
|
|
526 username = authUser.getIdentifier();
|
|
527 } else {
|
|
528 String password = user.getString("password");
|
|
529 if (!((RestServer) getApplication()).authenticate(username,
|
|
530 password, getRequest())) {
|
|
531 setStatus(Status.CLIENT_ERROR_FORBIDDEN);
|
|
532 return null;
|
|
533 }
|
|
534 }
|
|
535 }
|
|
536
|
|
537 } else {
|
|
538 User authUser = handleBasicAuthentification(entity);
|
|
539 if (authUser == null) {
|
|
540 setStatus(Status.CLIENT_ERROR_FORBIDDEN);
|
|
541 return null;
|
|
542 }
|
|
543 username = authUser.getIdentifier();
|
|
544 }
|
|
545
|
|
546 String xpointer;
|
|
547 if (jo.has("ranges")) {
|
|
548 JSONObject ranges = jo.getJSONArray("ranges").getJSONObject(0);
|
|
549 String start = ranges.getString("start");
|
|
550 String end = ranges.getString("end");
|
|
551 String startOffset = ranges.getString("startOffset");
|
|
552 String endOffset = ranges.getString("endOffset");
|
|
553
|
|
554 try {
|
|
555 xpointer = url+"#"+
|
|
556 URLEncoder.encode(String.format(
|
|
557 "xpointer(start-point(string-range(\"%s\",%s,1))/range-to(end-point(string-range(\"%s\",%s,1))))",
|
|
558 start, startOffset, end, endOffset),"utf-8");
|
|
559 } catch (UnsupportedEncodingException e) {
|
|
560 e.printStackTrace();
|
|
561 setStatus(Status.SERVER_ERROR_INTERNAL);
|
|
562 return null;
|
|
563 }
|
|
564 } else {
|
|
565 xpointer = url;
|
|
566 }
|
2
|
567
|
|
568 //username should be a URI, if not it will set to the MPIWG namespace defined in de.mpiwg.itgroup.annotationManager.Constants.NS
|
|
569 if (!username.startsWith("http"))
|
|
570 username=NS.MPIWG_PERSONS+username;
|
|
571
|
0
|
572 return new Convert.Annotation(xpointer, username, null, text, null);
|
|
573 }
|
|
574
|
|
575 }
|