Questions tagged [self-reference]

Self-reference is the ability of a program (or logical sentence) to refer to itself, either directly or indirectly.

Self-reference is the ability of a program (or logical sentence) to refer to itself, either directly or indirectly.

Useful Links:

Stanford Encyclopedia 'Self Reference' Entry

Related Tags:

596 questions
0
votes
2 answers

Implementing an Aliases table (self-referencing many-to-many)

I am trying to model an Alias relationship. That is, several records in my person table may represent the same actual person. I don't care who the "Primary" person is. All Person records would carry equal weight. I have implemented this in the…
mwolfe02
  • 23,787
  • 9
  • 91
  • 161
0
votes
2 answers

Activeadmin has_many

I've got a model "Window" with has_many relationship to another model "WindowItems". The WindowItems has a self referencing relationship (so it can have nested children of itself). I've got an activeadmin resource for window like this: show :title…
Sean
  • 1,078
  • 14
  • 25
0
votes
1 answer

Cocoa core data self referential interface builder question

I'm having trouble understanding how to get the following working in interface builder. I've created a Core Data model class "Person" that has a number of attributes (first name, surname, etc.) and a relationship to other persons…
Sway
  • 1,647
  • 3
  • 16
  • 19
0
votes
1 answer

decent_exposure with Self referential association

I have a self referential association: has_many :households has_many :relations, :through => :households has_many :inverse_relationships, :class_name => 'Household', :foreign_key => 'friend_id' has_many :inverse_relations, :through =>…
tbrooke
  • 2,137
  • 2
  • 17
  • 25
0
votes
3 answers

Self Referenced list to multiple structured lists?

I cannot get my recursion to work again :/ I have a list that contains some self-referential items but how can I put them in a list of lists if they belong together based on their keys. Can somebody help me with this issue? Please :) Here is some…
0
votes
2 answers

How to assign a value to a member of an object of self referential structure type?

This is the def of my structure typedef struct treeNode { int data,pos; char name[16]; struct treeNode *left; struct treeNode *right; }treeNode; I have created an dynamic object treeNode *temp; …
Amit Gupta
  • 277
  • 1
  • 2
  • 9
0
votes
1 answer

Is there a way to sort by hierarchy when the result set comes from a self referencing table?

We've got an Oracle self-referencing table to represent a hierarchy similar to: THING --------- ID PARENT_ID NAME SOME_DATA The top-level THING has a null PARENT_ID. I'd like to be able to select from this table and order my data by each row's…
Chris Williams
  • 11,647
  • 15
  • 60
  • 97
0
votes
2 answers

Rails Self referencing using non-primary key

Please help. I have a self referencing model and want the foreign key to refer to a non-primary key that is scoped. In the list table, I have a sequence_id column which contains the incremental id of the list that is only unique in a listset.…
Mich
  • 257
  • 1
  • 3
  • 9
0
votes
1 answer

table variable self reference in SQL server 2008

I found a very strange thing in SQL server. I am not sure it is normal. insert @table select ID, Lastname from tableB where ID NOT IN ( select ID from @Table) It always says 0 row inserted. If I use a physical table instead of @table, it works…
0
votes
1 answer

Rearranging the tree nodes and saving it back on a self-referencing table with EF

I have a self-referencing table structure working fine with EF, which I use to render a tree view. The EF entity looks like the following and I eagerly load the total structure. class ListItem { int Id; string Text; ListItem ParentItem; …
0
votes
2 answers

SQL table self-reference query vs. unique constraints using checksum

I would like to better understand the differences for checking uniqueness in a record before an INSERT between using CHECKSUM (with unique constraints) versus self-referencing table statement like the one below. What scenarios would pose one option…
Cameron
  • 340
  • 1
  • 2
  • 9
0
votes
1 answer

Rails HABTM association

I have self reference habtm assotiation. class Label < AR::B has_and_belongs_to_many :a_label, :class_name => "Label", :join_table => "a_labels", :foreign_key => "label_id", :association_foreign_key =>…
0
votes
2 answers

Mysql. Duplicate autoincrement key in same table

There is one table. Parent_id references same table id. How insert raw if parent_id = id? I don't know id(before insert) and could't insert if there is not parent_id. What the optimal way without getting last INCREMENT id and creating temporary…
Stepchik
  • 275
  • 1
  • 3
  • 14
0
votes
1 answer

Mixing Self Referencial, Many to Many and Polymorphic Relations

I'm working on some app, I have User, Post and Report models so users can report other users, or posts. So I did this: class Report < ActiveRecord::Base belongs_to :user belongs_to :reportable, :polymorphic => true ... class User <…
0
votes
2 answers

Discrimination based on the value of foreign key Hibernate ORM mapping

I am trying to perform a self-reference mapping (parent/child-like relationship) mapping to one table. What I am trying to have is two different entities from same table so that I could separate properties and so on. I was thinking about using a…
aslan
  • 253
  • 1
  • 4
  • 13