Skip to content

Commit

Permalink
#96 CoreGraph -> Carnival
Browse files Browse the repository at this point in the history
  • Loading branch information
augustearth committed Aug 6, 2022
1 parent 8e45117 commit fcc256f
Show file tree
Hide file tree
Showing 22 changed files with 59 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import carnival.graph.VertexBuilder
*
*/
@Slf4j
abstract class CoreGraph implements GremlinTrait {
abstract class Carnival implements GremlinTrait {

///////////////////////////////////////////////////////////////////////////
// UTILITY
Expand Down Expand Up @@ -131,7 +131,7 @@ abstract class CoreGraph implements GremlinTrait {
///////////////////////////////////////////////////////////////////////////

/** */
protected CoreGraph(Graph graph, DefaultGraphSchema graphSchema, GraphValidator graphValidator) {
protected Carnival(Graph graph, DefaultGraphSchema graphSchema, GraphValidator graphValidator) {
assert graph
assert graphSchema
assert graphValidator
Expand All @@ -148,7 +148,7 @@ abstract class CoreGraph implements GremlinTrait {

/** */
public void initializeGremlinGraph(Graph graph, GraphTraversalSource g, String packageName) {
log.info "CoreGraph initializeGremlinGraph graph:$graph g:$g packageName:$packageName"
log.info "Carnival initializeGremlinGraph graph:$graph g:$g packageName:$packageName"

initializeDefinedVertices(graph, g, packageName)
initializeDefinedEdges(graph, g, packageName)
Expand All @@ -157,7 +157,7 @@ abstract class CoreGraph implements GremlinTrait {

/** */
public void initializeGremlinGraph(Graph graph, GraphTraversalSource g) {
log.info "CoreGraph initializeGremlinGraph graph:$graph g:$g"
log.info "Carnival initializeGremlinGraph graph:$graph g:$g"
initializeGremlinGraph(graph, g, 'carnival')
}

Expand Down Expand Up @@ -195,7 +195,7 @@ abstract class CoreGraph implements GremlinTrait {

/** */
public void initializeDefinedVertices(Graph graph, GraphTraversalSource g, String packageName) {
log.info "CoreGraph initializeDefinedVertices graph:$graph g:$g packageName:$packageName"
log.info "Carnival initializeDefinedVertices graph:$graph g:$g packageName:$packageName"

assert graph
assert g
Expand Down Expand Up @@ -283,7 +283,7 @@ abstract class CoreGraph implements GremlinTrait {

/** */
public Collection<VertexConstraint> findNewVertexConstraints(String packageName) {
log.info "CoreGraph findNewVertexConstraints packageName:$packageName"
log.info "Carnival findNewVertexConstraints packageName:$packageName"
assert packageName

Set<Class<VertexDefinition>> vertexDefClasses = findVertexDefClases(packageName)
Expand Down Expand Up @@ -383,7 +383,7 @@ abstract class CoreGraph implements GremlinTrait {

/** */
public Collection<EdgeConstraint> findNewEdgeConstraints(String packageName) {
log.info "CoreGraph findNewEdgeConstraints packageName:$packageName"
log.info "Carnival findNewEdgeConstraints packageName:$packageName"
assert packageName

Set<Class<EdgeDefinition>> defClasses = findEdgeDefClases(packageName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import carnival.core.config.Defaults
/** */
@InheritConstructors
@Slf4j
class CoreGraphNeo4j extends CoreGraph {
class CarnivalNeo4j extends Carnival {

///////////////////////////////////////////////////////////////////////////
// STATIC
Expand All @@ -50,15 +50,15 @@ class CoreGraphNeo4j extends CoreGraph {
///////////////////////////////////////////////////////////////////////////

/** */
public static CoreGraphNeo4j create(Map args = [:]) {
public static CarnivalNeo4j create(Map args = [:]) {
def graph = openGremlinGraph()

def graphSchema
if (args.vertexBuilders) graphSchema = new DefaultGraphSchema(args.vertexBuilders)
else graphSchema = new DefaultGraphSchema()

def graphValidator = new DefaultGraphValidator()
def coreGraph = new CoreGraphNeo4j(graph, graphSchema, graphValidator)
def coreGraph = new CarnivalNeo4j(graph, graphSchema, graphValidator)

def g = graph.traversal()

Expand Down Expand Up @@ -129,7 +129,7 @@ class CoreGraphNeo4j extends CoreGraph {
*
*/
public initNeo4j(Graph graph, GraphTraversalSource g) {
log.trace "CoreGraphNeo4j initNeo4j"
log.trace "CarnivalNeo4j initNeo4j"

// create uniqueness constraints
withTransaction(graph) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ import carnival.core.config.Defaults
/** */
@InheritConstructors
@Slf4j
class CoreGraphTinker extends CoreGraph {
class CarnivalTinker extends Carnival {

///////////////////////////////////////////////////////////////////////////
// FACTORY
///////////////////////////////////////////////////////////////////////////

/** */
public static CoreGraphTinker create(Map args = [:]) {
log.info "CoreGraphTinker create args:$args"
public static CarnivalTinker create(Map args = [:]) {
log.info "CarnivalTinker create args:$args"

def graph = TinkerGraph.open()

Expand All @@ -49,7 +49,7 @@ class CoreGraphTinker extends CoreGraph {
else graphSchema = new DefaultGraphSchema()

def graphValidator = new DefaultGraphValidator()
def coreGraph = new CoreGraphTinker(graph, graphSchema, graphValidator)
def coreGraph = new CarnivalTinker(graph, graphSchema, graphValidator)

def g = graph.traversal()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import static org.apache.tinkerpop.gremlin.neo4j.process.traversal.LabelP.of


/** */
class CoreGraphUtils {
class CarnivalUtils {


///////////////////////////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import carnival.graph.PropertyDefinition
import carnival.graph.PropertyDefinition
import carnival.graph.EdgeDefinition
import carnival.core.graph.Core
import carnival.core.graph.CoreGraph
import carnival.core.graph.Carnival



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import static org.apache.tinkerpop.gremlin.neo4j.process.traversal.LabelP.of


/**
* gradle test --tests "carnival.core.graph.CoreGraphInitSpec"
* gradle test --tests "carnival.core.graph.CarnivalInitSpec"
*
*/
class CoreGraphInitSpec extends Specification {
class CarnivalInitSpec extends Specification {

///////////////////////////////////////////////////////////////////////////
// FIELDS
Expand Down Expand Up @@ -52,23 +52,23 @@ class CoreGraphInitSpec extends Specification {

def "test vertex def trait initizilation"() {
given:
CoreGraphNeo4j.clearGraph()
CarnivalNeo4j.clearGraph()
def classDef = Core.VX.DATA_TRANSFORMATION_PROCESS_CLASS

// we need to set to null because initialization machinery from
// previous tests may have (did) initi all vertex defs
classDef.vertex = null

when:
def graph = CoreGraphNeo4j.openGremlinGraph()
def graph = CarnivalNeo4j.openGremlinGraph()

then:
graph != null

when:
def graphSchema = new DefaultGraphSchema()
def graphValidator = new DefaultGraphValidator()
def coreGraph = new CoreGraphNeo4j(graph, graphSchema, graphValidator)
def coreGraph = new CarnivalNeo4j(graph, graphSchema, graphValidator)

then:
classDef.vertex == null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import test.coregraphspec.GraphModel


/**
* gradle test --tests "carnival.core.graph.CoreGraphInitializationSpec"
* gradle test --tests "carnival.core.graph.CarnivalInitializationSpec"
*
*/
class CoreGraphInitializationSpec extends Specification {
class CarnivalInitializationSpec extends Specification {

///////////////////////////////////////////////////////////////////////////
// DEFS
Expand Down Expand Up @@ -48,7 +48,7 @@ class CoreGraphInitializationSpec extends Specification {


def setup() {
coreGraph = CoreGraphTinker.create()
coreGraph = CarnivalTinker.create()
graph = coreGraph.graph
g = graph.traversal()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import carnival.core.config.Defaults


/**
* gradle test --tests "carnival.core.graph.CoreGraphNeo4jSpec"
* gradle test --tests "carnival.core.graph.CarnivalNeo4jSpec"
*
*/
class CoreGraphNeo4jSpec extends Specification {
class CarnivalNeo4jSpec extends Specification {

///////////////////////////////////////////////////////////////////////////
// DEFS
Expand Down Expand Up @@ -57,8 +57,8 @@ class CoreGraphNeo4jSpec extends Specification {
}

def setupSpec() {
CoreGraphNeo4j.clearGraph()
coreGraph = CoreGraphNeo4j.create(vertexBuilders:vertexBuilders)
CarnivalNeo4j.clearGraph()
coreGraph = CarnivalNeo4j.create(vertexBuilders:vertexBuilders)
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import carnival.graph.*


/**
* gradle test --tests "carnival.core.graph.CoreGraphSpec"
* gradle test --tests "carnival.core.graph.CarnivalSpec"
*
*/
class CoreGraphSpec extends Specification {
class CarnivalSpec extends Specification {

///////////////////////////////////////////////////////////////////////////
// DEFS
Expand Down Expand Up @@ -47,12 +47,12 @@ class CoreGraphSpec extends Specification {


def setup() {
coreGraph = CoreGraphTinker.create(vertexBuilders:vertexBuilders)
coreGraph = CarnivalTinker.create(vertexBuilders:vertexBuilders)
}

def setupSpec() {
//CoreGraphNeo4j.clearGraph()
//coreGraph = CoreGraphNeo4j.create(vertexBuilders:vertexBuilders)
//CarnivalNeo4j.clearGraph()
//coreGraph = CarnivalNeo4j.create(vertexBuilders:vertexBuilders)
}


Expand All @@ -73,15 +73,15 @@ class CoreGraphSpec extends Specification {
///////////////////////////////////////////////////////////////////////////

/**
* This will test graph initizilation once it's been moved to CoreGraph
* This will test graph initizilation once it's been moved to Carnival
*/
def "test graph creation"() {
when:
def graph = coreGraph.graph

println "===================="
println "initial graph"
CoreGraphUtils.printGraph(graph.traversal())
CarnivalUtils.printGraph(graph.traversal())
println "===================="

then:
Expand All @@ -96,7 +96,7 @@ class CoreGraphSpec extends Specification {
def vs = []
//println "graph: $graph"
//println "--------"
//CoreGraphUtils.printGraph(g)
//CarnivalUtils.printGraph(g)


//expect:
Expand Down Expand Up @@ -310,7 +310,7 @@ class CoreGraphSpec extends Specification {
Base.EX.IS_INSTANCE_OF.relate(g, id, idClass)

then:
CoreGraphUtils.printGraph(g)
CarnivalUtils.printGraph(g)
coreGraph.checkModel().size() == 0

when:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import static carnival.util.AppUtil.sysPropFalse
/**
*
*/
abstract class CoreGraphSpecification extends Specification {
abstract class CarnivalSpecification extends Specification {


///////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -44,8 +44,8 @@ abstract class CoreGraphSpecification extends Specification {

// create the graph
println "init neo4j graph..."
CoreGraphNeo4j.clearGraph()
coreGraph = CoreGraphNeo4j.create()
CarnivalNeo4j.clearGraph()
coreGraph = CarnivalNeo4j.create()
graph = coreGraph.graph

// validate the base graph
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ class DataSetDescriptorGraphSpec extends Specification {


def setupSpec() {
CoreGraphNeo4j.clearGraph()
appGraph = CoreGraphNeo4j.create(vertexBuilders:vertexBuilders)
CarnivalNeo4j.clearGraph()
appGraph = CarnivalNeo4j.create(vertexBuilders:vertexBuilders)
graph = appGraph.graph
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class GraphMethodCallSpec extends Specification {
def cleanupSpec() { }

def setup() {
coreGraph = CoreGraphTinker.create()
coreGraph = CarnivalTinker.create()
graph = coreGraph.graph
g = graph.traversal()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class GraphMethodDynamicSpec extends Specification {
def cleanupSpec() { }

def setup() {
coreGraph = CoreGraphTinker.create()
coreGraph = CarnivalTinker.create()
graph = coreGraph.graph
g = graph.traversal()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class GraphMethodProcessSpec extends Specification {
}

def setup() {
coreGraph = CoreGraphTinker.create()
coreGraph = CarnivalTinker.create()
graph = coreGraph.graph
g = graph.traversal()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public class GraphMethodSpec extends Specification {
def cleanupSpec() { }

def setup() {
coreGraph = CoreGraphTinker.create()
coreGraph = CarnivalTinker.create()
graph = coreGraph.graph
g = graph.traversal()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public class GraphMethodsSpec extends Specification {
def cleanupSpec() { }

def setup() {
coreGraph = CoreGraphTinker.create()
coreGraph = CarnivalTinker.create()
graph = coreGraph.graph
g = graph.traversal()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import carnival.graph.*


/**
* gradle test --tests "carnival.core.graph.CoreGraphGraphModelExtensionSpec"
* gradle test --tests "carnival.core.graph.GraphModelExtensionSpec"
*
*/
class CoreGraphGraphModelExtensionSpec extends Specification {
class GraphModelExtensionSpec extends Specification {

///////////////////////////////////////////////////////////////////////////
// FIELDS
Expand All @@ -43,8 +43,8 @@ class CoreGraphGraphModelExtensionSpec extends Specification {
}

def setupSpec() {
CoreGraphNeo4j.clearGraph()
coreGraph = CoreGraphNeo4j.create(vertexBuilders:vertexBuilders)
CarnivalNeo4j.clearGraph()
coreGraph = CarnivalNeo4j.create(vertexBuilders:vertexBuilders)
}


Expand Down
Loading

0 comments on commit fcc256f

Please sign in to comment.