Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Methods that take vertex names should also take VertexNameSpec #82

Closed
moaxcp opened this issue Jun 24, 2017 · 0 comments
Closed

Methods that take vertex names should also take VertexNameSpec #82

moaxcp opened this issue Jun 24, 2017 · 0 comments
Projects

Comments

@moaxcp
Copy link
Owner

moaxcp commented Jun 24, 2017

VertexNameSpec

A new object that simply defines the name of a Vertex. Graph.propertyMissing should be changed to return VertexNameSpec instead of VertexSpec. This will eliminate the need for single quotes around vertex names within the dsl.

Examples

rename methods in edge closure

graph {
    edge(A, B) {
        renameOne 'C'
    }
}

Could be changed to:

graph {
    edge(A, B) {
        renameOne C
    }
}

'C' could be replaced with C. Since C is not a property of Graph propertyMissing will be called and return a new VertexNameSpec.

connectsTo and connectsFrom

graph {
    vertex A {
        connectsTo 'C'
        connectsFrom 'B'
    }
}

could become

graph {
    vertex A {
        connectsTo C
        connectsFrom B
    }
}

root in traversal methods

graph {
    breadthFirstTraversal {
        root = 'A'
        visit { vertex ->
            println "bft $vertex.name"
        }
    }
}

could become

graph {
    breadthFirstTraversal {
        root A
        visit { vertex ->
            println "bft $vertex.name"
        }
    }
}

Strings

Strings will still need to be supported for method calls and properties outside of the dsl. For example BreadthFirstTraversal has the property root. This is a String and will remain a String. A new method should be added to support setting that property using a VertexNameSpec.

apply VertexNameSpec to the Graph

Any VertexNameSpec passed to these methods need to be treated as a normal VertexSpec. This means they need to be applied to the graph not just used as a reference to a Vertex.

connectsTo and connectsFrom should accept a VertexSpec

This will allow more nested strucures when defining a graph.

graph {
    vertex A {
        connectsTo B {
            connectsTo C {
                 connectsTo D
            }
        }
    }
}

update readme

All examples in the readme that use the graph {...} entry point should use this feature.

@moaxcp moaxcp added this to To Do in 1.0 Jun 24, 2017
@moaxcp moaxcp moved this from To Do to Feature in 1.0 Jun 30, 2017
@moaxcp moaxcp changed the title Methods that take vertex names should also take VertexSpec Methods that take vertex names should also take VertexNameSpec Jun 30, 2017
moaxcp added a commit that referenced this issue Jul 4, 2017
…NameSpec and VertexSpec. Added new test package for testing just the dsl (anything inside graph {...} or using Graph.with {...}).
@moaxcp moaxcp moved this from Feature to Develop in 1.0 Jul 5, 2017
@moaxcp moaxcp moved this from Develop to Release in 1.0 Jul 22, 2017
moaxcp added a commit that referenced this issue Jul 22, 2017
* [#82](#82) Methods that take vertex names should also take VertexNameSpec
* [#84](#84) Configure gradle to fail for codenarc violations and jacoc verification
* [#87](#87) TraversalSpec should return VertexNameSpec when property or method is missing
* [#85](#85) Traversal methods should accept a root param
@moaxcp moaxcp closed this as completed Aug 4, 2017
@moaxcp moaxcp moved this from Release to Done in 1.0 Aug 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
1.0
Done
Development

No branches or pull requests

1 participant