MarkLogic Server 11.0 Product Documentation
GET /v1/graphs/things

Summary

With no parameters, returns a list of subject IRIs in the triple index. With iri parameters, returns a set of triples that include the given IRIs.

URL Parameters
iri* IRIs about which to return information.
database? Perform this operation on the named content database instead of the default content database associated with the REST API instance. Using an alternative database requires the "eval-in" privilege; for details, see Security Requirements in the REST Application Developer's Guide.
Request Headers
Accept* The expected MIME type of the response. With no parameters, the only supported MIME type is text/html. When the iri parameter is used, you can specify any of the MIME types listed in Supported RDF Triple Formats in the Semantic Graph Developer's Guide.
Response Headers
Content-type The MIME type of the data in the response body. The MIME type corresponds to the type requested by the Accept header.

Response

Upon success, MarkLogic Server returns status 200 (OK) and the response body contains the requested data. If your request results in an unsupported format, MarkLogic Server returns status 406 (Not Acceptable). If a specified IRI does not exist, MarkLogic server returns status 404 (Not Found).

Required Privileges

This operation requires the rest-reader role, or the following privilege:

http://marklogic.com/xdmp/privileges/rest-reader

Usage Notes

With no request parameters, this method returns a list of nodes in the database, both blank and named. If you specify one or more IRIs using the iri parameter, information is returned about just those nodes. The information is in CBD triple format. This implementation does not provide any reified statements.

If you do not specify any IRIs, this operation returns a maximum of 9,999 items. The DESCRIBE clause has a limit of 9999 triples in the server, which means if a query includes a DESCRIBE clause with one IRI or more IRIs that totals more than 9999 triples, triples will be truncated from the results.

The collection lexicon must be enabled on the database when using the GRAPH "?g" construct in SPARQL queries. Use the Admin Interface to check or enable the collection lexicon.

Example

$ curl --anyauth --user user:password -i -X GET -H "Accept: text/html" \
    http://localhost:8000/v1/graphs/things

==> The list of all graph nodes is returned as XML. A maximum of 10,000
    subjects is returned.  MarkLogic Server responds with output similar 
    to the following:

HTTP/1.1 200 OK
Content-type: text/html; charset=UTF-8
Server: MarkLogic
Content-Length: 1071
Connection: Keep-Alive
Keep-Alive: timeout=5

<html xmlns="http://www.w3.org/1999/xhtml">
<title>Subjects</title>
<body>
  <h2>Subjects</h2>
  <p>
    <a href="/v1/graphs/things?iri=http%3a//dbpedia.org/resource/Abraham_Lincoln">&lt;http://dbpedia.org/resource/Abraham_Lincoln&gt;</a>
  </p>
  <p>
    <a href="/v1/graphs/things?iri=http%3a//dbpedia.org/resource/Alan_Turing">&lt;http://dbpedia.org/resource/Alan_Turing&gt;</a>
  </p>
  <p>
    <a href="/v1/graphs/things?iri=http%3a//dbpedia.org/resource/Aleister_Crowley">&lt;http://dbpedia.org/resource/Aleister_Crowley&gt;</a>
  </p>
  <p>
    <a href="/v1/graphs/things?iri=http%3a//dbpedia.org/resource/Alexander_Mackenzie">&lt;http://dbpedia.org/resource/Alexander_Mackenzie&gt;</a>
  </p>
  <p>
    <a href="/v1/graphs/things?iri=http%3a//dbpedia.org/resource/Alfonso_Arau">&lt;http://dbpedia.org/resource/Alfonso_Arau&gt;</a>
  </p>
  <p>
    <a href="/v1/graphs/things?iri=http%3a//dbpedia.org/resource/Alfred_Lawson">&lt;http://dbpedia.org/resource/Alfred_Lawson&gt;</a>
  </p>
  <p>
    <a href="/v1/graphs/things?iri=http%3a//dbpedia.org/resource/Aristotle">&lt;http://dbpedia.org/resource/Aristotle&gt;</a>
  </p>
</body>
</html>
  

Example

$ curl --anyauth --user user:password -i -X GET -H "Accept: text/turtle" \
    http://localhost:8000/v1/graphs/things?iri=http://dbpedia.org/resource/Aleister_Crowley

==> Retrieve all the nodes selected by the IRI 
    http://dbpedia.org/resources/Aleister_Crowley in Turtle format.
    MarkLogicServer responds with output similar to the following:

HTTP/1.1 200 OK
Content-type: text/turtle; charset=UTF-8
Server: MarkLogic
Content-Length: 1095
Connection: Keep-Alive
Keep-Alive: timeout=5

@prefix xs: <http://www.w3.org/2001/XMLSchema#> .
<http://dbpedia.org/resource/Aleister_Crowley> <http://dbpedia.org/ontology/deathPlace> <http://dbpedia.org/resource/Hastings> .
<http://dbpedia.org/resource/Aleister_Crowley> <http://dbpedia.org/ontology/birthPlace> <http://dbpedia.org/resource/Royal_Leamington_Spa> .
<http://dbpedia.org/resource/Aleister_Crowley> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
<http://dbpedia.org/resource/Aleister_Crowley> <http://xmlns.com/foaf/0.1/givenName> "Aleister" .
<http://dbpedia.org/resource/Aleister_Crowley> <http://xmlns.com/foaf/0.1/name> "Aleister Crowley" .
<http://dbpedia.org/resource/Aleister_Crowley> <http://xmlns.com/foaf/0.1/surname> "Crowley" .
<http://dbpedia.org/resource/Aleister_Crowley> <http://purl.org/dc/elements/1.1/description> "poet, mountaineer, occultist" .
<http://dbpedia.org/resource/Aleister_Crowley> <http://dbpedia.org/ontology/birthDate> "1875-10-12"^^xs:date .
<http://dbpedia.org/resource/Aleister_Crowley> <http://dbpedia.org/ontology/deathDate> "1947-12-01"^^xs:date .
  
Powered by MarkLogic Server | Terms of Use | Privacy Policy