(office, None), <http://www.w3.org/2000/10/swap/pim/contact#homePage> (homePage, None), <http://xmlns.com/foaf/0.1/mbox> (mbox, None), <http://www.w3.org/2000/10/swap/pim/contact#preferredURI> (preferredURI, None), <http://www.w3.org/ns/solid/terms#profileBackgroundColor> (profileBackgroundColor, None), <http://schema.org/owns> (owns, None), <http://xmlns.com/foaf/0.1/based_near> (based_near, None), <http://www.w3.org/2006/vcard/ns#hasAddress> (hasAddress, None), <http://xmlns.com/foaf/0.1/img> (img, None), <http://www.w3.org/2000/10/swap/pim/contact#assistant> (assistant, None), <http://xmlns.com/foaf/0.1/title> (title, None), <http://www.w3.org/ns/auth/cert#key> (key, None), <http://www.w3.org/ns/ldp#inbox> (inbox, None), <http://www.w3.org/ns/solid/terms#editableProfile> (editableProfile, None), <http://www.w3.org/2000/10/swap/pim/contact#postalCode> (postalCode, None), <http://xmlns.com/foaf/0.1/weblog> (weblog, None), <http://www.w3.org/ns/auth/cert#exponent> (exponent, None), <http://rdfs.org/sioc/ns#avatar> (avatar, None)    Querying the graph‚ÄãNow, you can use the graph SPARQL QA chain to ask questions about the graph.chain = GraphSparqlQAChain.from_llm(    ChatOpenAI(temperature=0), graph=graph, verbose=True)chain.run("What is Tim Berners-Lee's work homepage?")            > Entering new GraphSparqlQAChain chain...    Identified intent:    SELECT    Generated SPARQL:    PREFIX foaf: <http://xmlns.com/foaf/0.1/>    SELECT ?homepage    WHERE {        ?person foaf:name "Tim Berners-Lee" .        ?person foaf:workplaceHomepage ?homepage .    }    Full Context:    []        > Finished chain.    "Tim Berners-Lee's work homepage is http://www.w3.org/People/Berners-Lee/."Updating the graph‚ÄãAnalogously, you can update the graph, i.e., insert triples, using natural language.chain.run(    "Save that the person with the name 'Timothy Berners-Lee' has a work homepage at 'http://www.w3.org/foo/bar/'")            > Entering new GraphSparqlQAChain chain...    Identified
Graph databases are an excellent choice for applications based on network-like models. To standardize the syntax and semantics of such graphs, the W3C recommends Semantic Web Technologies, cp. Semantic Web. SPARQL serves as a query language analogously to SQL or Cypher for these graphs. This notebook demonstrates the application of LLMs as a natural language interface to a graph database by generating SPARQL.\
Graph databases are an excellent choice for applications based on network-like models. To standardize the syntax and semantics of such graphs, the W3C recommends Semantic Web Technologies, cp. Semantic Web. SPARQL serves as a query language analogously to SQL or Cypher for these graphs. This notebook demonstrates the application of LLMs as a natural language interface to a graph database by generating SPARQL.\ ->: (office, None), <http://www.w3.org/2000/10/swap/pim/contact#homePage> (homePage, None), <http://xmlns.com/foaf/0.1/mbox> (mbox, None), <http://www.w3.org/2000/10/swap/pim/contact#preferredURI> (preferredURI, None), <http://www.w3.org/ns/solid/terms#profileBackgroundColor> (profileBackgroundColor, None), <http://schema.org/owns> (owns, None), <http://xmlns.com/foaf/0.1/based_near> (based_near, None), <http://www.w3.org/2006/vcard/ns#hasAddress> (hasAddress, None), <http://xmlns.com/foaf/0.1/img> (img, None), <http://www.w3.org/2000/10/swap/pim/contact#assistant> (assistant, None), <http://xmlns.com/foaf/0.1/title> (title, None), <http://www.w3.org/ns/auth/cert#key> (key, None), <http://www.w3.org/ns/ldp#inbox> (inbox, None), <http://www.w3.org/ns/solid/terms#editableProfile> (editableProfile, None), <http://www.w3.org/2000/10/swap/pim/contact#postalCode> (postalCode, None), <http://xmlns.com/foaf/0.1/weblog> (weblog, None), <http://www.w3.org/ns/auth/cert#exponent> (exponent, None), <http://rdfs.org/sioc/ns#avatar> (avatar, None)    Querying the graph‚ÄãNow, you can use the graph SPARQL QA chain to ask questions about the graph.chain = GraphSparqlQAChain.from_llm(    ChatOpenAI(temperature=0), graph=graph, verbose=True)chain.run("What is Tim Berners-Lee's work homepage?")            > Entering new GraphSparqlQAChain chain...    Identified intent:    SELECT    Generated SPARQL:    PREFIX foaf: <http://xmlns.com/foaf/0.1/>    SELECT ?homepage    WHERE {        ?person foaf:name "Tim Berners-Lee" .        ?person foaf:workplaceHomepage ?homepage .    }    Full Context:    []        > Finished chain.    "Tim Berners-Lee's work homepage is http://www.w3.org/People/Berners-Lee/."Updating the graph‚ÄãAnalogously, you can update the graph, i.e., insert triples, using natural language.chain.run(    "Save that the person with the name 'Timothy Berners-Lee' has a work homepage at 'http://www.w3.org/foo/bar/'")            > Entering new GraphSparqlQAChain chain...    Identified