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
2
votes
1 answer

Returning source objects in self-referencing has_many, :through

Here's my User model: class User < ActiveRecord::Base has_many :friends, :class_name => 'Friendship', :dependent => :destroy end Here's my Friendship model: class Friendship < ActiveRecord::Base belongs_to :user belongs_to :friend,…
keruilin
  • 16,782
  • 34
  • 108
  • 175
2
votes
1 answer

spark recursively fix circular references in class

My initial data structure contains self-references which are not supported by spark: initial.toDF java.lang.UnsupportedOperationException: cannot have circular references in class, but got the circular reference The initial data structure: case…
Georg Heiler
  • 16,916
  • 36
  • 162
  • 292
2
votes
1 answer

Getting hierarchical data from self referencing table in SQL 2005

I am using SQL 2005, with existing data of millions of records (so data structure can not be changed) and I'm trying to do the following: I have some data (following example is from another question and modified a bit to show what I am trying to…
2
votes
2 answers

SQLAlchemy Self Referencing Relationship - NoReferencedTableError

I'm using SA 0.6.6, Declarative style, against Postgres 8.3, to map Python objects to a database. I have a table that is self referencing and I'm trying to make a relationship property for it's children. No matter what I try, I end up with a…
Corey Coogan
  • 1,569
  • 2
  • 17
  • 31
2
votes
1 answer

C++; using lambdas to conditionally expand a function within a class (seg fault with MWE)

I would like to use lambdas to conditionally expand the functionality of a function within a class. There is no problem doing this outside of the class scope (see example), but the minimal working example below leads to a segmentation fault when…
2
votes
1 answer

Delete cascade foreign key constraint error with SQLAlchemy

I slightly modified the official example for a directed graph and added a cascade='all, delete-orphan as recommended for cascading deletion if the relationship is defined in the child. Still, when I try to delete a parent I get a foreign key…
wackazong
  • 474
  • 7
  • 18
2
votes
0 answers

Self reference table to a recursive list\collection

I currently have data in a SQL table that contains a ConfigHead table and a Config Line Table. The Config Line table is a self referencing table. My new data structure has the ConfigLines that has a collection of ConfigLines, i am trying to…
user2859298
  • 1,373
  • 3
  • 13
  • 28
2
votes
2 answers

Core Data: Self referencing table

I have an Entity in my Core Data model that contains a reference to itself. i.e. A Page can have a child collection of pages. When compiling i get the warning: "Page.pages -- to-many relationship does not have an inverse: this is an advanced…
Aran Mulholland
  • 23,555
  • 29
  • 141
  • 228
2
votes
2 answers

Type aliasing and self-referencing

As an example, a singly-linked list node might be defined as follows namespace example_part1 { class node { node * next; int value; } } assuming we have a list of integers only. This class is allowed to have a member…
Konrad
  • 2,207
  • 4
  • 20
  • 31
2
votes
1 answer

What is the proper way to define self-referencing interface?

I'm sorry if this question has been asked before, I tried hard to find something like it, but I wasn't even sure what to search for. Suppose I have following interface (this is just an example, my specific case have nothing to do with operators or…
Reverent Lapwing
  • 283
  • 2
  • 11
2
votes
1 answer

aspnet core entity framework 7 self referencing "job" 1 to many table

I have a "Job" table that contains jobs. The fact is Jobs are not always done in one go.. you can have a job that has many visits. I intended to represent that as another job but linked back to the original job via self referencing linkId. I am…
2
votes
3 answers

Entity Framework Self-Referencial Many-To-Many with Payload ( Bill of Materials BOM )

I asked this question a while back without an answer, I believe it may be the most bizarre implementation for the EF, although it is quite practical. Here is my previous post: Entity Framework Self Referencing Hierarchical Many To Many I've decided…
2
votes
2 answers

Updating a MySQL table with a self-referencing column

I have a table (simplified) that looks like this: id | name | selfreference | selfreference-name ------ | -------| --------------| ------------------ 1 | Vienna | | 2 | Wien | | Vienna 3 | Виена …
Tench
  • 485
  • 3
  • 18
2
votes
1 answer

Bidirectional self-referencing mapping with additional fields in doctrine 2

I'm stuck on this. Here is what i got: I got a DocumentEntitiy which is able to have $previosDocuments and $nextDocuments.This relation is bidirectional and both of them are ArrayCollections. But I also need to know some other additional…
Kami Yang
  • 427
  • 5
  • 15
2
votes
1 answer

SQLAlchemy self-referential many to many with extra association data

I have the following basic SQLAlchemy model with a many to many self reference: class Organisation(Base): __tablename__ = 'organisation' name = Column(String(50)) url = Column(String(128)) associated = relationship( …
user162390
  • 41
  • 3