diff --git a/depicts/model.py b/depicts/model.py index b23c3c1..3c92751 100644 --- a/depicts/model.py +++ b/depicts/model.py @@ -105,10 +105,14 @@ class Item(Base): class Triple(Base): __tablename__ = 'triple' - subject_id = Column(Integer, primary_key=True) + subject_id = Column(Integer, + ForeignKey('item.item_id'), + primary_key=True) predicate_id = Column(Integer, primary_key=True, index=True) object_id = Column(Integer, primary_key=True, index=True) + subject = relationship('Item', backref='triples') + class HumanItem(Base): __tablename__ = 'human' item_id = Column(Integer, primary_key=True, autoincrement=False)