This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
START a=node(1) // "Doctor" | |
MATCH (a)-[:ALLY_OF]->(b)-[:ENEMY_OF]->(a) | |
RETURN a,b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(: Signature of the fold function changed :) | |
xquery version "3.1"; | |
(: Implements the Luhn Algorithm (http://en.wikipedia.org/wiki/Luhn_algorithm) in XQuery :) | |
declare function local:check-luhn($num as xs:integer) as xs:boolean | |
{ | |
let $seq := fn:reverse(local:number-to-seq(($num))) | |
let $even-seq := $seq[position() mod 2 = 0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "3.0"; | |
(: Look ups records at the Library of Congress in the specified metadata format :) | |
declare namespace mods = "http://www.loc.gov/mods/v3"; | |
declare namespace dc = "http://purl.org/dc/elements/1.1/"; | |
declare namespace marcxml = "http://www.loc.gov/MARC21/slim"; | |
declare namespace zs = "http://www.loc.gov/zing/srw/"; | |
(: change the lccn for different items :) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "3.0"; | |
(: Fizz Buzz in XQuery :) | |
for $i in (1 to 30) | |
return | |
if ($i mod 3 = 0 and $i mod 5 = 0) then "fizzbuzz" | |
else if ($i mod 3 = 0) then "fizz" | |
else if ($i mod 5 = 0) then "buzz" | |
else $i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "3.0"; | |
(: Look ups records at the Archives Hub (http://archiveshub.ac.uk/) in the specified metadata format :) | |
declare namespace sru = "http://www.loc.gov/zing/srw/"; | |
(: change keyword for different documents :) | |
let $keyword := "castle" | |
(: change the requested format for different kinds of metadata - "ead", "srw_dc", or "oai_dc":) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "3.0"; | |
(: Squares all odd numbers | |
and returns in reverse sequence :) | |
for $i in 1 to 10 | |
let $n := $i * $i | |
where $i mod 2 != 0 | |
order by $n descending | |
return $n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(: Extracts entities from web-accessible texts using the Alchemy api :) | |
let $entities := | |
http:send-request( | |
<http:request method='post' href='http://access.alchemyapi.com/calls/url/URLGetRankedNamedEntities'> | |
<http:body media-type='application/x-www-form-urlencoded' method='text'>apikey=[Your Key Here]&url=https%3A%2F%2Fraw.github.com%2Fiulibdcs%2Ftei_text%2Fmaster%2Fvwwp_text%2FVAB7013.txt</http:body> | |
</http:request> | |
)/results/entities | |
for $entity in $entities/entity | |
where $entity//geo | |
return $entity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(: Extracts entities from web-accessible texts using the Alchemy api :) | |
(: Serializes Disambiguated Entities to CSV :) | |
xquery version "3.0"; | |
declare namespace csv = "http://basex.org/modules/csv"; | |
let $apiKey := [Your Key Here] | |
let $url := "https://raw.github.com/iulibdcs/tei_text/master/vwwp_text/VAB7013.txt" | |
let $csv := | |
<csv>{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http post http://access.alchemyapi.com/calls/url/URLGetRankedNamedEntities apikey=[Your Key Here] url='https://raw.github.com/iulibdcs/tei_text/master/vwwp_text/VAB7017.txt' --form |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(: Extracts entities from web-accessible texts using the Alchemy api :) | |
(: Serializes Disambiguated Entities to GeoJSON :) | |
xquery version "3.0"; | |
declare namespace csv = "http://basex.org/modules/json"; | |
let $api-key := [Your API Key] | |
let $url:= "https%3A%2F%2Fraw.github.com%2Fiulibdcs%2Ftei_text%2Fmaster%2Fvwwp_text%2FVAB7013.txt" | |
let $csv := | |
<json type="object"> |
OlderNewer