Skip to content

Commit

Permalink
Add attachment pairs into BDDL
Browse files Browse the repository at this point in the history
  • Loading branch information
cgokmen committed Jan 9, 2025
1 parent 140d488 commit dc330a7
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions bddl/knowledge_base/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import itertools
import json
import networkx as nx
from typing import Dict, Set
from typing import Dict, Set, List, Tuple
from bddl.object_taxonomy import ObjectTaxonomy
from bddl.knowledge_base.orm import (
Model,
Expand All @@ -15,7 +15,7 @@
OneToManyField,
UUIDField,
)
from bddl.knowledge_base.utils import *
from bddl.knowledge_base.utils import SynsetState
from collections import defaultdict


Expand Down Expand Up @@ -89,6 +89,16 @@ class Meta:
pk = "name"


@dataclass(eq=False, order=False)
class AttachmentPair(Model):
name: str
female_object_fk: ManyToMany = ManyToManyField("Object", "female_attachment_pairs")
male_object_fk: ManyToMany = ManyToManyField("Object", "male_attachment_pairs")

class Meta:
pk = "name"


@dataclass(eq=False, order=False)
class Predicate(Model):
name: str
Expand Down Expand Up @@ -196,6 +206,10 @@ class Object(Model):
# roomobject counts of this object
roomobjects_fk: OneToMany = OneToManyField("RoomObject", "object")

# attachment pairs this object participates in
female_attachment_pairs_fk: ManyToMany = ManyToManyField(AttachmentPair, "female_objects")
male_attachment_pairs_fk: ManyToMany = ManyToManyField(AttachmentPair, "male_objects")

def __str__(self):
return self.category.name + "-" + self.name

Expand Down

0 comments on commit dc330a7

Please sign in to comment.