The FlexVertex Data Multiverse is fundamentally built on the premise of connectivity among data objects. Understanding and defining these connections are pivotal to navigating and harnessing the complex relationships within your data landscape. This brief elaborates on the alternatives available for connecting objects within FlexVertex, detailing their applications and guiding you on choosing the appropriate type for your needs.
In FlexVertex, there are two primary ways to connect data objects:
Named Connections:
FlexConnection
base class.Class-based Connections:
FlexConnection
base class but offer enhanced capabilities.When deciding between named and class-based connections, consider the complexity and future scalability of your data model:
To better illustrate how both named and class-based connections operate within FlexVertex, let's look at some examples. We'll use Voyager, but the same concepts apply in any FlexVertex API.
Person
objects, using Friend
as the name for the connection.We begin by creating the objects
IFlexObject marco = new FlexObject(schema, "Person");
marco.setProperty("Name", "Marco");
marco.save();
IFlexObject kublai = new FlexObject(schema, "Person");
kublai.setProperty("Name", "Kublai");
kublai.save();
Next, we establish the connection:
marco.connectTo(kublai, "Friend");
As we describe in another technical brief, the beauty of the FlexVertex connection architecture is that you can start your search on either side of a connection to find all related objects. Thus, we only need to define one connection between Marco
and Kublai
.
We first create an abstract base class for visits, calling it Visited
. Because it's an abstract class, it can contain no data - but it can be queried.
IFlexClass visited = schema.createClass("Visited", "sysclass:FlexConnection");
visited.isAbstract(true);
visited.createProperty("VisitDate", FlexType.DateTime).setAttribute("DateTimeFormat","yyyy-MM-dd");
visited.save();
Next, we extend the class for both Business
and Leisure
trips, creating specialized properties for each one:
IFlexClass business = schema.createClass("Business", "Visited");
business.createProperty("ChargeCode", FlexType.String).isMandatory(true).isNotNull(true);
business.save();
IFlexClass leisure = schema.createClass("Leisure", "Visited");
leisure.createProperty("Activity", FlexType.String).isMandatory(true).isNotNull(true);
leisure.createProperty("Promotion", FlexType.Boolean);
leisure.createProperty("Bundle", FlexType.Boolean);
leisure.save();
To illustrate these examples, we'll use FlexVertex Commmander and Periscope.
First, let's search connections named Friend
to find Marco's friends:
Next, let's run a query to see all types of connections using the Visited
abstract class:
We can then move on to a more specialized query, focused on Leisure
derived class connections:
Finally, let's search on a property for the Leisure
class connection:
This brief has explored the critical roles that connections play within the FlexVertex Data Multiverse, offering insights into how to effectively implement and utilize these connections. By choosing the appropriate connection type, developers can optimize their data models for both performance and scalability, ensuring that their data ecosystems are robust and future-ready. For more detailed examples and technical specifications, users are encouraged to consult the comprehensive guides available in the FlexVertex documentation.