Can a blank node appear in several named graphs?

After searching information about this, I have interpreted that a blank node can only appear in one named graph. I draw the conclusion from this sentence that occurs in several documents dealing with named graphs: "Graphs may share URIrefs but not blank nodes".

So, my question is if I have interpreted the sentence above correctly, i.e. one blank node can only appear in one named graph.

A blank node is an unnamed node, whose name is set by the underlying RDF software and cannot be guaranteed to have the same name for different sessions. Within a graph, it is guaranteed to resolve to the same thing (not a resource/URI but a separate way to represent a node), and between graphs, "it would be incorrect to assume that blank nodes from different graphs having the same blank node identifiers are the same" (see RDF Primer). If you want multiple independent graphs to refer to the same resource, you have to give it an explicit URI.

A core feature of blank nodes is that they are local to the RDF graph in which they are used. For named graphs, which are not yet, in any form, part of the RDF standard, I would expect the same to hold, namely that a blank node is always local to the named graph in which it occurs.

Serialization syntaxes, such as RDF/XML or Turtle, allow you to assign an explicit name (a "blank node identifier") to a blank node, but this is only to distinguish between different blank nodes or to refer to the same blank node from different triples within the same graph. If you give the same blank node identifier to blank nodes in different graphs, these blank nodes are still different from each other; in fact, there will be no relationship or interaction between them at all.

The RDF standard says in Sec. 3.2 of the RDF Abstract Syntax:

A convention used by some linear representations of an RDF graph to allow several statements to reference the same unidentified resource is to use a blank node identifier, which is a local identifier that can be distinguished from all URIs and literals. When graphs are merged, their blank nodes must be kept distinct if meaning is to be preserved; this may call for re-allocation of blank node identifiers. Note that such blank node identifiers are not part of the RDF abstract syntax, and the representation of triples containing blank nodes is entirely dependent on the particular concrete syntax used.

In SPARQL, the situation is analog for graph patterns. According to Sec. 5.1.1 of the SPARQL 1.0 spec and also according to Sec. 5.1.1. of the current SPARQL 1.1. working draft:

When using blank nodes of the form _:abc, labels for blank nodes are scoped to the basic graph pattern. A label can be used in only a single basic graph pattern in any query.

They can be shared. Example: many stores offer the default graph as the union of the named graphs. Bnodes are shared.

If one graph is a subgraph of another, or one if the inference closure of another base graph, it is natural to share to share bnodes.

These are all practical issues.

The spec says:

" The blank nodes in an RDF graph are drawn from an infinite set. This set of blank nodes, the set of all RDF URI references and the set of all literals are pairwise disjoint. An RDF merge does not preserve sharing.

Otherwise, this set of blank nodes is arbitrary.

RDF makes no reference to any internal structure of blank nodes. Given two blank nodes, it is possible to determine whether or not they are the same. " That defn from RDF concepts does not preclude sharing (whatever the original design intention was!).

Certainly in serialised RDF, a node _:bob in one file is not necessarily the same as a node _:bob in another.

As others have said, multi-graph data is outside the realms of RDF. Whether a quad-store allows you to have nodes that exist in multiple graphs without having assigned it a URI (i.e. it's a blank node) is dependent on the implementation. I know of at least one implementation (the Perl library RDF::Trine) that does allow such nodes to be created. (Though it's careful not to create them accidentally via parsing different RDF files containing "_:bob" into the same store.)

The issue of blank nodes in RDF standards and implementations is extremely thorny. Focusing on your question:

First, (and as Michael states in his answer) for RDF Graphs, the issue is fairly unambiguous; when merging RDF graphs...

If the graphs in the set have no blank nodes in common, then the union of the graphs is a merge; if they do share blank nodes, then it is the union of a set of graphs that is obtained by replacing the graphs in the set by equivalent graphs that share no blank nodes.

So blank nodes cannot appear in merged RDF graphs taken together. Now:

Can a blank node appear in several named graphs?

The most authoritative source for named graphs (being a W3C Recommendation) is SPARQL, and from my reading of SPARQL, the answer is yes. There is a lot of subtext to the contrary, but nothing explicitly says that the same blank-node cannot appear in several named graphs—there is no formal relationship between a named graph and an RDF graph, although allowing named graphs to refer to individual merged RDF graphs is used as an example (see Example 2). Many people might implement a one-to-one mapping between RDF graphs and named graphs, but this is not writ anywhere in stone. As Toby points out, some engines might find it useful to have the same blank-node in different named graphs.

Now that named graphs can share blank-nodes, the next question might be:

If a blank node appears in two different named graphs, does it refer to the same thing?

The answer is possibly, but not necessarily: the SPARQL spec is deliberately vague on the topic, and it should not, in general, be assumed that they do refer to the same thing (although in practice, they can and often do).

(Note that according to RDF semantics, a blank-node is an existential variable that cannot refer to anything, but that's a different matter...)

What do you mean here exactly with a graph? An ontology usually consists of many (directed) graphs, therefore in an ontology can many blank nodes exist.

Did you also read the W3C RDF Spec.?

When not, see for more information: http://www.w3.org/TR/2004/REC-rdf-primer-20040210/#structuredproperties

If you give the same blank node identifier to blank nodes in different graphs.