-
Notifications
You must be signed in to change notification settings - Fork 2
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
Don't use properties through the element values #62
Conversation
…be unique and can take advantage of the lambda syntax for fromRaw override
@eparejatobes please, take a look 🙏 After all my suffering in #58 and #60 and experimenting with things in #61 and some other branches that don't worth to be pushed here, I can say that what I have here is the best option I can get (again, I was trying really hard, you know 😐). Using inner classes as in #58 doesn't help to simplify the API and it has a major disadvantage: it's hard to override methods in them. I'm even not sure if it's possible to do in any reasonable way, because if you subclass and have a more precise Therefore I think it's better to use inner classes only on the level of the schema definition (i.e. Putting all things in one file doesn't help anything, see #60 (comment). So, what we have here:
If you are fine with this approach, I will cherry-pick good things from #58, especially the auto-schema-related stuff from #59. We can already try this with some Bio4j graph. The Titan implementation should work (modulo the schema creation). UPD: currently angulillos-titan compiles without any changes. |
…kage to see what needs to be public
@laughedelic I'm going to look at this tonight/tomorrow morning. |
…ormity than ever; now you vertex/edge/property have to have their own type and a corresponding val; properties are declared in the vertex/edge types
…m/bio4j/angulillos into experiment/properties-in-elements
…duplicate elements check
…nsaction-related methods
What I'm working on here:
|
* Added no-parameters Any-traits for all type-interfaces * Implemented automatic graph schema creation method
|
…m/bio4j/angulillos into experiment/properties-in-elements
I'm merging and releasing it as v0.7.0 |
* A lot of general code refactoring (most of it in #62): - Setters return the subject for chaining calls - Added arity-specific methods in/out-E/V methods with default implementations - Moved all the methods from TypedGraph to the elements interfaces - Split Arity on two: From/To; Added FromArity to Property - Added Unique and NonUnique Property types to fix the arity - Added vertex/edge types list to the typed graph and properties list to each typed element - Added UntypedGraphSchema interface for automatic schema creation * See also #46, #51
I've already started some changes in master accidentally. Starting from what we had before the #58:
Vertex
andVertexType
:User
as a uniqueVertexType
and then have its "value type" asVertex<User>
Vertex
(because we are going to refer to this as a type) and also have a value reference to itsVertexType
which only needs to have afromRaw
factory method returning a value of thatUser
typeVertexType
is that we would normally store properties in it and refer to them asg.user.name
,g.posted.date
.We can add properties as the members of the
User
value-type and add setter/getter methods, then the syntax for working with them would change fromto
which doesn't look too bad and is more concise than the old one. Btw, I've tried to make them instances of
Supplier<X>
(for the.get()
method) andFunction<V,X>
(for.apply()
) hoping that it will allow for syntax likebob.name("Bob")
instead ofbob.name.apply("Bob")
, but it seems that Java doesn't have any shortcuts "( 👎The schema definition becomes much more clear than before and almost doesn't have boilerplate code:
No any significant changes to the inner code needed. Only the
GraphSchema
class.