Skip to content

Instantly share code, notes, and snippets.

🎠
black pony

Mathias mathias-goebel

🎠
black pony
Block or report user

Report or block mathias-goebel

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mathias-goebel
mathias-goebel / convert.xq
Created Dec 10, 2018
eXist-db http client with easyrdf converter
View convert.xq
xquery version "3.1";
let $content :=
<httpclient:fields>
<httpclient:field name="data" value="" type="string"/>
<httpclient:field name="in" value="guess" type="string"/>
<httpclient:field name="out" value="rdfxml" type="string"/>
<httpclient:field name="raw" value="1" type="string"/>
<httpclient:field name="uri" value="http://njh.me/" type="string"/>
</httpclient:fields>
View wikidata.xq
xquery version "3.1";
import module namespace functx="http://www.functx.com";
declare namespace tei="http://www.tei-c.org/ns/1.0";
let $path := "......../dlina/GerDraCor and Wikidata.csv"
let $rows :=
(file:read-binary($path)
=> util:binary-to-string()
=> tokenize("\n"))[position() gt 1]
View wikidata.xq
xquery version "3.1";
import module namespace functx="http://www.functx.com";
declare namespace tei="http://www.tei-c.org/ns/1.0";
let $path := "......../dlina/GerDraCor and Wikidata.csv"
let $rows :=
(file:read-binary($path)
=> util:binary-to-string()
=> tokenize("\n"))[position() gt 1]
@mathias-goebel
mathias-goebel / convert.xq
Created Dec 12, 2017
TCF to sentence in plain text
View convert.xq
xquery version "3.1";
declare namespace dta="http://www.dspin.de/data/textcorpus";
declare function local:load-dta($source, $target) {
let $collection-uri := $target,
$directory := $source,
$pattern := "**/*",
$mime-type := "application/xml",
$preserve-structure := true()
@mathias-goebel
mathias-goebel / restore.xq
Last active Oct 20, 2017
eXist-db restoring from XQuery
View restore.xq
xquery version "3.1";
declare function local:do($path-external as xs:string, $path-internal as xs:string) {
let $list := file:list( $path-external )
return (
for $dir in $list/file:directory
let $name := replace(string( $dir/@name ), "\s", "_")
return(
@mathias-goebel
mathias-goebel / TextGrid-CRUD.xq
Created Oct 7, 2016
Store nodes in the TextGrid Repository
View TextGrid-CRUD.xq
xquery version "3.0";
declare namespace tei="http://www.tei-c.org/ns/1.0";
(: TextGrid CRUD
: Store nodes in the TextGrid Repository
: https://textgridlab.org/doc/services/submodules/tg-crud/docs/index.html#create
: :)
(: ESX-2 = productive :)
@mathias-goebel
mathias-goebel / query.xq
Created May 30, 2016
TextGrid Agg Names
View query.xq
xquery version "3.0";
declare namespace ore="http://www.openarchives.org/ore/terms/";
declare namespace rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
declare namespace tgmd="http://textgrid.info/namespaces/metadata/core/2010";
let $seq:= ("textgrid:jfsm.0",
"textgrid:jg0m.0",
"textgrid:jk7p.0",
"textgrid:jkhw.0",
@mathias-goebel
mathias-goebel / lb-handling.xquery
Created May 18, 2016
TEI:lb and other empty elements in XQuery
View lb-handling.xquery
xquery version "3.0";
declare namespace tei="http://www.tei-c.org/ns/1.0";
declare function local:magic($nodes as node()*) {
(:let $test:= console:log($nodes/local-name()):)
(:return:)
for $node in $nodes return
typeswitch($node)
case element(*)
@mathias-goebel
mathias-goebel / TEI-JSON.xq
Created Mar 8, 2016
sunburst tree for TEI data
View TEI-JSON.xq
xquery version "3.0";
declare namespace tei="http://www.tei-c.org/ns/1.0";
declare option exist:serialize "method=text media-type=text/plain omit-xml-declaration=yes";
declare function local:recurse($node as node()*) as xs:string* {
for $n in $node
return(
'{' ||
string-join(
('"name": "', $n/local-name(), '"',
if( not($n/*) )
View MainArtists.xq
xquery version "3.0";
let $url := xs:anyURI('https://www.conftool.pro/dhd2016/sessions.php'),
$persist:= false(),
$request-headers := (),
$node as node() := httpclient:get($url, $persist, $request-headers)//httpclient:body/*,
$origList := tokenize(
string-join(
$node//*[contains(@class, 'paper_author')]/
You can’t perform that action at this time.