Closed alberskib closed 10 years ago
There is one more thing:
I'll try to answer, but I may be wrong on imprecise in something (so maybe @eparejatobes will add something). And don't worry if you don't understand some code — it's really non-trivial, so it's normal to ask questions.
About your first question: as you see in the following part of code (in the same file that you refer), we add such methods to edge.Rep
:
def source[S <: Singleton with AnyVertex.ofType[Tpe#SourceType]](implicit getter: GetSource[S]) = getter(edgeRep)
so we want those GetSource
things to be implicit objects. The point is that it gives us flexibility, because these part of implementation are detached from each other:
and it can be defined there, or in any other place. The only requirement is that it should be in scope when you want to use it.
Same applies to retrieving properties and ingoing/outgoing edges for a vertex. For an example of external creation of a target getter see this test.
P.S. I've just published it (0.1.0-SNAPSHOT
)
so we want those GetSource things to be implicit objects
As far as I know you can also create an implicit function which will work similarly
implicit def sourceType2sourceRep( ...
Could you extend this piece of code? So far I don't see what you mean.
About denotation thing.
I mean why it is important
Well, it's just a generalization which appeared while we were refactoring the code.
First, as it's said in the comments:
This trait represents a mapping between
- members
Tpe
of a universe of typesTYPE
and
Raw
a type meant to be a denotation ofTpe
thus the nameTagging is used for being able to operate on
Raw
values knowing what they are denotating.
(by the way, the actual comment mixes Rep
and Raw
(Rep
is just a tagged Raw
)).
So for example:
on the abstract level we say that a vertex denotes some vertex type:
trait AnyVertex extends Denotation[AnyVertexType] ...
this binds the TYPE
type member (think of it just as a type bound for Tpe
, which will be a particular vertex type)
on the implementation level, we say
trait AnyTVertex extends AnyVertex { ...
type Raw = com.thinkaurelius.titan.core.TitanVertex
...
so it binds the Raw
type member, meaning, that we want to represent vertices by the TitanVertex
type.
case object Titan extends VertexType("titan")
(in godsSchema)case object titan extends TVertex(Titan)
(in godsImplementation)
(I'm not sure which terminology to use here)So with all these layers you can see, that with vertex types we can define the graph schema abstractly (godSchema), and then "implement" it (godsImplementation), defining vertices which denote those vertex types with a particular implementation (Raw = TitanVertex
).
The reason why we want to have this "double" types structure, is that we want to deal with a universe of types (i.e. a defined limited set of them), and operate on them as on values, which would be impossible otherwise.
P.S. I hope I understood your questions right. If not, ask again. And I hope @eparejatobes will say something too ")
I have intermittent access to internet, anyway I'll try to answer briefly
So with all these layers you can see, that with vertex types we can define the graph schema abstractly (godSchema), and then "implement" it (godsImplementation), defining vertices which denote those vertex types with a particular implementation (Raw = TitanVertex).
The reason why we want to have this "double" types structure, is that we want to deal with a universe of types (i.e. a defined limited set of them), and operate on them as on values, which would be impossible otherwise.
Thanks a lot. I think that more or less I understand it - now it is easier for me to use it (but still it is good idea to discuss about it).
I'm glad that it helps. In general, I recommend you to start from examples in tests to see how things are used and from there look up how those things are defined.
ok. fine for me
Unfortunately I cannot take part at suggested time tommorow or day after (11AM - 5PM US EST is ok). Alternatively wednesday at 7:00 AM US EST is ok for me.
@bio4j/dynamograph closing?
@bio4j/dynamograph I have some questions regarding scarph. Answers for those questions enables me understanding it, so please be patient in case of any stupid questions.
and they are used later as an implicits. Is there any special reason why their are created instead of functions? I mean why to use functional objects instead of functions.