Questions tagged [relation]

A relation on sets S1, S2, ..., SN is any subset of S1 x S2 x ... x SN, where 'x' denotes the Cartesian product. In other words, a relation over N sets is any set of ordered N-tuples over the N sets.

A relation on sets S1, S2, ..., SN is any subset of S1 x S2 x ... x SN, where 'x' denotes the Cartesian product. In other words, a relation over N sets is any set of ordered N-tuples over the N sets.

1457 questions
-1
votes
1 answer

Rails through relation with has_many and belongs_to

I need to define relation between Packages and Delivers: 1 deliver can has many packages. But packages can not have delivers. Packages can just belong to Delivers. Deliver has_many packages, but package can just belongs_to delivers (or to…
-1
votes
1 answer

Django - How to display a attribut (name) from forgeinKey object?

I have an artist which has many paintings, so a many to one relation. So i got class Artist(models.Model): name = models.CharField(max_length=120) age = models.IntField() class Paintings(models.Model): painting =…
Dariun
  • 327
  • 3
  • 14
-1
votes
2 answers

How to make a foreign key not using primary key

I have a migration on Laravel for table pasien like this : public function up() { Schema::create('pasien', function (Blueprint $table) { $table->string('No_RM'); $table->timestamps(); $table->primary('No_RM'); …
Adhik Mulat
  • 538
  • 2
  • 10
  • 39
-1
votes
2 answers

How do you constrain a foreign key to a child

A parent entity requires one child entity to be marked. Thus, I've added a field marked_child_id. How would I constrain this field to only accept ids of child entities of the parent?
Tobiq
  • 2,489
  • 19
  • 38
-1
votes
1 answer

problem with migrating many to many ploymorphic relation in laravel

i have Category model, and i want to use it for posts and topics. and i think should use many to many ploymorphic relation, but in migrating i get this error: Illuminate\Database\QueryException : SQLSTATE[42S02]: Base table or view not found:…
mr stark
  • 35
  • 1
  • 10
-1
votes
1 answer

How to access to relations of a model in activeRecord?

I have a model like bellow: class Book extends ActiveRecord { { public function getDomain() { return $this->hasOne(Domain::className(), ['ID' => 'domainID']); } public function getOwnerPerson() …
Rahman
  • 410
  • 6
  • 26
-1
votes
2 answers

How do I make relations laravel in different folders?

My user model like this : namespace App\Models\Auth; ... class User extends Authenticatable { ... public function vendor() { return $this->belongsTo(Vendor::class, 'vendor_id', 'id'); } } My vendor model like this…
moses toh
  • 12,344
  • 71
  • 243
  • 443
-1
votes
2 answers

Functional dependency inferences with redundant attribute

Given 1) CA -> B and 2) B -> C can you infer A -> B using Armstrong's axioms? I tried to use inference rules to prove this, but get stuck. BA -> CA Augmentation of A BA -> CA and CA -> B Transitive property AB -> B It seems to makes sense to be…
-1
votes
1 answer

How can I make calculations in relations model class and receive clear data

I have this object and as you can see I sort by different variables $banks = Bank::with('credits')->with('deposits')->with('bank_assets')->with('atms')->get()->sortByDesc($sort); So I have relations in my model for example bank_assets (credits and…
David
  • 181
  • 1
  • 2
  • 8
-1
votes
1 answer

can prolog programs using library(real) be made relational?

in such a program using library(real): :- use_module( library(real) ). :- use_module( library(lists) ). :- use_module( library(apply_macros) ). :- use_module( library(readutil) ). my_sum(L, S):- i <- L, <- i, S <- sum(i). is there a…
Raoul
  • 1,872
  • 3
  • 26
  • 48
-1
votes
1 answer

What would be the result of this operation on these tables?

Enroll (table): cid sid grade gradepoint CS425 001 A 4.0 CS595 001 B 3.0 CS595 002 A 4.0 EE401 001 A 4.0 EE401 002 B 3.0 EE401 004 A 4.0 PHYS571 …
JohnSmithy1266
  • 407
  • 1
  • 6
  • 15
-1
votes
1 answer

Composed relation of 2 relations on the set A

I'm struck with this problem, and i'm wondering if I'm wrong or the answer sheet I have is wrong. I've included the problem description and answer below: The problem is with 2 and 3. First I construct the matrix for R and S: Then I can compute the…
TobiasKnudsen
  • 527
  • 2
  • 9
  • 29
-1
votes
2 answers

Laravel - Backpack. Display field from other model

After many research I couldn't find the answer to my question. I have a model "Station" with two fields : "name" and "city_id". In my Station view (in the backpack admin panel) I would like to display city's name (in the model City). Station and…
-1
votes
2 answers

Scala: Data structure for the representation of 1:1, 1:M, M:1, and M:M relationships between objects of the same type

In comparative genomics, the identification of orthologous genes [which are genes that are believed to have similar function] in two genomes is important in a variety of applications. The relationship between these genes from the two genomes can be…
7kemZmani
  • 658
  • 1
  • 8
  • 21
-1
votes
2 answers

Symfony 3 relation not working with update --force

So, my problem is when I'm trying to update schema with command "dotrine:schema:update --force", entity are create but without any relation. I have two entity "advert" and "category" and a relation ManyToMany on advert entity. This is entyty advert…
c.DAUD
  • 1
  • 1