Friday, September 30, 2011

Fundamental Pieces of an ORM2 Model

Since this game is going to be based on the graphical notation of Object Role Modeling v.2 (ORM2), one of the first steps is to build the model so that the game mechanics can interact with it. It's a bit like creating a sports announcer who knows the rules of the game and can narrate events as they happen.

In ORM2, there are three main components to the model:
  1. Object Types
  2. Fact Types
  3. Constraints.

First, Object Types. OTs can be thought of as, well, types of objects. "Bird" or "Car" are types of objects. "Thanksgiving dinner" or "My Jeep" are instances of those object types.

Fact Types (FTs) are how OTs relate with each other and with themselves. They describe relationships, and are composed of roles and readings. A FT with one role is called a unary fact type. An example of this would be "Bird is alive". Obviously we'd prefer that our Thanksgiving dinner bird does not meet this criterion. FTs also come in binary (2 roles), ternary (3 roles), quaternary, quinary, and so forth. Anything over three roles is usually called "n-ary" because let's face it, nobody remembers their Latin prefixes these days.

Given the OTs "Car" and "Person", we can choose to relate them to each other in many ways. The relationship is written out with the name of the OT serving as a placeholder in the reading. "Person drives Car" and "Person was hit by Car" are two sample FTs. Now, replace an Object Type with an object instance. "Tyler drives JeepABC" is true-- I do drive a Jeep! Its license plate isn't ABC, but you'll just have to use your imagination. "Tyler was hit by MinivanOfDoom" is also a true fact. Not sure what ever became of that car....

Finally, we come to constraints. They're what keep two people from driving the same car at once, or a person being their own grandparent. The subtleties of information modeling are often in the constraints. There are many kinds, but for the purposes of prototyping my game I'm only dealing with uniqueness constraints.

A uniqueness constraint covers one or more roles in a FT and ensures that AT MOST ONE combination of objects in those roles ever happens. In "Person drives Car", a uniqueness constraint over Person would mean that "For each Person, that Person drives AT MOST ONE Car." Put the constraint over Car instead, and it turns into, "For each Car, AT MOST ONE Person drives that Car." Don't worry too much about the bold and italics and capital letters; that's just me showing off that I can dissect constraint verbalizations and you can't. Yet.

In a future post I'll toss in some pictures to demonstrate the graphical notation.


  1. Dịch vụ ship hàng là nhu cầu không thể thiếu của các bạn đúng không ạ? Nhưng để có cước phí vận chuyển rẻ, hợp lý thật sự và an toàn hàng hoá thì ít có cong ty van tai duong bien nào uy tín. Bên mình chuyên cung cấp dịch vụ gửi hàng về Hà Nội, chuyển hàng về Đà Nẵng hơn 10 năm nay rồi với giá cả thấp nhất thị trường hiện nay.

    Ngoài ra bên mình cũng lo trọn gói cho bạn từ nhà xưởng vận chuyển hàng về Hải Phòng, vận chuyển hàng Bình Dương đi Đồng Nai .v.v..

    Rất mong các bạn ủng hộ gửi hàng đi Mỹ bên mình nhé. Cảm ơn rất nhiều.

  2. Nội dung bạn chia sẻ tui thấy ý nghĩa, chắc phải bookmark lại xem tiếp.

    Sẵn đây tui muốn hỏi bên bạn có nhu cầu van chuyen hang hoa Ha Noi hoặc chuyen hang ra Sai Gon không vậy?

    Mình bên cong ty van chuyen duong bo chuyên cung cấp các dịch vụ van chuyen hang hoa như van chuyen hang hoa Hai Phong, vận chuyển Đà Nẵng, van chuyen hang hoa Nghe An, chuyen hang di Cam Ranh, chuyen hang di Phu Quoc .v.v...

    Ngoài ra bên mình cũng chở thang may gia dinh 350kg, thang may cho khach từ HCM để van chuyen hang hoa di Campuchia gia re, van chuyen hang qua Lao hoặc van chuyen hang hoa di Trung Quoc gia re.

    Có gì liện lạc cho tôi, cảm ơn cậu nhiều nhé.