bio4j / dynamograph

GSoC 2014 project - a DynamoDB based graph DB
GNU Affero General Public License v3.0
4 stars 1 forks source link

Reusing Attributes from VertexType #46

Open alberskib opened 10 years ago

alberskib commented 10 years ago

@bio4j/dynamograph After investiagtion it looks like it is more difficult than I thought to reuse those attributes. Solution that comes to my mind is to create special VertexItem for vertexType which will be similar to item from tabula but it will not take Table as input argument. Aditionally to this change Tabula item should be modified in order to take table and VertexItem as constructor arguments.

eparejatobes commented 10 years ago

hey @alberskib what kind of problems did you encounter? could you push or write something?

alberskib commented 10 years ago

Problem is similar to one that we have with edges. In next hour I will push sth because now I must go out.

alberskib commented 10 years ago

Sorry for long waiting but I think that I am closer to proper solution than I was when I create this issue. Now I should convert Map[String, AttributeValue] to the specific item and everything will work correctly. Pushed change is not reusing attributes from scarph model but solve almost all problems that stop me form doing this.

laughedelic commented 10 years ago

About this conversion, it's already done in tabula. https://github.com/ohnosequences/tabula/blob/master/src/main/scala/tabula/impl/ImplicitConversions.scala#L13

alberskib commented 10 years ago

Unfortunatelly there is still problem that for me is hard to solve: Can't map ohnosequences.tabula.impl.ImplicitConversions.fromSDKRep.type over As (maybe the resulting types are not distinct)

eparejatobes commented 10 years ago

code? where?

alberskib commented 10 years ago

@bio4j/dynamograph Hello

Sorry for constantly asking you for help but I try several things and none of them are worked properly (I spent too much time on it). I will appreciate any clues or general idea how to solve next problems:

Can't prove that P ∈ AnyDynamoVertex.this.tpe.record.Properties
[error]       def apply(rep: dynamoVertex.Rep): p.Raw = rep.get(p)
[error]                                                        ^
/src/main/scala/com/bio4j/dynamograph/AnyDynamoVertex.scala:28: Can't prove that com.bio4j.dynamograph.model.GeneralSchema.id.type ∈ AnyDynamoVertex.this.tpe.record.Properties
[error]       val it = dao.getOutRelationships(rep.get(id), e).asInstanceOf[List[e.Rep]]
scala/com/bio4j/dynamograph/mapper/GoMapper.scala:26: type mismatch;
[error]  found   : Int
[error]  required: a.Value
[error]     (which expands to)  a.Raw
[error]  Note: implicit method caseN is not applicable here because it comes after the application point and it lacks an explicit result type
[error]       at[A]( a => (a is vertexAttrs(a.label).toInt): A#Rep )

and

/src/main/scala/com/bio4j/dynamograph/writer/VertexWriter.scala:28: could not find implicit value for parameter transf: ohnosequences.typesets.FromProperties[V#Record#Properties,scala.collection.immutable.Map[String,com.amazonaws.services.dynamodbv2.model.AttributeValue]]{type Reps = _1502.i.record.Raw}
[error]       ThroughputStatus(1, 1))) putItem vertexTable.vertexItem withValue (vertexTable.vertexItem ->> rep))
[error]                                                               ^
alberskib commented 10 years ago

Ok, now I am closer to the solution, but I still face last error.

eparejatobes commented 10 years ago

Hey @alberskib I was out this weekend. I'm reviewing everything here, I think it'll take one hour or two.

alberskib commented 10 years ago

Hey @eparejatobes. Did you find time to take a look?

eparejatobes commented 10 years ago

I'm on it, it involves fixing a lot of signatures and stuff, it's taking a bit more than I expected :)

don't push to this branch in the meantime, I'm close to finishing it

alberskib commented 10 years ago

Ok. Thanks for help :)

eparejatobes commented 10 years ago

hey @alberskib mostly done for vertices; but once you see the pattern is really easy to do for edges. I know this is pretty tricky but once it is finished we will have a pretty nice generic DynamoDB graph db :)

alberskib commented 10 years ago

@eparejatobes Great. I will take a look and try to write the same thing for edges. One more time sorry for constantly asking for help.

eparejatobes commented 10 years ago

No problem, all of this is actually pretty tricky, there's a lot of compiler bugs etc. I'll work on making things easier tomorrow afternoon in scarph and tabula.

alberskib commented 10 years ago

Hey @eparejatobes. How things are going with scarph and tabula?

alberskib commented 10 years ago

Hey @bio4j/dynamograph What do you think about Either for error handling? ie:

def read(identifier : vertexTable.VertexId#Value) : Either[String,Item#Record#Rep] = {
 val getResult = ServiceProvider.service please (FromHashKeyTable(table, Active (
      table,
      ServiceProvider.service.account,
      ThroughputStatus(1, 1)
    )) getItem item withKeys (identifier))
    getResult.output match {
      case success: GetItemSuccess[Item] => Right(record ->> success.item)
      case failure : GetItemFailure[Item] => Left(failure.msg)
    }
alberskib commented 10 years ago

Hey @eparejatobes Any progress?

eparejatobes commented 10 years ago

yes, I want to discuss with you tomorrow the final shape of this. the sooner the better, when are you free tomorrow?

alberskib commented 10 years ago

Hm 7 am 8am eventually 9 am? or you prefer 2pm?

eparejatobes commented 10 years ago

14:00 is fine, maybe I can find the time to do some stuff in scarph and tabula before. Take a look at #48 and see you tomorrow :+1:

laughedelic commented 10 years ago

I'll try to join you guys, maybe I won't be very useful, but I'll try to catch up what's going on ")