Interim blog setup, rough notes being dumped here at the moment - I'll tidy once I get to a milestone. And sorry about the layout, that'll probably take even longer to get around to... #TODO

llama_index SPARQL Notes 02

Published on 2023-08-28 by @danja

Aaargh! OpenAI API credit $0.21, and I won't have any money to top it up for another week or so

What doesn't need the API?

FOR TEMP CHANGES, UNMODIFIED FILES ARE IN ../original (I should probably make a branch in git, but then I'm likely to forget...)

My attention's been skipping around, spent a lot of time trying to engage with ChatGPT. There are bits of prompts I tried in llama_index SPARQL Notes 01.

Time to get back to the code proper (continuing from llama_index SPARQL Notes 00).

I've roughed out the shape of RDF I think I need :

# Simple Entity-Relation

@base <> .
@prefix er: <> .

<#T123> a er:Triplet ;
er:id "#T123" ;
er:subject <#E123> ;
er:property <#R456> ;
er:object <#E567> .

<#E123> a er:Entity ;
er:value "one" .

<#R456> a er:Relationship ;
er:value "two" .

<#E567> a er:Entity ;
er:value "three" .

But before writing the SPARQL I want to go back to, add some logging calls to see what it's actually passing around. Then go back to the tests, then forward...

$0.21 mode

Is there still data in my local NebulaGraph? I could populate a SPARQL store with that.

wait, there's the GUI, NebulaGraph Studio -


USE guardians;

-- Fetch 10 vertices with the 'entity' tag
MATCH (v:entity)


One results column labelled v

("$118.4 million" :entity{name: "$118.4 million"})
-- Fetch 10 edges with the 'relationship' type
MATCH (src:entity)-[e:relationship]->(dst:entity)
RETURN src, e, dst

Results table column labels are src, e, dst

("production on Vol.3" :entity{name: "production on Vol.3"})	[:relationship "production on Vol.3"->"February 2021" @-8998665471782897487 {relationship: "was put on hold until"}]	("February 2021" :entity{name: "February 2021"})

Ok, enough for today.