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
declare function gs:doc-compliance-map($uri as xs:string) | |
{ | |
let $query := cts:document-query($uri) | |
let $map := map:map() | |
let $doc := gs:highlight($uri, 'a') | |
let $header1 := | |
for $s in $doc/document/body//(section|subsection) | |
where fn:contains($s/fn:data(compliance), $TERM1) | |
return fn:count($s) |
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
declare function gs:highlight($uri, $search) | |
{ | |
for $x in cts:search(fn:doc(xdmp:url-decode($uri)), $search) | |
return cts:highlight($x, $search, <b>{$cts:text}</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
declare function gs:highlight($uri, $search) | |
{ | |
cts:highlight( | |
fn:doc(xdmp:url-decode($uri)), | |
$search, | |
<b>{$cts:text}</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
declare function local:doc-compliance-map($uri, $terms) | |
{ | |
let $map := map:new( | |
for $term in $terms | |
return map:entry($term, 0) | |
) | |
let $doc := fn:doc($uri) | |
let $_ := | |
for $s in $doc/document/body//(section|subsection) |
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
declare function local:doc-compliance-map($uri, $terms) | |
{ | |
let $map := map:new( | |
for $term in $terms | |
return map:entry($term, 0) | |
) | |
let $doc := fn:doc($uri) | |
let $_ := | |
for $value in cts:element-values(xs:QName("compliance"), (), "item-frequency", cts:document-query($uri)) |
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
<compliance>TERM1 TERM2</compliance> | |
<!-- ... becomes... --> | |
<compliance>TERM1</compliance> | |
<compliance>TERM2</compliance> |
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
<ml-facets facet-list="model.facets" selected="model.selected" | |
select="selectFacet(facet, value)" clear="clearFacet(facet, value)"></ml-facets> |
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
app.put('/v1*', function(req, res){ | |
if (req.session.user === undefined) { | |
res.send(401, 'Unauthorized'); | |
} else if (req.path === '/v1/documents' && | |
req.query.uri.match('/users/') && | |
req.query.uri.match(new RegExp('/users/[^(' + req.session.user.name + ')]+.json'))) { | |
// The user is try to PUT to a profile document other than his/her own. Not allowed. | |
res.send(403, 'Forbidden'); | |
} else { | |
if (req.path === '/v1/documents' && req.query.uri.match('/users/')) { |
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 "1.0-ml"; | |
module namespace trns = "http://marklogic.com/transform/to-json"; | |
import module namespace json="http://marklogic.com/xdmp/json" at "/MarkLogic/json/json.xqy"; | |
declare function trns:transform( | |
$content as map:map, | |
$context as map:map | |
) as map:map* | |
{ |
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
~/software/mlcp-Hadoop2-1.2-1/bin/mlcp.sh import \ | |
-username admin -password admin -host localhost -port 8031 \ | |
-input_file_path data -transform_module /to-json.xqy \ | |
-transform_namespace "http://marklogic.com/transform/to-json" \ | |
-transform_function transform |
OlderNewer