MarkLogic Data Hub Service

Fast data integration + improved data governance and security, with no infrastructure to buy or manage.

Learn More


Stay On Top Of Everything MarkLogic

Be the first to know! News, product information, and events delivered straight to your inbox.

Sign Me Up


MarkLogic World 2019

Learn how to simplify data integration & build innovative applications. Join us in Washington D.C. May 14-15!

Find Out More


Stay On Top Of Everything MarkLogic

Be the first to know! News, product information, and events delivered straight to your inbox.

Sign Me Up

Next Steps

A Little Graph Traversal

Here are a few final challenges for you. Using the data you have, try to answer:

  1. What is Aldous Huxley's sphere of influence?
  2. Now show not only the people he influenced directly, but the people *they* influenced.
  3. You can think of the first query as, "show me people that Aldous Huxley influenced, exactly 1 link away" and the second one as "show me people that Aldous Huxley influenced, any number of links away (but stop at 100)". Now show people that Aldous Huxley influenced exactly 2 links away. (Hint: You'll need to use SPARQL property paths).
You can find answers in the ts-graph-traversal.xml. workspace


Congratulations, you made it! If you're looking for next steps, you might want to check out this article:

Using the Triple Index

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.


The commenting feature on this page is enabled by a third party. Comments posted to this page are publicly visible.
  • IS sem.sparql call in javascript synchronous or asynchronous. In a javascript with 2 calls to sem.sparql it appears that results from call 1 are not complete when using them in param argument for call2. var sem = require("/MarkLogic/semantics.xqy"); var roles=[]; roles=sem.sparql('query1'); var users=[]; users=sem.sparql('query2 checkroles bind or filter',{ checkroles:function(user){ // check roles array. } }); roles array is not ready when second query is executed. Is there a way to use promise here.
    • Please share your actual binding code. sem.sparql returns a Sequence that behaves differently from the native array (unless you call .toArray()). Perhaps the following code can provide some idea on how to iterate the 'Sequence' object: <code> let sem = require("/MarkLogic/semantics.xqy"); let subjects = sem.sparql('select ?s where {?s <> "London"}', []) let triples = {} for (let subject of subjects){ triples[subject.s] = sem.sparql('select * where {?s ?p ?o}', subject) } triples </code>
      • Hi Deepak, if you still need assistance on this after above suggestion, I suggest that you resubmit this question along with your binding code to <a href="">Stack Overflow</a>, where it will reach a wider audience, as well as others who may have the same question. We plan to discontinue the use of Disqus on this site soon and don't want to lose your question, if still relevant.
  • The example for the paths doesn't seem to produce anything for Aldous. I think the only one that has a two level is Baruch_Spinoza i.e., PREFIX db: <> PREFIX onto: <> SELECT ?influenced WHERE { db:Baruch_Spinoza onto:influenced/onto:influenced ?influenced }
    • Thanks, David. You are right that the example doesn't actually produce anything for Aldous. We'll update this page.