Пример #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 AnotherLocalisableEntity(neomodel.StructuredNode):
     """
     A very simple entity with an array of locations
     """
     identifier = neomodel.UniqueIdProperty()
     locations = neomodel.ArrayProperty(
         neomodel.contrib.spatial_properties.PointProperty(crs='cartesian'))
Пример #3
0
class News(neomodel.StructuredNode):
    headline = neomodel.StringProperty(unique_index=True, required=True)
    url = neomodel.StringProperty(required=False)
    publisher = neomodel.StringProperty(required=False)
    created_at = neomodel.DateTimeProperty(required=False)
    keywords = neomodel.ArrayProperty(neomodel.StringProperty(),
                                      required=False)
    score = neomodel.FloatProperty(required=False)

    cites = neomodel.RelationshipTo('Company', 'CITES')
Пример #4
0
class PipelineRunInfo(neomodel.StructuredNode):
    """
    Define a model for pipeline run information.
    """
    uid = neomodel.UniqueIdProperty()  # Unique ID for this database entry
    run_id = neomodel.StringProperty(
    )  # ID for this pipeline run, created with sentence IDs involved in this run
    timestamp = neomodel.StringProperty(
    )  # Timestamp for the current pipeline run
    article_ids = neomodel.ArrayProperty(
    )  # List of sentence IDs involved in this pipeline run
Пример #5
0
class User(neomodel.StructuredNode):
    id_str = neomodel.StringProperty(unique_index=True, required=True)
    name = neomodel.StringProperty(required=False)
    screen_name = neomodel.StringProperty(required=False)
    followers_count = neomodel.IntegerProperty(required=False)
    friends_count = neomodel.IntegerProperty(required=False)
    modified = neomodel.DateTimeProperty(required=False)
    created_at = neomodel.DateTimeProperty(required=False)
    description = neomodel.StringProperty(required=False)
    location = neomodel.StringProperty(required=False)
    coordinates = neomodel.ArrayProperty(required=False, default=[])
    time_zone = neomodel.StringProperty(required=False)
    url = neomodel.StringProperty(required=False)
    lang = neomodel.StringProperty(required=False)

    follows = neomodel.RelationshipTo('User', 'FOLLOWS')
    posts = neomodel.RelationshipTo('Tweet', 'POSTS')

    def save(self):
        self.modified = datetime.datetime.now()
        super(User, self).save()
Пример #6
0
class Deck(nm.StructuredNode):
    name = nm.StringProperty(unique_index=True)
    cards = nm.RelationshipTo('Card', 'CARD')
    owner = nm.RelationshipFrom('User', 'USER', cardinality=nm.One)
    attributes = nm.ArrayProperty()
Пример #7
0
class BaseRelation(neomodel.StructuredRel):
    count = neomodel.IntegerProperty(default=1)
    weight = neomodel.FloatProperty(default=0)
    create_at = neomodel.DateTimeFormatProperty(format=DATETIME_FORMAT, default_now=True)
    flag_violation = neomodel.BooleanProperty(default=False)
    from_papers = neomodel.ArrayProperty(neomodel.IntegerProperty(), default=[])
Пример #8
0
class Deck(nm.StructuredNode):
    name = nm.StringProperty(unique_index=True)
    cards = nm.RelationshipTo('Card', 'CARD')
    attributes = nm.ArrayProperty()

    pk_field = 'name'