示例#1
0
class Tweet(neomodel.StructuredNode):
    id_str = neomodel.StringProperty(unique_index=True, required=True)
    created_at = neomodel.DateTimeProperty(required=False)
    modified = neomodel.DateTimeProperty(required=False)
    retweeted = neomodel.BooleanProperty(required=False)
    retweet_id_str = neomodel.StringProperty(required=False, default='')
    reply_id_str = neomodel.StringProperty(required=False, default='')
    quote_id_str = neomodel.StringProperty(required=False, default='')
    mention_ids_str = neomodel.ArrayProperty(required=False, default=[])
    text = neomodel.StringProperty(required=False)
    coordinates = neomodel.ArrayProperty(required=False, default=[])
    lang = neomodel.StringProperty(required=False)
    features = neomodel.JSONProperty(required=False, default={})
    sentiment_polarity = neomodel.FloatProperty(required=False)
    sentiment_subjectivity = neomodel.FloatProperty(required=False)

    retweets = neomodel.RelationshipTo('Tweet', 'RETWEETS')
    mentions = neomodel.RelationshipTo('User', 'MENTIONS')
    replies = neomodel.RelationshipTo('Tweet', 'REPLIES')
    tags = neomodel.RelationshipTo('Hashtag', 'TAGS')
    contains = neomodel.RelationshipTo('Link', 'CONTAINS')
    quotes = neomodel.Relationship('Tweet', 'QUOTES')
    tweet_about = neomodel.RelationshipTo('Company', 'TWEETS')

    def save(self):
        self.modified = datetime.datetime.now()
        super(Tweet, self).save()
        return self
示例#2
0
class Relation(neomodel.StructuredRel, EveCompatibilityMixin):
    """
    Node model for relations in the graph.
    """
    label = neomodel.StringProperty(
    )  # Text that should be displayed about this edge
    data = neomodel.JSONProperty(
    )  # Dictionary with more detailed data about this relation
    weight = neomodel.IntegerProperty(default=1)
示例#3
0
class Entity(neomodel.StructuredNode, EveCompatibilityMixin):
    """
    Node model for entities in the graph.
    """
    uid = neomodel.UniqueIdProperty()  # Unique ID for this database entry
    category = neomodel.StringProperty(
    )  # Category of this entity (Person, Organization...)
    label = neomodel.StringProperty(
    )  # Text that should be displayed about this node
    data = neomodel.JSONProperty(
    )  # Dictionary with more detailed data about this entity
    relations = neomodel.Relationship("Entity",
                                      "CONNECTED_WITH",
                                      model=Relation)
    weight = neomodel.IntegerProperty(default=1)
示例#4
0
class BaseEntity(neomodel.StructuredNode):
    name = neomodel.StringProperty(unique_index=True)
    variants = neomodel.JSONProperty()
    best_variant = neomodel.StringProperty()
    count = neomodel.IntegerProperty(default=1)
    weight = neomodel.FloatProperty(default=0)
    create_at = neomodel.DateTimeFormatProperty(format=DATETIME_FORMAT, default_now=True)

    # GOD attributes: relation from head (self) to Tail (other)
    used_for = neomodel.RelationshipTo(neomodel.StructuredNode, 'used_for', model=UsedFor)
    part_of = neomodel.RelationshipTo(neomodel.StructuredNode, 'part_of', model=PartOf)
    feature_of = neomodel.RelationshipTo(neomodel.StructuredNode, 'feature_of', model=FeatureOf)
    compare = neomodel.RelationshipTo(neomodel.StructuredNode, 'compare', model=Compare)
    hyponym_of = neomodel.RelationshipTo(neomodel.StructuredNode, 'hyponym_of', model=HyponymOf)
    evaluate_for = neomodel.RelationshipTo(neomodel.StructuredNode, 'evaluate_for', model=EvaluateFor)
    refer_to = neomodel.RelationshipTo(neomodel.StructuredNode, 'refer_to', model=ReferTo)
    appear_in = neomodel.RelationshipTo(neomodel.StructuredNode, 'appear_in', model=AppearIn)
    author_of = neomodel.RelationshipTo(neomodel.StructuredNode, 'author_of', model=AuthorOf)
    affiliate_with = neomodel.RelationshipTo(neomodel.StructuredNode, 'affiliate_with', model=AffiliateWith)
    cite = neomodel.RelationshipTo(neomodel.StructuredNode, 'cite', model=Cite)
    related_to = neomodel.RelationshipTo(neomodel.StructuredNode, 'related_to', model=RelatedTo)
示例#5
0
class Card(nm.StructuredNode, BaseModel):
    name = nm.StringProperty(unique_index=True)
    attributes = nm.JSONProperty()

    pk_field = 'name'
示例#6
0
class Card(nm.StructuredNode):
    name = nm.StringProperty(unique_index=True)
    attributes = nm.JSONProperty()