예제 #1
0
class EntityType(db.Model):
    __tablename__ = 'entity_type'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    uri = db.Column(db.String(255), nullable=False, unique=True, index=True)
    display_name = db.Column(db.String(255), nullable=False)
    description = db.Column(db.String(255))
    icon = db.Column(db.String(255))
    father_id = db.Column(db.Integer, index=True, server_default=_text("'0'"))
    has_child = db.Column(db.SmallInteger,
                          index=True,
                          server_default=_text("'0'"))
    is_object = db.Column(db.Integer, server_default=_text("'0'"))
    created_at = db.Column(db.TIMESTAMP,
                           server_default=_text("CURRENT_TIMESTAMP"),
                           default=db.func.now())
    updated_at = db.Column(
        db.TIMESTAMP,
        server_default=_text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"),
        default=db.func.now(),
        onupdate=db.func.now())
    property_types = db.relationship('PropertyType',
                                     backref=db.backref('entity_type',
                                                        lazy='joined'),
                                     cascade='all, delete-orphan',
                                     lazy='select')
예제 #2
0
class FieldRecord(db.Model):
    __tablename__ = 'field_record'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    operator = db.Column(db.String(255))
    operation_type = db.Column(db.String(255))
    field_id = db.Column(db.Integer)
    book_id = db.Column(db.Integer)
    catalog_id = db.Column(db.Integer)
    clause_id = db.Column(db.Integer, index=True)
    operated_field = db.Column(db.String(255))
    original_value = db.Column(db.String(14800))
    new_value = db.Column(db.String(255))
    operated_at = db.Column(db.TIMESTAMP, server_default=_text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
예제 #3
0
class AlgorithmMapping(db.Model):
    __tablename__ = 'algorithm_mapping'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    entity_type_uri = db.Column(db.String(255))
    entity_type_id = db.Column(db.Integer,
                               db.ForeignKey('entity_type.id'),
                               index=True)
    algorithm = db.Column(db.String(255))
    created_at = db.Column(db.TIMESTAMP,
                           server_default=_text("CURRENT_TIMESTAMP"),
                           default=db.func.now())
    updated_at = db.Column(
        db.TIMESTAMP,
        server_default=_text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"),
        default=db.func.now(),
        onupdate=db.func.now())
class ClauseEntityTypeMapping(db.Model):
    __tablename__ = 'clause_entity_type_mapping'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    clause_id = db.Column(db.Integer,
                          db.ForeignKey('clause.id'),
                          nullable=False,
                          index=True)
    clause_uri = db.Column(db.String(255))
    object_id = db.Column(db.Integer, index=True)
    object_uri = db.Column(db.String(255))
    object_name = db.Column(db.String(255))
    concept_id = db.Column(db.Integer, index=True)
    concept_uri = db.Column(db.String(255))
    concept_name = db.Column(db.String(255))
    description = db.Column(db.String(255))
    condition = db.Column(db.String(255))
    created_at = db.Column(db.TIMESTAMP,
                           server_default=_text("CURRENT_TIMESTAMP"),
                           default=db.func.now())
    updated_at = db.Column(
        db.TIMESTAMP,
        server_default=_text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"),
        default=db.func.now(),
        onupdate=db.func.now())
예제 #5
0
파일: field.py 프로젝트: jadbin/knowschema
class Field(db.Model):
    __tablename__ = 'field'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    uri = db.Column(db.String(255), unique=True, index=True)
    count = db.Column(db.Integer)
    support = db.Column(db.String(255))
    description = db.Column(db.String(255))
    created_at = db.Column(db.TIMESTAMP,
                           server_default=_text("CURRENT_TIMESTAMP"),
                           default=db.func.now())
    updated_at = db.Column(
        db.TIMESTAMP,
        server_default=_text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"),
        default=db.func.now(),
        onupdate=db.func.now())
    books = db.relationship('Book',
                            backref=db.backref('field', lazy='joined'),
                            cascade='all, delete-orphan',
                            lazy='select')
예제 #6
0
파일: book.py 프로젝트: jadbin/knowschema
class Book(db.Model):
    __tablename__ = 'book'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    uri = db.Column(db.String(255), unique=True, index=True)
    public_time = db.Column(db.String(255))
    public_org = db.Column(db.String(255))
    description = db.Column(db.String(255))
    field_id = db.Column(db.Integer, db.ForeignKey('field.id'), index=True)
    created_at = db.Column(db.TIMESTAMP,
                           server_default=_text("CURRENT_TIMESTAMP"),
                           default=db.func.now())
    updated_at = db.Column(
        db.TIMESTAMP,
        server_default=_text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"),
        default=db.func.now(),
        onupdate=db.func.now())
    catalogs = db.relationship('Catalog',
                               backref=db.backref('book', lazy='joined'),
                               cascade='all, delete-orphan',
                               lazy='select')
예제 #7
0
class PropertyType(db.Model):
    __tablename__ = 'property_type'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    uri = db.Column(db.String(255), nullable=False, index=True)
    display_name = db.Column(db.String(255), nullable=False)
    description = db.Column(db.String(255))
    icon = db.Column(db.String(255))
    field_type = db.Column(db.String(255))
    is_entity = db.Column(db.SmallInteger,
                          index=True,
                          server_default=_text("'0'"))
    entity_type_id = db.Column(db.Integer,
                               db.ForeignKey('entity_type.id'),
                               nullable=False,
                               index=True)
    created_at = db.Column(db.TIMESTAMP,
                           server_default=_text("CURRENT_TIMESTAMP"),
                           default=db.func.now())
    updated_at = db.Column(
        db.TIMESTAMP,
        server_default=_text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"),
        default=db.func.now(),
        onupdate=db.func.now())
예제 #8
0
class OperationRecord(db.Model):
    __tablename__ = 'operation_record'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    operator = db.Column(db.String(255))
    operation_type = db.Column(db.String(255))
    entity_type_id = db.Column(db.Integer, index=True)
    entity_type_uri = db.Column(db.String(255))
    property_type_id = db.Column(db.Integer, index=True)
    property_type_uri = db.Column(db.String(255))
    operated_field = db.Column(db.String(255))
    original_value = db.Column(db.String(14800))
    new_value = db.Column(db.String(255))
    operated_at = db.Column(
        db.TIMESTAMP,
        server_default=_text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
예제 #9
0
class ClauseMappingRecord(db.Model):
    __tablename__ = 'clause_mapping_record'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    operator = db.Column(db.String(255))
    operation_type = db.Column(db.String(255))
    clause_mapping_id = db.Column(db.Integer, index=True)
    object_id = db.Column(db.Integer)
    object_uri = db.Column(db.String(255))
    concept_id = db.Column(db.Integer)
    concept_uri = db.Column(db.String(255))
    operated_field = db.Column(db.String(255))
    original_value = db.Column(db.String(14800))
    new_value = db.Column(db.String(255))
    operated_at = db.Column(
        db.TIMESTAMP,
        server_default=_text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
예제 #10
0
class AlgorithmList(db.Model):
    __tablename__ = 'algorithm_list'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    algorithm_name = db.Column(db.String(255))