diff software/eXist/webapp/mpdl/interface/queryResult.xql @ 11:d6f528ad5d96

TEI Unterst?tzung, Fehlerbehebungen, externe Objekte
author Josef Willenborg <jwillenborg@mpiwg-berlin.mpg.de>
date Fri, 11 Mar 2011 13:34:02 +0100
parents 5589d865af7a
children
line wrap: on
line diff
--- a/software/eXist/webapp/mpdl/interface/queryResult.xql	Fri Mar 11 13:33:26 2011 +0100
+++ b/software/eXist/webapp/mpdl/interface/queryResult.xql	Fri Mar 11 13:34:02 2011 +0100
@@ -6,11 +6,12 @@
 declare namespace request="http://exist-db.org/xquery/request";
 
 declare namespace echo="http://www.mpiwg-berlin.mpg.de/ns/echo/1.0/";
+declare namespace TEI="http://www.tei-c.org/ns/1.0";
+
 declare namespace dc="http://purl.org/dc/elements/1.1/";
 declare namespace dct="http://purl.org/dc/terms/1.0/";
 declare namespace rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
 
-
 let $queryType := request:get-parameter("queryType", "")
 let $docbase := request:get-parameter("docbase", "")
 let $output := request:get-parameter("output", "html")
@@ -41,29 +42,51 @@
 
 let $docBaseArch := "archimedes"
 let $docBaseEcho := "echo"
+let $docBaseTei := "tei"
 let $fulltextMorphArchDocPath := concat($docPathMorph, "/", $docBaseArch, "/", $language)
 let $fulltextMorphEchoDocPath := concat($docPathMorph, "/", $docBaseEcho, "/", $language)
+let $fulltextMorphTeiDocPath := concat($docPathMorph, "/", $docBaseTei, "/", $language)
 let $fulltextMorphCollection := 
-  if(contains($docbase, $docBaseArch) and contains($docbase, $docBaseEcho))
+  if(contains($docbase, $docBaseArch) and contains($docbase, $docBaseEcho) and contains($docbase, $docBaseTei))
+  then collection($fulltextMorphArchDocPath, $fulltextMorphEchoDocPath, $fulltextMorphTeiDocPath)
+  else if(contains($docbase, $docBaseArch) and contains($docbase, $docBaseEcho) and not(contains($docbase, $docBaseTei)))
   then collection($fulltextMorphArchDocPath, $fulltextMorphEchoDocPath)
-  else if(contains($docbase, $docBaseArch) and not(contains($docbase, $docBaseEcho)))
+  else if(contains($docbase, $docBaseArch) and not(contains($docbase, $docBaseEcho)) and contains($docbase, $docBaseTei))
+  then collection($fulltextMorphArchDocPath, $fulltextMorphTeiDocPath)
+  else if(not(contains($docbase, $docBaseArch)) and contains($docbase, $docBaseEcho) and contains($docbase, $docBaseTei))
+  then collection($fulltextMorphEchoDocPath, $fulltextMorphTeiDocPath)
+  else if(contains($docbase, $docBaseArch) and not(contains($docbase, $docBaseEcho)) and not(contains($docbase, $docBaseTei)))
   then collection($fulltextMorphArchDocPath)
-  else if(not(contains($docbase, $docBaseArch)) and contains($docbase, $docBaseEcho))
+  else if(not(contains($docbase, $docBaseArch)) and contains($docbase, $docBaseEcho) and not(contains($docbase, $docBaseTei)))
   then collection($fulltextMorphEchoDocPath)
+  else if(not(contains($docbase, $docBaseArch)) and not(contains($docbase, $docBaseEcho)) and contains($docbase, $docBaseTei))
+  then collection($fulltextMorphTeiDocPath)
   else ()
 
 let $fulltextStandardArchDocPath := concat($docPathStandard, "/", $docBaseArch)
 let $fulltextStandardEchoDocPath := concat($docPathStandard, "/", $docBaseEcho)
+let $fulltextStandardTeiDocPath := concat($docPathStandard, "/", $docBaseTei)
 let $fulltextStandardCollectionStr := 
-  if(contains($docbase, $docBaseArch) and contains($docbase, $docBaseEcho))
+  if(contains($docbase, $docBaseArch) and contains($docbase, $docBaseEcho) and contains($docbase, $docBaseTei))
+  then concat("collection('", $fulltextStandardArchDocPath, "', '", $fulltextStandardEchoDocPath, "', '", $fulltextStandardTeiDocPath, "')")
+  else if(contains($docbase, $docBaseArch) and contains($docbase, $docBaseEcho) and not(contains($docbase, $docBaseTei)))
   then concat("collection('", $fulltextStandardArchDocPath, "', '", $fulltextStandardEchoDocPath, "')")
-  else if(contains($docbase, $docBaseArch) and not(contains($docbase, $docBaseEcho)))
+  else if(contains($docbase, $docBaseArch) and not(contains($docbase, $docBaseEcho)) and contains($docbase, $docBaseTei))
+  then concat("collection('", $fulltextStandardArchDocPath, "', '", $fulltextStandardTeiDocPath, "')")
+  else if(not(contains($docbase, $docBaseArch)) and contains($docbase, $docBaseEcho) and contains($docbase, $docBaseTei))
+  then concat("collection('", $fulltextStandardEchoDocPath, "', '", $fulltextStandardTeiDocPath, "')")
+  else if(contains($docbase, $docBaseArch) and not(contains($docbase, $docBaseEcho)) and not(contains($docbase, $docBaseTei)))
   then concat("collection('", $fulltextStandardArchDocPath, "')")
-  else if(not(contains($docbase, $docBaseArch)) and contains($docbase, $docBaseEcho))
+  else if(not(contains($docbase, $docBaseArch)) and contains($docbase, $docBaseEcho) and not(contains($docbase, $docBaseTei)))
   then concat("collection('", $fulltextStandardEchoDocPath, "')")
+  else if(not(contains($docbase, $docBaseArch)) and not(contains($docbase, $docBaseEcho)) and contains($docbase, $docBaseTei))
+  then concat("collection('", $fulltextStandardTeiDocPath, "')")
+  else ""
+let $metadataStr := concat("(", $fulltextStandardCollectionStr, "/archimedes/info", "|" , $fulltextStandardCollectionStr, "/echo:echo/echo:metadata", "|" , $fulltextStandardCollectionStr, "/TEI:TEI/TEI:teiHeader", ")")
+let $fulltextStandardCollection := 
+  if($fulltextStandardCollectionStr != "")
+  then util:eval($fulltextStandardCollectionStr)
   else ()
-let $metadataStr := concat("(", $fulltextStandardCollectionStr, "/archimedes/info", "|" , $fulltextStandardCollectionStr, "/echo:echo/echo:metadata", ")")
-let $fulltextStandardCollection := util:eval($fulltextStandardCollectionStr)
 
 let $isAttributeSearch :=
   if ($queryType = "attribute")