class Info(StructuredNode): # ---- attributi info_id = StringProperty(UniqueIndex=True, Required=True) END = IntegerProperty() ID = StringProperty() QUAL = FloatProperty() FILTER = StringProperty() FORMAT = StringProperty() HETEROZIGOSITY = FloatProperty() dbSNP = StringProperty() DP = FloatProperty() Gene_refGene = ArrayProperty() Func_refGene = ArrayProperty() QD = FloatProperty() SIFT_score = FloatProperty() otg_all = FloatProperty() NM = IntegerProperty() LM = ArrayProperty() FS = FloatProperty() MQ0 = FloatProperty() attributes = JSONProperty() # ---- relazioni contains = RelationshipFrom('File', 'Contains') supportedBy = RelationshipTo('Genotype', 'Supported_By', model=SupportedByRel) forVariant = RelationshipTo('Variant', 'For_Variant')
class PatientNode(BaseNode): primary_id = StringProperty(unique_index=True, required=True) genes = ArrayProperty(StringProperty()) # should this be a relationship? hpos = ArrayProperty(StringProperty()) has_phenotypes = Relationship('HPONode', 'HAS_PHENOTYPES', model=Patient_HPO_Edge)
class Hotel(StructuredNode): uid = UniqueIdProperty() name = StringProperty(max_length=120, required=True) price = IntegerProperty(required=True) description = StringProperty(max_length=4096, required=True) photos = ArrayProperty(required=True, base_property=StringProperty()) address = StringProperty(max_length=512, required=True) locality = StringProperty(required=True) postal_code = IntegerProperty(required=True) latitude = FloatProperty(required=True) longitude = FloatProperty(required=True) phone = RegexProperty(expression=r"^\+(\d){12}$", required=True) amenities = ArrayProperty(base_property=StringProperty(choices=HOTEL_AMENITIES)) located_in = RelationshipTo( "City", "LOCATED_IN", model=OwnsRel, cardinality=cardinality.One ) owned_by = RelationshipFrom("HotelOwner", "OWNS_HOTEL", model=OwnsRel) liked_by = RelationshipFrom("Traveller", "LIKES_HOTEL", model=LikesRel) has_booking = RelationshipFrom("HotelBooking", "FOR_HOTEL", model=OwnsRel) reviewed_by = RelationshipFrom("Traveller", "REVIEWED_HOTEL", model=ReviewedRel) stayed_by = RelationshipFrom("Traveller", "STAYED_AT_HOTEL", model=StayedAtRel)
class Symptom(StructuredNode): # name = UniqueIdProperty() name = StringProperty(unique_index=True, required=True) ar_name = StringProperty() description = StringProperty() ar_description = StringProperty() synonyms = ArrayProperty() ar_synonyns = ArrayProperty()
class Edge(StructuredRel): edge_label = StringProperty(required=True) relation = StringProperty() is_defined_by = StringProperty(required=True) provided_by = StringProperty(required=True) publications = ArrayProperty(StringProperty()) evidence_type = StringProperty() qualifiers = ArrayProperty(StringProperty()) negated = StringProperty()
class LicenseModel(StructuredNode): labels = ArrayProperty() permissions = ArrayProperty(index=True) obligations = ArrayProperty(index=True) prohibitions = ArrayProperty(index=True) hashed_sets = StringProperty(unique_index=True) followings = RelationshipTo("LicenseModel", "Compatible") precedings = RelationshipFrom("LicenseModel", "Compatible") datasets = RelationshipTo("DatasetModel", "Protects")
class StepModel(StructuredNode): name = StringProperty(required=True) description = StringProperty() is_optional = BooleanProperty(default=False) expected_effort_num = FloatProperty() expected_effort_unit = StringProperty(choices=TIME_UNITS) deadline = DateTimeProperty() pos_x = FloatProperty() pos_y = FloatProperty() assignees = ArrayProperty(StringProperty(), default=[]) reviewers = ArrayProperty(StringProperty(), default=[]) node_type = StringProperty(default=NODE_TYPE.NORMAL, choices=NODE_TYPES) task = RelationshipFrom('task.models.task.TaskInst', 'HasStep', model=HasStep)
class Recipe(StructuredNode): name = StringProperty() index = IntegerProperty() method = ArrayProperty() image_path = StringProperty() image_url = StringProperty() description = StringProperty() category = StringProperty() ingredients = ArrayProperty() cook_time = StringProperty() tags = ArrayProperty() ingredient = RelationshipTo('Ingredient', 'CHILD')
class NewsArticle(TitledContent): """ Missions are what a Quest is currently focused on doing. They encompass what it is trying to achieve whether it be running for office or advocating for something. A mission allows a Quest to take donations and for other Quests to endorse another Quest's missions. """ # The source from which we received the article. Valid Options are: # sb_crawler # webhose # alchemyapi provider = StringProperty(default="webhose") external_id = StringProperty(unique_index=True) url = StringProperty(index=True) summary = StringProperty() site_full = StringProperty() site = StringProperty() site_section = StringProperty() section_title = StringProperty() title = StringProperty(index=True) title_full = StringProperty() highlight_title = StringProperty() highlight_text = StringProperty() # Language that the article is in. Valid Options: # english language = StringProperty() published = DateTimeProperty() replies_count = IntegerProperty() participants_count = IntegerProperty() # What type of site is this? Valid Options: # blogs # news # forum # comments site_type = StringProperty() country = StringProperty() spam_score = FloatProperty() image = StringProperty() # Scale of 0-10, 0 being the worst and 10 being the best performance_score = IntegerProperty() crawled = DateTimeProperty() # Optimization external_links = ArrayProperty() persons = ArrayProperty() locations = ArrayProperty() organizations = ArrayProperty() author = StringProperty() images = RelationshipTo('sb_uploads.neo_models.UploadedObject', 'IMAGE_ON_PAGE')
class model(StructuredNode, grest.models.Node): GREEK = (("A", "Alpha"), ("B", "Beta"), ("G", "Gamma")) uuid = UniqueIdProperty() string = StringProperty(required=True) choices = StringProperty(choices=GREEK) integer = IntegerProperty() json = JSONProperty() array_of_string = ArrayProperty(StringProperty()) raw_data = ArrayProperty() date = DateProperty() datetime = DateTimeProperty() boolean = BooleanProperty() email = EmailProperty()
class Author(StructuredNode, NodeUtils): # Author properties and relationships authorID = StringProperty(index=True) authorName = StringProperty() coAuthors = ArrayProperty() publication = RelationshipFrom('.publication.Publication', 'AUTHORED_BY') coAuthorRel = RelationshipTo('.author.Author', 'CO_AUTHOR') # Properites of relationshi @property def serialize(self): return { 'node_properties': { 'authorID': self.authorID, 'authorName': self.authorName, 'coAuthors': self.coAuthors }, } # Relationships of Author node @property def serialize_connections(self): return [ { 'nodes_type': 'Publication', 'nodes_related': self.serialize_relationships(self.publication.all()), }, { 'nodes_type': 'Author', 'nodes_related': self.serialize_relationships(self.author.all()), }, ]
class Package(StructuredNode): uid = UniqueIdProperty() name = StringProperty(max_length=512, required=True) price = IntegerProperty(required=True) description = StringProperty(max_length=4096, required=True) photos = ArrayProperty(base_property=StringProperty()) amenities = ArrayProperty(base_property=StringProperty(choices=PACKAGE_AMENITIES)) has_day = RelationshipTo("PackageDay", "HAS_DAY", model=PackageDayRel) offered_by = RelationshipFrom("Agency", "OFFERS_PACKAGE", model=OwnsRel) has_booking = RelationshipFrom("PackageBooking", "FOR_HOTEL", model=OwnsRel) liked_by = RelationshipFrom("Traveller", "LIKES_PACKAGE", model=LikesRel) booked_by = RelationshipFrom("Traveller", "BOOKED_PACKAGE", model=BookedRel) reviewed_by = RelationshipFrom("Traveller", "REVIEWED_PACKAGE", model=ReviewedRel)
class Advisory(EstuaryStructuredNode): """Definition of an Errata advisory in Neo4j.""" actual_ship_date = DateTimeProperty() advisory_name = StringProperty(unique=True) content_types = ArrayProperty() created_at = DateTimeProperty() id_ = UniqueIdProperty(db_property='id') issue_date = DateTimeProperty() product_name = StringProperty() product_short_name = StringProperty() release_date = DateTimeProperty() security_impact = StringProperty() security_sla = DateTimeProperty() state = StringProperty() status_time = DateTimeProperty() synopsis = StringProperty() type_ = StringProperty(db_property='type') update_date = DateTimeProperty() updated_at = DateTimeProperty() assigned_to = RelationshipTo('.user.User', 'ASSIGNED_TO', cardinality=ZeroOrOne) attached_bugs = RelationshipTo('.bugzilla.BugzillaBug', 'ATTACHED') attached_builds = RelationshipTo('.koji.KojiBuild', 'ATTACHED') package_owner = RelationshipTo('.user.User', 'PACKAGE_OWNED_BY', cardinality=ZeroOrOne) reporter = RelationshipTo('.user.User', 'REPORTED_BY', cardinality=ZeroOrOne) states = RelationshipFrom('AdvisoryState', 'STATE_OF') triggered_freshmaker_event = RelationshipFrom( '.freshmaker.FreshmakerEvent', 'TRIGGERED_BY')
class Gene(StructuredNode): uid = UniqueIdProperty() name = StringProperty(required=True) synonyms = ArrayProperty() source_id = StringProperty(required=True) gene_type = StringProperty() organism = StringProperty(required=True)
class Question(StructuredNode): nodeId = UniqueIdProperty() slug = StringProperty(unique_index=True) language = StringProperty(required=True, choices={ 'en': 'English', 'fr': 'French' } ) question = StringProperty(unique_index=True) addedOn = DateTimeProperty(default_now=True) options = ArrayProperty(base_property= StringProperty()) type = StringProperty( choices={ 'text': 'text', 'mcq': 'mcq', 'dropdown': 'dropdown' } ) related_questions = Relationship( 'Question', 'RELATED_QUESTION', model= Question_Question_Rel ) preQuestions = RelationshipFrom( 'PreQuestion', 'PREQUESTION_QUESTION' ) surveyVersions = RelationshipFrom( ".survey_model.SurveyVersion", "SURVEY_QUESTION" )
class Band(StructuredNode): emid = IntegerProperty(unique_index=True) link = StringProperty() visited = DateProperty() name = StringProperty() country = StringProperty(choices=COUNTRY_NAMES) locations = ArrayProperty() status = StringProperty(choices=BAND_STATUS) formed = DateProperty() active = ArrayProperty(DateProperty()) themes = ArrayProperty() # Should a theme be a node? genres = ArrayProperty() current_lineup = RelationshipFrom("Member", "PLAYED_IN", model=MemberRelationship) releases = RelationshipTo('Release', 'RECORDED')
class Bookmark(StructuredNode): title = StringProperty(unique_index=True) url = StringProperty(required=True) add_date = DateTimeProperty(default_now=True) icon = StringProperty() icon_uri = StringProperty() tags = ArrayProperty(StringProperty()) bookmark = RelationshipTo(Folder, 'BOOKMARK')
class Video(Media): __typename = "GraphVideo" is_video = True product_type = StringProperty() duration = FloatProperty() view_count = IntegerProperty() urls = ArrayProperty() title = StringProperty()
class Sidecar(Media): __typename = "GraphSidecar" # Carousel/Album children = RelationshipTo("Media", "HAS", model=SidecarRel, cardinality=OneOrMore) children_count = IntegerProperty(default=0) urls = ArrayProperty()
class MemberRelationship(StructuredRel): # TODO: Try to use multiple connections for each stint. time_frame = ArrayProperty() # start_date = DateProperty() # end_date = DateProperty() pseudonym = StringProperty() instrument = StringProperty() status = StringProperty(choices=MEMBER_STATUS)
class Node(StructuredNode): curie = StringProperty(required=True, db_property='id') uri = StringProperty(db_property='uri') name = StringProperty(required=True) category = ArrayProperty(required=True) description = StringProperty(db_property='description') symbol = StringProperty() edges = RelationshipTo('Node', 'EDGE', model=Edge)
class Component(StructuredNode): name = StringProperty(unique_index=True, required=True) componentType = StringProperty() version = StringProperty() metaData = JSONProperty() spec = JSONProperty() alarms = ArrayProperty() cloudType = StringProperty(default="Kubernetes")
class Package(Product): pizzas = ArrayProperty(StringProperty()) complements = ArrayProperty(StringProperty()) drinks = ArrayProperty(StringProperty()) sauces = ArrayProperty(StringProperty()) rel_pizza = RelationshipTo('Pizza', 'HAS', model=Has) rel_complement = RelationshipTo('Complement', 'HAS', model=Has) rel_drink = RelationshipTo('Drink', 'HAS', model=Has) rel_sauce = RelationshipTo('Sauce', 'HAS', model=Has) # noinspection PyTypeChecker @metrics_query_latency.time() @metrics_query_in_progress.track_inprogress() def json(self): rows_pizzas, col_names = self.cypher( "MATCH (pkg) WHERE id(pkg)={self} MATCH (pkg)-[r:HAS]->(product:Pizza) RETURN product.name, r.units" ) rows_comps, col_names = self.cypher( "MATCH (pkg) WHERE id(pkg)={self} MATCH (pkg)-[r:HAS]->(product:Complement) RETURN product.name, r.units" ) rows_drinks, col_names = self.cypher( "MATCH (pkg) WHERE id(pkg)={self} MATCH (pkg)-[r:HAS]->(product:Drink) RETURN product.name, r.units" ) rows_sauces, col_names = self.cypher( "MATCH (pkg) WHERE id(pkg)={self} MATCH (pkg)-[r:HAS]->(product:Sauce) RETURN product.name, r.units" ) package = {'name': self.name, 'price': self.price, 'units': self.units} # Dictionary comprehensions if len(rows_pizzas) != 0: package['pizzas'] = {row[0]: row[1] for row in rows_pizzas} if len(rows_comps) != 0: package['complements'] = {row[0]: row[1] for row in rows_comps} if len(rows_drinks) != 0: package['drinks'] = {row[0]: row[1] for row in rows_drinks} if len(rows_sauces) != 0: package['sauces'] = {row[0]: row[1] for row in rows_sauces} metrics_query_count.labels(object='Package', method='json').inc() return package
class WorkLoad(StructuredNode): name = StringProperty(unique_index=True, required=True) workLoadType = StringProperty() version = StringProperty() metaData = JSONProperty() spec = JSONProperty() alarms = ArrayProperty() labels = StringProperty() cloudType = StringProperty(default="Kubernetes") component = RelationshipFrom('Component', 'PART_OF')
class Location(StructuredNode): uid = UniqueIdProperty() name = StringProperty(max_length=120, required=True) description = StringProperty(max_length=4096, required=True) latitude = FloatProperty(required=True) longitude = FloatProperty(required=True) photos = ArrayProperty(base_property=StringProperty(), default=[]) is_in = RelationshipFrom("Blog", "IS_IN", model=TaggedRel) tagged_in_blog = RelationshipFrom("Blog", "TAGGED_LOCATION", model=TaggedRel)
class Subject(StructuredNode): uid = UniqueIdProperty() code = StringProperty(unique_index=True, required=True) name = StringProperty(unique_index=True, required=True) level = IntegerProperty() prefix = StringProperty() credit = FloatProperty() type = StringProperty() availability = ArrayProperty(StringProperty()) prerequisites = Relationship('Subject', 'PREREQUISITES', model=SubjectRel) corequisites = Relationship('Subject', 'COREQUISITES', model=SubjectRel)
class InspectedTokenNode(StructuredNode): __label__= 'TokenDetails' email = EmailProperty(required=True, unique_index = True) name = StringProperty(required=True) username = StringProperty(required=True) exp = DateTimeProperty(required=True) iat = DateTimeProperty(required=True) identitiesSet = ArrayProperty() login = RelationshipTo('GlobusLoginNode', 'detailsFor')
class Volunteer(SBObject): # See VOLUNTEER_ACTIVITIES in settings for valid attributes that # can be placed within this property activities = ArrayProperty() # optimizations owner_username = StringProperty(index=True) mission_id = StringProperty() # relationships volunteer = RelationshipFrom('plebs.neo_models.Pleb', 'WANTS_TO') mission = RelationshipTo('sb_missions.neo_models.Mission', 'ON_BEHALF_OF')
class Literature(StructuredNode): name = StringProperty(unique_index=True, required=True) UniqueIdProperty() # 中图文分类号 clc_types = ArrayProperty(StringProperty()) has_papers = RelationshipFrom('Paper', 'Publish_AT') def safe_save(self): if Literature.nodes.get_or_none(name=self.name) is None: return self.save() else: return Literature.nodes.get(name=self.name)
class User(StructuredNode): email = StringProperty(unique_index=True, required=True) age = IntegerProperty(index=True) aliases = ArrayProperty() @property def email_alias(self): return self.email @email_alias.setter # noqa def email_alias(self, value): self.email = value