# Graph

Several different meanings of the terms "Graph" (or "RDF Graph") and "Named Graph" are in use. Often, the meaning is obvious from the context. Other times, there is no useful distinction between the meanings. This page is here to help on those occasions where it is useful to disambiguate and distinguish between the meanings.

## Meanings of the term "Graph" (in RDF)

- Graph-1
- a mathematical set of RDF triples.

By definition, if g and h are Graph-1 graphs, and they contain exactly the same triples, then g=h. The RDF Semantics are written in terms of Graph-1 graphs. When we speak of one graph entailing another, we mean Graph-1s. It makes no sense to speak of a Graph-1 "changing", just like it makes no sense to speak of the Empty Set "changing", or the set of prime numbers "changing".

(It's not exactly clear how blank nodes affect graph identity; given g = { <a> <b> _:x } and h = { <a> <b> _:x }, does g=h? RDF Semantics experts, please weigh in.)

Suggested names: RDF Formula, Literal Graph

- Graph-2
- a facility for storing a set of RDF triples.

At any given point in time, the content of a Graph-2 is a Graph-1. For Graph-2 graphs, i and j, they might contain exactly the same triples, but that does not imply they are equal. The "default graph" of a SPARQL endpoint is generally understood to be a Graph-2, since people speak of it changing.

Suggesed names: RDF KB, Triplestore, Graph Location

## Meanings of the term "Named Graph" (in RDF)

- NamedGraph-1
- a Graph-1 which is the referent of some IRI (the resource identified by that IRI)

This is a special kind of Graph-1; specifically, it is a Graph-1 that someone, somewhere, has decided to refer to using some IRI.

It's not clear whether this meaning of "Named Graph" is useful, but it may be the most obvious definition, so it is listed here to show how it differs from the other meanings.

- NamedGraph-2
- an entity which has at least two properties, a "name" which is a URI, and an "rdfgraph" which is a Graph-1.

This definition comes from Carroll et al 2005. If n is a NamedGraph-2, then n *has* a graph; it is not the case that n *is* a graph. n does not contain triples; rather it has an rdfgraph which contains triples.

If one speaks of "adding a triple to n", that must be understood as shorthand for updating n to have a different rdfgraph which differs in that it includes the given triple.

*Clarification needed: For a NamedGraph-2 n, apparently the "graph" property of n can be changed without changing n's identity. Can the "name" property also be changed without changing n's identity? I think not, but this should be clarified in the definition. -- David Booth 17:27, 22 July 2010 (UTC)*

- NamedGraph-3
- a pair of a name (an IRI) and a Graph-2

This appears to be what SPARQL formally calls a "Named Graph". It is an adaptation of NamedGraph-2 to use Graph-2 instead of Graph-1, and it drops the possibility that the Named Graph has other components; it's just the pair.

- NamedGraph-4
- A Graph-2 which also has an associated IRI

If m is a NamedGraph-4, then m has a name, which is an IRI, and m *is* a facility which stores a set of RDF triples.

This is probably the most widely used meaning for "Named Graph".

The rdfgraph of a NamedGraph-3 is a NamedGraph-4, and the SPARQL specs seem to not distinguish between these meanings (which is probably okay, since it's clear from context which is meant).

There is an open architectural question: is the Graph-2 associated with the IRI the referent of that IRI? If so, then presumably its current state, a Graph-1, is what is serialized and transmitted as the representation. If not, what are the relationships between the referent of the IRI, the associated Graph-2, and the transmitted Graph-1?

*Clarification needed: I puzzled over the difference between NamedGraph-3 and NamedGraph-4 for a while. They sound equivalent, because an association is just a pairing anyway. But then I noticed that the NamedGraph-4 discussion mentions serialization and representations, and it occurs to me that perhaps you are imparting special web-dereference meaning to the phrase "has an associated IRI". Do you mean that a NamedGraph-4 is a web-dereferenceable IRI for a Graph-2? -- David Booth 17:44, 22 July 2010 (UTC)*