# Introduction

LD Path is a simple path-based query language similar to XPath or SPARQL Property Paths that is particularly well-suited for querying and retrieving resources from the Linked Data Cloud by following RDF links between resources and servers. For example, the following path query would select the names of all friends of the context resource:

        foaf:knows / foaf:name :: xsd:string

The complete LDPath documentation can be found at the LDPath project site.

# LDPath Web Services

Inside Marmotta, the LDPath language is available to other components through the LDPathService as well as through an easy-to-use webservice. Using the web service you can either evaluate a single LDPath selection as in:

        GET /ldpath/path?uri=<context-resource>&path=/path/selection

where <context-resource> is the URI of the resource where the path selection starts, and /path/selection is a path selector as described in the LDPath documentation. Result is a RDF/JSON formatted list of nodes. Alternatively, you can evaluate a complete LDPath Program (see the FOAF example by calling the following webservice:

        GET /ldpath/program?uri=<context-resource>&program=<program>

where <context-resource> is the URI of the resource where the path selection starts, and <program> is the complete LDPath program. Note that the parameters need to be URL-encoded.