Skip to content

Instantly share code, notes, and snippets.

@lonniev
Created September 2, 2022 21:26
Show Gist options
  • Save lonniev/83a67667086f7e2dbb41aee5b51b0715 to your computer and use it in GitHub Desktop.
Save lonniev/83a67667086f7e2dbb41aee5b51b0715 to your computer and use it in GitHub Desktop.
Perform a Gremlin Query that finds Artifacts in the graph g of requirement-like type that are within DNG Repositories and have a thread to a SysML Requirement
g.V().match(
__.as( 'dngRepoType' ).has( 'RepositoryType', 'name', 'DOORS-NG Repository Type' ),
__.as( 'dngRepoType' ).in( 'hasType' ).hasLabel( 'Repository' ).as( 'dngRepo' ),
__.as( 'dngRepo' ).in( 'ownedBy' ).hasLabel( 'ArtifactType' )
.filter{ it.get().value('name') ==~ /(?i).*?requirement.*/ }.as( 'dngReqType' ),
__.as( 'dngReqType' ).in( 'hasType' ).hasLabel( 'Artifact' ).as( 'dng' ),
__.as( 'dng' ).both( 'Relation' ).hasLabel( 'Artifact' ).has( 'type' ).as( 'sysML' ),
__.as( 'sysML' ).out( 'hasType' ).hasLabel( 'ArtifactType' )
.filter{ it.get().value('name') ==~ /(?i).*?requirement.*/ }.as( 'sysMLtype' ),
__.as( 'sysMLtype' ).out( 'ownedBy' ).as( 'sysMLrepo' ),
__.as( 'sysMLrepo' ).out( 'hasType' ).as( 'sysMLrepoType' ),
__.as( 'sysMLrepoType' ).has( 'RepositoryType', 'name', 'SysML Repository Type' ),
__.as( 'dng' ).bothE().hasLabel( 'Relation' ).as( 'r' ),
__.as( 'r' ).bothV().as( 'sysML' )
).select( 'r' )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment