Run Queries on the SysML Graph
- Go to the Neo4 browser and run the following query to view the generated graph.
match (n)-[r]->(m) return n,r,m
The top of the graph shows a color index of the different types of nodes and relationships in the graph, e.g. Activity, Block, ConstraintBlock, DataType, Interaction, InterfaceBlock, etc. These represent the concept areas of SysML that are being covered by the SysML -> Graph generation process. All the key concepts from the 9 areas of SysML are being covered. - After re-arranging the nodes, the graph will look similar to as shown below. The top-level blue nodes are the packages and their sub-packages. The main packages under the System package are (L-R): Structure, Interactions, Stereotypes, Requirements, Use Cases, Activities, State machines.
Run the following query to get the package structure in the model:
match(p:Package) return p
Run the following query to get all blocks in the model: match(b:Block) return b
This fetches all the blocks in the model and their inter-relationships, including generalization (inheritance), part/reference/shared properties, and full ports. All the blocks inherit from the System Block. The UAV block is the top-level structural element and it has several part properties.
Run the following query to get all the requirements in the model - match (r:Requirement) return r
Run the following query to get all the immediate child requirements for a given requirement
match(r:Requirement{name:"cUAV Specification"})-[:Containment]->(rc:Requirement) return r,rc
Get all relationships (ingoing and outgoing) for a given requirement - match(r:Requirement{name:"cUAV Specification"})-[rel]-(n) return r,rel,n
Run the following query to get all inheritance (generalization) relationships between blocks. Note: Turn off Auto-Complete to see only Generalization relationships.
match(b:Block)-[r:Generalization]->(p:Block) return b,r,pRun the following query to get all value properties of all blocks. Turn on Auto-Complete to see the Generalization relationships. It shows the UAV block has its own value properties but will also inherit value properties from the System block - match(b:Block)-[r:ValueProperty]->(t) return b,r,t
Run the following query to get all full and proxy ports of all blocks. Turn on Auto-Complete if you want to see relationships between the blocks (e.g. PartProperty) - match(b)-[r:FullPort|ProxyPort]->(t) return b,r,t
Run the following query to get all constraint properties of all blocks - match(b:Block)-[r:ConstraintProperty]-(t) return b,r,t
Run the following query to get all relationships—outgoing and incoming—for a specific block (e.g. UAV). Turn off Auto-Complete of relations
match(b:Block{name:"UAV"})-[r]-(t) return b,r,t
Run the following query to check if there are any orphaned requirements, i.e. requirements that do not have any incoming or outgoing relations. There are none at this point.
match(r:Requirement) where size((r)-[]-())=0 return r
You can try creating a new isolated requirement using the command below and then re-run the query above.
create(r:Requirement{name:"Test"})
Run the following query to get all the behaviors (activities, state machines, and interactions) associated with all the blocks.
match(b:Block)-[r]-(f) where(f:Activity OR f:StateMachine OR f:Interaction) return b,r,f
Only the UAV block has associated behaviors in the model. We have associated behaviors to the UAV SysML block in two different ways that represent typical modeling usage:
Block element contains the behavior element. This is the case when the behavior is modeled as an owned behavior (or classifier behavior) of the block.
- Behavior is assigned to the block through a dependency relationship, typically allocate.
Run the following query to get all the use cases in the model. Turn on Auto-Complete to view the Generalization relationships between use cases.
match(u:UseCase) return u
Run the following query to get applied stereotypes and tag values for the UAV block. If you select the relationship, you can see the values of the tags (target_life, budget, and owner) populated for the UAV block.
match(b:Block{name:"UAV"})-[r]->(s:Stereotype) return b,r,s