Skip to content

Instantly share code, notes, and snippets.

@wsalesky
wsalesky / placeNames.xml
Created Mar 26, 2020
Generated Place names.
View placeNames.xml
<TEI xmlns="http://www.tei-c.org/ns/1.0" xmlns:srophe="https://srophe.app">
<text>
<body>
<listPlace>
<place>
<idno>https://pleiades.stoa.org/places/520998</idno>
<placeName srophe:tags="#headword">Constantinopolis</placeName>
<desc>Capital city of the Eastern Roman Empire, the Latin, and the Ottoman
Empires founded by Constantine I in AD 330. </desc>
<location type="gps">
@wsalesky
wsalesky / git-commit.xqm
Created Oct 19, 2018
eXist-db git commit as a module. Can be used with XForms to pass XML content to GitHub.
View git-commit.xqm
xquery version "3.1";
(:~
: POC: eXist-db module to commit content to github reop via github API
: Code creates a new branch off of the master branch, commits updated content to new branch and then submits a pull request when complete.
: Intended use is for online data submission, using GitHub for review/approval process.
:
: Prerequisites:
: In order to run the module, you will need a github Authorization token.
: When you create authorization token your OAuth Scope will need to include the github repository you would like to commit to.
@wsalesky
wsalesky / git-commit.xql
Created Oct 12, 2018
XQuery to commit content to GitHub. Query creates a new branch, commits content and creates a new pull request to specified repository.
View git-commit.xql
xquery version "3.1";
(:~
: POC: XQuery to commit content to github reop via github API. Tested in eXist-db v4.4.0
: Code creates a new branch off of the master branch, commits updated content to the new branch
: and then submits a pull request when complete. Intended use is for online data submission,
: using GitHub for review/approval process.
:
: Prerequisites:
: In order to run the module, you will need a github Authorization token.
@wsalesky
wsalesky / facets.rq
Created Jun 15, 2018
POC of facets used on SPEAR data Syriaca.org. This is a work in progress.
View facets.rq
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix cwrc: <http://sparql.cwrc.ca/ontologies/cwrc#>
prefix dcterms: <http://purl.org/dc/terms/>
prefix lawd: <http://lawd.info/ontology/>
prefix person: <https://www.w3.org/ns/person>
prefix skos: <http://www.w3.org/2004/02/skos/core#>
prefix snap: <http://data.snapdrgn.net/ontology/snap#>
prefix syriaca: <http://syriaca.org/schema#>
View spear-source.rq
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix lawd: <http://lawd.info/ontology/>
prefix skos: <http://www.w3.org/2004/02/skos/core#>
prefix dcterms: <http://purl.org/dc/terms/>
SELECT ?source ( count(?source) as ?sourceCount )
WHERE {
?s dcterms:source ?source;
dcterms:isPartOf <http://syriaca.org/spear>.
@wsalesky
wsalesky / realtions-citations.rq
Last active May 8, 2018
SPARQL query to get citations and related subjects for Syriaca.org data
View realtions-citations.rq
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix lawd: <http://lawd.info/ontology/>
prefix skos: <http://www.w3.org/2004/02/skos/core#>
prefix dcterms: <http://purl.org/dc/terms/>
SELECT ?uri (SAMPLE(?l) AS ?label) (SAMPLE(?uriSubject) AS ?subjects) (SAMPLE(?uriCitations) AS ?citations)
{
?uri rdfs:label ?l
FILTER (?uri IN ( <http://syriaca.org/person/782>,<http://syriaca.org/person/552>,<http://syriaca.org/person/684>,<http://syriaca.org/person/492>)).
FILTER ( langMatches(lang(?l), 'en')).
@wsalesky
wsalesky / git-sync-v2.xql
Created Nov 30, 2017
Update git-sync XQuery to use eXistdb's native JSON parser.
View git-sync-v2.xql
xquery version "3.1";
(:~
: Webhook endpoint for tcadrt.com data repository, /master/ branch:
: XQuery endpoint to respond to Github webhook requests. Query responds only to push requests from the master branch.

: The EXPath Crypto library supplies the HMAC-SHA1 algorithm for matching Github secret. 

:
: Secret can be stored as environmental variable.
: Will need to be run with administrative privileges, suggest creating a git user with privileges only to relevant app.
:
View NoDiacriticsStandardAnalyzer.java
/*
* eXist Open Source Native XML Database
* Copyright (C) 2001-2015 The eXist Project
* http://exist-db.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
@wsalesky
wsalesky / strip-diacritics.xq
Last active Oct 4, 2017 — forked from joewiz/strip-diacritics.xq
Strip diacritics, with XQuery
View strip-diacritics.xq
xquery version "3.1";
declare function local:strip-diacritics($string as xs:string) as xs:string {
let $normalized := normalize-unicode($string, 'NFD')
let $stripped := replace($normalized, '\p{M}', '')
return
$stripped
};
declare function local:inspect-diacritics($string as xs:string) as element() {
@wsalesky
wsalesky / facets.xqm
Last active Sep 20, 2016
Partial facet implementation for eXist-db based on the EXPath specifications (http://expath.org/spec/facet)
View facets.xqm
xquery version "3.0";
(:~
: Partial facet implementation for eXist-db based on the EXPath specifications (http://expath.org/spec/facet)
:
: Uses the following eXist-db specific functions:
: util:eval
: request:get-parameter
: request:get-parameter-names()
:
: @author Winona Salesky