3. Untyped nodes, typed edges, untyped endpoints
This a kind of view that a text editor might have (ignoring markup declarations) allowing top-down navigation into various files. It is a tree of anonymous nodes and named set of resources/files/objects called entities.
4. Attribute-labelled nodes with attribute-labelled edges.
An example is Chen's Entity-Relationship Model: it has three types of nodes: entity, relationship and attribute.
- Nodes are labelled: the entity name, relationship name, attribute name.
- Edges
have no type or label, but their end-points have a cardinality
property: for end-points of edges involving attributes, this may not be
greater than 1.
- All nodes have at least one edge. A node cannot have an edge to the same type of node, and an attribute
node only has one edge (i.e., there are "entity attributes" and
"relationship attributes".)
- One attribute connected to an entity can be the "primary key".
- The network is a graph. Edges and nodes do not have any ordering property.
Conjecture: XML cannot represent #4
XML's strength is that it can be viewed as node-labelled or edge-labelled networks in all sorts of ways.
However, while we can have attributes that attach to nodes or that attach to edges, there is no way in XML itself to attach attributes to both nodes and edges. Which is what the E-R model wants. You have to go outside XML to some higher layer that may give a view of the document with some attributes coming in on nodes (or edges) associated with edges (or nodes.) This impacts every part of the XML ecosystem, which also needs to somehow convey this out-of-band non-schema information, where it exists.
For example, in a start-tag `< buttons type="wooden" xml:lang="de">...` the @type is an attribute of buttons, but the @xml:lang is an attribute of the element's contents which are in German. In E-R terms, one should be an entity attribute and the other a relationship attribute. (Please don't quibble about this example, please focus on what I am trying to communicate, not on the details of what @xml:lang applies to in its specification, etc: I know what some of you are like :-) )
So what people often do, to get "pure" modeling, is like `< buttons type="wooden">< data xml:lang="de">...` to get an attachment. But this does not in fact let you know which attributes belong to edges and which to nodes, it just creates another edge and node. You need to go outside.
How could this be resolved? My preference would be a specialized = delimiter, like =@, in an upgrade to XML for attributes that apply to the contents (attributes on the node if edges are normally used, and vice versa.)
But in XML 1.n, it could be done by some naming convention, for example, a namespace prefix starting with "data_" on any attribute that should attach to the contents between the tags, not the tag itself. `< buttons type="wooden" xml:lang=@"de">...`
Regards
Rick