Table of Contents
A QGraph query is a labeled graph that describes the structure and content of the database entities (objects and links) to be matched. Vertices and edges in the query correspond to objects and links in the database. Every query must have at least one vertex and every edge must have vertices at both ends. A QGraph query must be a connected graph, with a single vertex being the simplest QGraph query.
QGraph queries are represented graphically. The example below shows a query that matches two objects connected by a directed link.
Each vertex and edge in a QGraph query has a unique name within the context of the query. These names have no intrinsic meaning and serve mostly to provide meaningful labels to the user in query results.
For the example queries in this document, we use either arbitrary alphabetic labels or semantically meaningful names for ease in understanding the query. For example, if we define a query vertex that matches database objects with the attribute value ObjType = movie, we might call this the movie vertex. Similarly, a query edge defined to match links with the attribute value LinkType = acted-in might be named appeared-in in the query. By convention, when using alphabetic labels, we use letters at the beginning of the alphabet such as A, B, and C to label vertices, and letters at the end of the alphabet such as X, Y, and Z to label edges. When context makes the intent clear, we will also use an informal shorthand to refer to database entities within this document. For example, we might refer to an object with the attribute Name = James Dean as the James Dean object.
Although the underlying graph model uses only directed links, QGraph supports both directed and undirected edges. That is, QGraph requires that the database use directed, binary links, but queries can either specify a required direction for edges and thus for corresponding links in the database, or indicate that the directionality of a link doesn’t matter when matching the query.