Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/jbarrasa/goingmeta/llms.txt

Use this file to discover all available pages before exploring further.

RDF (Resource Description Framework) and SPARQL are the foundational standards of the Semantic Web, and they appear throughout Going Meta as the bridge between open linked-data sources (DBpedia, Wikidata, the British Library) and Neo4j. Understanding how RDF triples map to Neo4j nodes and relationships is essential context for sessions that import ontologies, query external SPARQL endpoints, or export graph data as RDF.

The RDF Triple

Every piece of data in RDF is expressed as a triple: a subject, a predicate, and an object. The subject and predicate are always URIs; the object can be a URI or a literal value.
rdf-example.ttl
# Subject          Predicate              Object
<http://ex.org/FB> a              dbo:Company .
<http://ex.org/FB> rdfs:label     "Meta Platforms"@en .
<http://ex.org/FB> dbo:founder    <http://dbpedia.org/resource/Mark_Zuckerberg> .
Three triples, three facts. The URI <http://ex.org/FB> is the same subject across all three, which is how RDF builds a graph: shared URIs connect facts together.

RDF Serialisation Formats

RDF has multiple text formats. Going Meta sessions use several of them:
Turtle is the most human-readable RDF format and is used for all ontology files (.ttl) in the repository. Prefixes shorten URIs:
@prefix dbo:  <http://dbpedia.org/ontology/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix :     <http://goingmeta.io/data/> .

:FB a dbo:Company ;
    rdfs:label "Meta Platforms"@en ;
    dbo:founder :MarkZuckerberg .

SPARQL Query Language

SPARQL is the W3C standard query language for RDF. It uses triple patterns in WHERE clauses and supports SELECT, CONSTRUCT, ASK, and DESCRIBE query forms.

SELECT — Retrieve values from a SPARQL endpoint

Session 10 queries DBpedia to retrieve company data by stock ticker symbol:
getcompanydata_basic.sparql
SELECT (?company AS ?uri) (?name AS ?companyname)
WHERE {
  # match company by ticker
  ?company a dbo:Company ;
           dbp:symbol "FB"@en ;
           rdfs:label ?name .

  FILTER(LANG(?name) = "en")
}

CONSTRUCT — Build an RDF graph from query results

CONSTRUCT returns a new RDF graph rather than a table. Session 10 uses it to pull a company subgraph from DBpedia and import it into Neo4j:
getcompanydata_full.sparql
CONSTRUCT {
  ?company a dbo:Company ; ?cpred ?cobj ; ?relToPerson ?person ; ?relToPlace ?place .
  ?person  a dbo:Person  ; rdfs:label ?pobj .
  ?place   a dbo:Place   ; rdfs:label ?plobj .
}
WHERE {
  ?company a dbo:Company ; dbp:symbol "FB"@en .
  ?company ?cpred ?cobj .
  FILTER(
    isLiteral(?cobj) &&
    (LANG(?cobj)="en" || LANG(?cobj)="") &&
    (STRSTR(STR(?cpred), "http://dbpedia.org/ontology/") = 1 ||
     ?cpred = rdfs:label)
  )
  OPTIONAL {
    { ?company ?relToPerson ?person } UNION { ?person ?relToPersonInv ?company }
    ?person a dbo:Person ; rdfs:label ?pobj .
    FILTER(LANG(?pobj)="en" || LANG(?pobj)="")
  }
  OPTIONAL {
    { ?company ?relToPlace ?place } UNION { ?place ?relToPlaceInv ?company }
    ?place a dbo:Place ; rdfs:label ?plobj .
    FILTER(LANG(?plobj)="en" || LANG(?plobj)="")
  }
}

Importing SPARQL Results into Neo4j with n10s

The Neosemantics plugin (n10s) can fetch and materialise the results of a CONSTRUCT query directly into Neo4j. This is the pattern used in Session 10 to enrich a Neo4j graph with DBpedia company data:
session10-import.cypher
// Import company subgraph from DBpedia CONSTRUCT query
CALL n10s.rdf.import.fetch(
  "https://dbpedia.org/sparql?query=" +
  apoc.text.urlencode("CONSTRUCT { ?company a dbo:Company ; ?p ?o } WHERE { ?company dbp:symbol \"FB\"@en ; ?p ?o . FILTER(isLiteral(?o)) }") +
  "&format=text%2Fturtle",
  "Turtle"
);
n10s maps RDF types (rdf:type) to Neo4j node labels and RDF predicates to Neo4j relationship types or node properties, depending on whether the object is a URI or a literal.

The RDF–Property Graph Bridge

Going Meta uses Neosemantics (n10s) to move data between the RDF and property graph worlds. The mapping works as follows:
RDF ConceptNeo4j Equivalent
rdf:type tripleNode label
Object property triple (URI → URI)Relationship
Datatype property triple (URI → literal)Node property
Named individual URINode uri property
owl:Class:Class node
rdfs:subClassOf:SCO relationship
When you import with handleVocabUris: "IGNORE" in n10s.graphconfig.init, namespace prefixes are stripped from property and relationship names, making the resulting graph much cleaner for Cypher queries.

Where RDF & SPARQL Appear in Going Meta

Session 1 — British Library

First comparison of Cypher and SPARQL on the same dataset — the British National Bibliography.

Session 8 — RDF Integration Patterns

Import RDF in multiple serialisations, export graph data as RDF, and handle vocabulary URIs.

Session 10 — SPARQL Integrations

Query DBpedia and Wikidata SPARQL endpoints from Neo4j to enrich the local graph.

Session 12 — RDFLib & AuraDB

Use Python’s RDFLib to write RDF triples directly into Neo4j AuraDB.

Build docs developers (and LLMs) love