This project has retired. For details please refer to its Attic page.
Apache Marmotta - LDPath - Functions

LDPath Functions

The different Marmotta components can register custom LDPath functions to extend the LDPath functionality.

Currently, the following LDPath all available functions (the ones actually registered can be lively checked at http://host/to/marmotta/ldpath/admin/functions.html):

Name Signature Description
cleanHtml fn:cleanHtml(content: LiteralList) : LiteralList Function to clean up HTML and remove all script and style elements from the content. Can be used in-path, using the current context nodes as argument.
concat fn:concat(nodes : NodeList) : String A node function concatenating a list of nodes interpreted as strings.
content fn:content(nodes : URIResourceList) : LiteralList Resolve the URIs passed as argument and retrieve their content using the content reader applicable for the resource.
count fn:count(nodes : URIResourceList, ...) : IntegerLiteralList Counts the number of resources in the arguments
css fn:css(jsoup: String [, nodes: XMLLiteralList]) : LiteralList Evaluate an JSoup CSS selector on either the value of the context node or the values of the nodes passed as arguments.
earliest fn:earliest(DateLiteralList): DateLiteral select the earliest date (min)
first fn:first(nodes : NodeList) : Node Selects the first node in the argument list.
htmlText fn:htmlText(content: LiteralList) : LiteralList strips all html tags and resolves html-entities like &
jsoup fn:jsoup(jsoup: String [, nodes: XMLLiteralList]) : LiteralList Evaluate an JSoup CSS selector on either the value of the context node or the values of the nodes passed as arguments.
last fn:last(nodes : NodeList) : Node Returns the last element in the node list.
latest fn:latest(DateLiteralList): DateLiteral Select the latest date (max)
max fn:max(LiteralList l [, ...]) :: NumberLiteral(s) Select the max of each argument
min fn:min(LiteralList l [, ...]) :: NumberLiteral(s) Sselect the min of each argument
removeTags fn:removeTags(content: LiteralList) : LiteralList Function to remove all XML or HTML tags from the content. Can be used in-path, using the current context nodes as argument.
replace fn:replace(nodes: NodeList, regex: String, replace: String) :: NodeList Applies a String.replaceAll on the nodes (URI or LiteralContent resp.).
round fn:round(LiteralList l) :: IntegerLiteralList Round each argument to the closest int/long value
sort fn:sort(nodes : NodeList [, ("string"|"number"|"date") [, ("asc"|"desc") ] ]) : NodeList Sort the node list passed as first argument. The second argument can be used to determine the sort method, the third argument to determine the sort direction.
strJoin fn:strJoin(nodes: NodeList, separator: String [, prefix: String [, suffix: String ]]) :: LiteralList join the string representation of all provided nodes.
strLeft fn:strLeft(node::Node, length::NumericLiteral) :: StringLiteral Take the first n chars from the string representation
strlen fn:strlen(text: Literal) : IntegerLiteralList Returns the length of the given StringLiterals
strRight fn:strRight(node::Node, length::NumericLiteral) :: StringLiteral Take the last n chars from the string representation
substr fn:substr(node::Node, start::NumericLiteral [, end::NumericLiteral]) :: StringLiteral Extract a substring for the string representation of a node
wc fn:wc(text : LiteralList) : IntegerLiteralList Calculates the length of the provided literals (counting continuous chunks of letters+digits)
xmlText fn:xmlText(content: LiteralList) : LiteralList Function to remove all XML-Tags and -Entities (&...; stuff) from the content.
xmlUnescape fn:xmlUnescape(content: LiteralList) : LiteralList Function to resolve all xml-entities in the content
xpath fn:xpath(xpath: String [, nodes: XMLLiteralList]) : LiteralList Evaluate an XPath expression on either the value of the context node or the values of the nodes passed as arguments.

Legend: