View perle-hop.json
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
{ | |
"hop": { | |
"type": "Perle (DE)", | |
"uri": "/hop/perle-de.json", | |
"use": "boil", | |
"time": { | |
"units": "min", | |
"amount": 60 | |
}, | |
"aau": 4.5 |
View bitemp-query.xquery
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
cts:search(fn:doc(), cts:and-query(( | |
cts:period-range-query( | |
"valid", | |
"ALN_CONTAINED_BY", | |
cts:period(xs:dateTime("2015-01-09T00:00:00"), | |
xs:dateTime("2015-01-11T23:59:59.99Z"))), | |
cts:period-range-query( | |
"system", | |
"ALN_CONTAINED_BY", | |
cts:period(xs:dateTime("2015-01-13T13:00:00"), |
View Contributor.json
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
{ | |
"com.marklogic.samplestack.domain.Contributor": { | |
"aboutMe": "Twitter: [@maryadmin](http://twitter.com/maryadmin) Disclaimer: This is not me. MaryAdmin _doesn't exist_!", | |
"displayName": "MaryAdmin", | |
"id": "9611450a-0663-45a5-8a08-f1c71320475e", | |
"location": "Barrow", | |
"originalId": null, | |
"reputation": 100, | |
"userName": "mary@example.com", | |
"voteCount": 5, |
View configure-db.sh
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
curl -v -X PUT --anyauth -u admin:admin \ | |
--header "Content-Type:application/json" \ | |
-d '{"collection-lexicon":true}' \ | |
http://localhost:8002/manage/v2/databases/TutorialDB/properties |
View ex01.sh
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
curl -X GET \ | |
--anyauth --user rest-writer:x \ | |
'http://localhost:8011/v1/search?q=chicken&format=json' |
View sjs-tutorial-http.sjs
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
xdmp.setResponseContentType("application/json"); | |
switch(xdmp.getRequestMethod()) { | |
case "GET": | |
// Get the criterion out of the URL query string | |
var q = cts.wordQuery(xdmp.getRequestField("q")); | |
// Unwind the iterator into an Array | |
var results = cts.search(q).toArray(); | |
xdmp.addResponseHeader("X-Result-Count", results.length + ""); | |
// Serialize the JavaScript results object as JSON |
View sjs-tutorial-js-eval.sjs
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
(: | |
: Evaluate JavaScript from XQuery, passing in external variables and returning | |
: results as XQuery types. | |
:) | |
xdmp:javascript-eval( | |
"var result = []; for(var p in param) {result.push(p); result.push(param[p]);} result;", | |
(xs:QName("param"), object-node { "a": "A", "b": "B"}) | |
) |
View sjs-tutorial-values.sjs
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
/* | |
* Access the values from a range index. | |
* (Note: This assumes you've created the path range index on the | |
* balance.value field in "Import XQuery") | |
*/ | |
cts.values( | |
// Any reference to a range index | |
cts.pathReference("balance/value") | |
) |
View sjs-tutorial-oop.sjs
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
/* | |
* Demonstrate an object-oriented style of programming. Declare a Person type | |
* and instantiate an instance. Convert that instance into a JSON node, for | |
* example to persist it to the database, and convert it back. | |
*/ | |
// The Person constructor, e.g. var p = new Person(…) | |
Person = function(fname, lname) { | |
if (fname) this.fname = fname; | |
if (lname) this.lname = lname; |
View sjs-tutorial-markup-results.sjs
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
[ | |
{ | |
"guid": "986af6e1-e0f1-450f-b1f0-2eff54357840", | |
"about": [ | |
"Skateboard pop-up kogi, ethnic Vice disrupt Truffaut twee fashion axe forage occupy biodiesel. Bespoke umami yr, ", | |
{ | |
"match": "flannel" | |
}, | |
" kogi XOXO bitters butcher ugh DIY lomo. Flexitarian distillery ", | |
{ |
NewerOlder