gdp-entrypoint.sh 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/sh
  2. # todo: run some checks
  3. id
  4. echo "Creating GDP BaseX db"
  5. basex "db:create('gdp','/srv/basex/src/gdp.tei.xml', (),map {'ftindex': true(),'stemming': true(),'casesens': true(),'diacritics': true(),'language': 'fr','updindex': true(),'autooptimize': true(),'maxlen': 96,'maxcats': 100,'splitsize': 0,'chop': false(),'textindex': true(),'attrindex': true(),'tokenindex': true(), 'xinclude': true()})"
  6. # , 'serializer': 'indent=no'
  7. echo "Creating FullText Index tmp file"
  8. basex "xslt:transform(fn:doc('/srv/basex/src/gdp.tei.xml'), fn:doc('/srv/basex/src/xslt/generateFullTextIndex.xsl'))" > /tmp/gdpFtIndex.xml
  9. echo "Creating FullText Index DB"
  10. basex "db:create('gdpFtIndex', '/tmp/gdpFtIndex.xml', (),map {'ftindex': true(),'stemming': true(),'casesens': true(),'diacritics': true(),'language': 'fr','updindex': true(),'autooptimize': true(),'maxlen': 96,'maxcats': 100,'splitsize': 0,'chop': false(),'textindex': true(),'attrindex': true(),'tokenindex': true(), 'xinclude': true()})"
  11. # , 'serializer': 'indent=no'
  12. # echo "Creating Advanced Search Index"
  13. # basex -q "import module namespace gdp.models.tei = 'gdp.models.tei' at '/srv/basex/webapp/synopsx/workspace/gdp/models/tei.xqm' ;
  14. # let $index := ('gdpIndexNominum', 'gdpIndexLocorum')
  15. # return gdp.models.tei:addId2IndexedEntities($index)"
  16. # basex "declare namespace tei = 'http://www.tei-c.org/ns/1.0' ;
  17. # let $db := db:open('gdp')
  18. # let $index := $db//tei:TEI[tei:teiHeader//tei:sourceDesc[@xml:id = $indexId]]
  19. # for $occurence in fn:distinct-values($index//tei:listRelation/tei:relation/@passive ! fn:tokenize(., '\s+'))
  20. # let $entries := $index//*[tei:listRelation/tei:relation[fn:contains(@passive, $occurence)]]
  21. # let $element := $db//*[@xml:id = fn:substring-after($occurence, '#')]
  22. # let $values := for $entry in $entries/@xml:id return fn:concat('#', $entry)
  23. # return
  24. # if ($element[fn:not(@ref)])
  25. # then insert node attribute ref { $values } into $element
  26. # else replace value of node $element/@ref with $values"
  27. # as we override the parent container CMD, we have to launch basexhttp here
  28. echo "Launching basexhttp"
  29. basexhttp
  30. # todo never launched, prev command never ends
  31. echo "Launching indexing"
  32. wget -S http://localhost:8984/indexing