Skip to content

Instantly share code, notes, and snippets.

View eedeebee's full-sized avatar

Eric Bloch eedeebee

  • Hillsborough, CA
View GitHub Profile
@eedeebee
eedeebee / ex001.java
Created February 1, 2014 00:32
MarkLogic Java Tutorial Examples as of V7
// Create a search definition
StringHandle handle = new StringHandle(
"<q:qbe xmlns:q=\"http://marklogic.com/appservices/querybyexample\">\n" +
" <q:query>\n" +
" <PLAY>\n" +
" <PERSONAE>\n" +
" <PERSONA><q:word>brother</q:word></PERSONA>\n" +
" </PERSONAE>\n" +
" </PLAY>\n" +
" </q:query>\n" +
@eedeebee
eedeebee / qbe-json-ex.java
Created February 1, 2014 05:33
MarkLogic Java API QBE for JSON
// create a search definition
StringHandle handle = new StringHandle(
"{ \"$query\": { \"plenary\": true } }"
).withFormat(Format.JSON);
RawQueryByExampleDefinition query = queryMgr.newRawQueryByExampleDefinition(handle);
// create a handle for the search results
StringHandle resultsHandle = new StringHandle().withFormat(Format.JSON);
// ==UserScript==
// @name Trello Lists Show Num Cards
// @namespace http://use.i.E.your.homepage/
// @version 0.1
// @description enter something useful
// @match https://trello.com/b/*
// @copyright 2012+, You
// @require http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js
// ==/UserScript==
setTimeout(function() {

Lost in Recursion - Generate XML from name value pairs (HTML Form)

Meta

  • Pre-requisites

MarkLogic Server 4.2. Knowing your way around http://localhost:8001 or a working cq instalation

  • Difficulty: Medium
  • Keywords: XML, XForms, HTML, Forms, XQuery, Functional, Map, Fold, High Order Functions, Application Buider, Search, git, github, XQuery 1.1

Nuno Job

xdmp:invoke("hello.xqy")
@eedeebee
eedeebee / gist:654314
Created October 29, 2010 20:10 — forked from anonymous/gist:462145
invoking xslt
xdmp:xslt-eval(
<xsl:stylesheet version="2.0"/>,
doc("input.xml")
)
xdmp:xslt-invoke("hello.xsl", doc("input.xml"))
xdmp:eval("'Hello, World!'")
xdmp:xslt-invoke("hello.xsl", doc("input.xml"),
map:map(
<map:map xmlns:map="http://marklogic.com/xdmp/map">
<map:entry>
<map:key>name1</map:key>
<map:value>value1</map:value>
</map:entry>
<map:entry>
<map:key>name2</map:key>
<map:value>value2</map:value>
xdmp:invoke("hello.xqy", (xs:QName("name1"), "value1",
xs:QName("name2"), "value2"))