gdp-entrypoint.sh 2.2 KB

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