discovery.rst 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. Resource Discovery & Query
  2. ==========================
  3. LAKEsuperior offers several way to programmatically discover resources and
  4. data.
  5. LDP Traversal
  6. -------------
  7. The method compatible with the standard Fedora implementation and other LDP
  8. servers is to simply traverse the LDP tree. While this offers the broadest
  9. compatibility, it is quite expensive for the client, the server and the
  10. developer.
  11. For this method, please consult the dedicated `LDP specifications
  12. <https://www.w3.org/TR/ldp/>`__ and `Fedora API specs
  13. <https://wiki.duraspace.org/display/FEDORA4x/RESTful+HTTP+API+-+Containers>`__.
  14. SPARQL Query
  15. ------------
  16. A `SPARQL <https://www.w3.org/TR/sparql11-query/>`__ endpoint is available in
  17. LAKEsuperior both as an API and a Web UI.
  18. .. figure:: assets/lsup_sparql_query_ui.png
  19. :alt: LAKEsuperior SPARQL Query Window
  20. LAKEsuperior SPARQL Query Window
  21. The UI is based on `YASGUI <http://about.yasgui.org/>`__.
  22. Note that:
  23. #. The SPARQL endpoint only supports the SPARQL 1.1 Query language.
  24. SPARQL updates are not, and will not be, supported.
  25. #. The LAKEshore data model has an added layer of structure that is not exposed
  26. through the LDP layer. The SPARQL endpoint exposes this low-level structure
  27. and it is beneficial to understand its layout. See :doc:`model` for details
  28. in this regard.
  29. #. The underlying RDF structure is mostly in the RDF named graphs. Querying
  30. only triples will give a quite uncluttered view of the data, as close to the
  31. LDP representation as possible.
  32. SPARQL Caveats
  33. ~~~~~~~~~~~~~~
  34. The SPARQL query facility has not yet been tested thoroughly. the RDFLib
  35. implementation that it is based upon can be quite efficient for certain
  36. queries but has some downsides. For example, do **not** attempt the following
  37. query in a graph with more than a few thousands resources::
  38. SELECT ?p ?o {
  39. GRAPH ?g {
  40. <info:fcres/my-uid> ?p ?o .
  41. }
  42. }
  43. What the RDFLib implementation does is going over every single graph in the
  44. repository and perform the ``?s ?p ?o`` query on each of them. Since
  45. LAKEsuperior creates several graphs per resource, this can run for a very long
  46. time in any decently sized data set.
  47. The solution to this is either to omit the graph query, or use a term search,
  48. or a native Python method if applicable.
  49. Term Search
  50. -----------
  51. This feature has not yet been implemented. It is meant to provide a discovery
  52. tool based on simple term match, and possibly comparison. It should be more
  53. efficient and predictable than SPARQL.