Open Graph Object Categories. - facebook

Documentation on using multiple objects describes creation of certain objects as "categories" while using custom properties to assign them.
It also says that:
Note: Facebook only reads object relationships three deep, so there’s no need to map out more than 3 relationships for each object.
If an object has more than 3 custom properties which are references to other objects, how are these relationships determined?
Is it the first 3 in the list?
Thanks!

It only reads 3 deep not wide. You can (and should) have as many properties on an object that it needs.

Related

JPA - How to make and Entity act like a Value Object (not using embedded)

I’m using JPA 2.1 and I have an entity object called Encounter that has one-to-one relationships with many other different objects of varying sizes (call them satellite objects). I would like these satellite objects to behave like value objects and be automatically replaced when a new instance of Encounter is saved. I have read many articles that show how to achieve this behavior by making the satellite objects embeddable objects instead of entities in a one-to-one relationship. That would work fine except that for any one “encounter” only a few of the large number satellite objects will be needed. Embedding them in a single table would waste a lot of table space and make the Encounter table more complex than necessary.
So is there a way to make an Entity in a one-to-one relationship behave like a value object without writing a lot of code to check if it exist, then delete it, then persist the new one?

UML: how to show a class having 2 collections of the same class?

In my UML class diagrams I usually do object collections by placing the attribute name above the arrow that relates both classes (as opposed to the other notation that just adds the attribute with brackets indicating the multiplicity).
But I have cases in which there are more than one collection of the same kind of object. For example (a very simple example off the top of my head):
Let's say there is a course that has some students who applied for it (so I have a collection of students, let's say an attribute that is an ArrayList of Student, called "applied"). But also, I need to keep a separate collection of the students who actually attended the course (let's say, "attended": another attribute that is an ArrayList, or even a different collection type, like a Vector, of Student).
Should I just add all attribute names on the relationship line?
I'm looking to do this the standard UML way. Only clarifying this because I know UML rules can be flexible when we need them to.
UML does allow for multiple associations between classes using roles.
You would simply draw two arrows:
See here for a similar question where the diagram is taken from.

Getting 2 class objects with 1 query in parse.com using Pointers

I have 2 classes and I need 1 column each from both the classes, I can do that using 2 different queries but that calls for 2 API calls, I know that currently it isnt possible to call 2 classes with 1 query however I was wondering how do pointers work, and if it was possible to use pointers to get data from a separate class?
If there's a one-to-one relationship between the two classes then it is pretty easy.
Lets assume you have Class1 and Class2. Just add a property to one of them, I'll use Class1.relatedClass2.
Now when you query for Class1 you can tell it to include your relatedClass2, which will include the object that property points to.
If instead you have a one-to-many relationship, and there aren't too many, you can use an array of pointers, e.g. Class1.relatedClass2s. The same include statement would mean that the array is now populated with each related Class2 object.

How to set up a has-many relationship in Cocoa?

I'm building a (very) simple FTP app in Cocoa, and I need to store information on the different types of servers that are supported. So, I've created a ServerType class, which stores all of the relevant information about a single type of server. I then have a ServerTypes class which is designed to manage all of the ServerType classes that are created.
My question is, how to set up the relationship between the two objects. Is there a preferred method to do so?
Also, since Objective-C doesn't support non-instance classes, where should I create an instance of ServerTypes that will have to be used throughout the entire program? Or is there a better way to do that? I need it to be KVC compliant so That I can bind one of the ServerType properties to an NSPopupBox.
I'm fairly new to Cocoa and Objective-C.
To manage a relationship between 2 objects, you have 2 ways: composition or inheritance.
You can inherit from a class to create a subclass then you will have a is-a relationship.
If one object contains another as an instance variable then you will have a has-a relationship.
Here, I think it would be the best to use composition where the ServerTypes objects has an array of all server type objects. Objective-C supports non-instance variable (if that's what you mean), by creating static variable. Then you can use it accross the whole program

Core Data: Inheritance, STI or otherwise?

I can't seem to find any information in the documentation or via Google on this, but if there is something, a pointer to it would be great.
In my app, I have a Thing as a core data class. I intend to have that Thing contain many Items which has a bunch of fields in it, like order and created_date and so forth. However, there are a variety of Item types, each with their own set of fields. Ideally, I'd like to create several subclasses of Item, so that I can access all the items together in a single array or something.
In Rails, I'd use STI for this. Does Core Data support similar behaviour?
Thanks!
You can create an Item abstract entity and then have each of your unique items extend from it. Keep the relationship in the abstract so that your Thing can see all of them.
Be warned, however, that under the hood, all of those children will actually be put into a single wide table so you will need to test for performance considerations.