Modeling a three-way association with optional relation


Business rules

I have three tables (Parties, Categories and Products) which representing the following relationships:

  • A product is classified by zero-one-to-many categories
  • A category classifies zero-one-or-many products

Then, I have the party relationships:

  • A product is classified by one-to-one party
  • A party classifies one-to-many products

In other words, a product doesn’t have to be assigned a category.

Design proposal

I have based my design on the proposal found here, but it’s not entirely applicable since want to enforce party_id for both Products and Categories:

How to model a three-way association that involves Product, Category and Label?

Three-way association design proposal

Question

Is the usage of the three-way association table correct in my proposal to avoid the risk of having the application layer assigning a product to a category without enforcing the party_id?

Oracle Sql: Join Multiple Tables with 1 Association Table

enter image description here

Above is the association between the different tables. Dotted lines are not on primary keys, but are inferred based on data.

This is the query I have so far:

SELECT distinct t3.assoc_id, t4.assoc_id FROM table_1 t1 LEFT OUTER JOIN assoc_table at ON at.assoc_id = t1.assoc_id LEFT OUTER JOIN table_2 t2 ON t2.detail_id = t1.detail_id LEFT OUTER JOIN  table_3 t3 ON t3.assoc_id = at.assoc_id AND at.table_id = 'table_3'AND t3.value_1 = t1.value_1 LEFT OUTER JOIN table_4 t4 ON t4.assoc_id = at.assoc_id AND t2.value_2 = t4.value_2 AND t3.value_1 = t4.value_1 WHERE t2.unique_id = 'X'; 

Note: I forgot to add Unique_ID in Table_1

enter image description here

IS electronic payment association (EPA/epayments.com) is SCAM?

I joined https://www.epayments.com/ around one month ago and i paid for merchant account there. Till now i haven't received card from them and also there is login problem. I cannot login to epayments now. I emailed about it them but haven't heard anything from them yet..
It looks like a scam what do you think? Had anyone tried here before?

How can I get item’s workflow details/workflow history where workflow association has been deleted?

We have lots of list items where workflow instance is not showing on workflow details page. After researching i found that in sharepoint 2013, completed/suspended/terminated workflow instances will be automatically removed by auto clean up timer job and workflow manager after 30 days.

Due to this we can’t able to get log history/error details of that items. So my question is, Can we get item’s workflow details/history where workflow association has been deleted?

Any help will be appreciated. Thanks

sequelize self association error Aliased associations must have unique aliases [migrated]

I’m using sequelize 4.32 and I was trying to write a self-association in one of the tables, I’m not sure if there is something else that I need to do to solve this relation, my goal is to get all the records in my table and include all the records associated with each one this is the error that I’m getting in the console:

You have used the alias adjucent_stands in two separate associations. Aliased associations must have unique aliases

below you’ll find my model:

module.exports = (sequelize, DataTypes) => {   const stands = sequelize.define('stands', {     id: {       type: DataTypes.INTEGER,       unique: true,       allowNull: false,       primaryKey: true,       autoIncrement: true,     },     name: {       type: DataTypes.STRING,       field: 'name',       unique: {         args: true,         msg: 'Name already exists ',       },     },     location: {       type: DataTypes.JSON,       field: 'location',     },     remote: {       type: DataTypes.BOOLEAN,       field: 'remote',       defaultValue: false,     },     created_at: {       type: DataTypes.DATE(3),       defaultValue: sequelize.literal('CURRENT_TIMESTAMP(3)'),     },     updated_at: {       type: DataTypes.DATE(3),       defaultValue: sequelize.literal('CURRENT_TIMESTAMP(3)'),     },   }, { freezeTableName: true, timestamps: true, underscored: true });    stands.associate = (models) => {     stands.hasMany(stands, { as: 'adjucent_stands' });   };    return stands; }; 

Association Rules Generation is implementin in java(ecplice)

I found the following java code for association rules generation and I replace my own dataset in this. But I have uncorrect output but no error in code.Please explain me where the part of code is misused and changed in this code.

details of code

Demo.java

package net.coderodde.mining.associationrules;  import java.io.File;  import java.io.FileNotFoundException;  import java.util.ArrayList;  import java.util.Arrays;  import java.util.HashSet;  import java.util.List;  import java.util.Scanner;  import java.util.Set;  public class Demo {      public static void main(String[] args) throws FileNotFoundException {         demo();     }      private static void demo() throws FileNotFoundException {         AprioriFrequentItemsetGenerator<String> generator =                 new AprioriFrequentItemsetGenerator<>();          List<Set<String>> itemsetList = new ArrayList<>();          Scanner scanner = new Scanner(new File("bc_dataset.csv"));            scanner.nextLine();            while (scanner.hasNextLine()) {                String str = scanner.nextLine();                itemsetList.add(new HashSet<>(Arrays.asList(str.split(","))));            }            System.out.println(itemsetList);            scanner.close();          long startTime = System.nanoTime();         FrequentItemsetData<String> data = generator.generate(itemsetList, 0.04);         long endTime = System.nanoTime();          int i = 1;          System.out.println("--- Frequent itemsets ---");          for (Set<String> itemset : data.getFrequentItemsetList()) {             System.out.printf("%2d: %9s, support: %1.1f\n",                               i++,                                itemset,                               data.getSupport(itemset));         }          System.out.printf("Mined frequent itemset in %d milliseconds.\n",                            (endTime - startTime) / 1_000_000);          startTime = System.nanoTime();       List<AssociationRule<String>> associationRuleList =                  new AssociationRuleGenerator<String>()                         .mineAssociationRules(data, 0.4);         endTime = System.nanoTime();          i = 1;          System.out.println();        System.out.println("--- Association rules ---");          for (AssociationRule<String> rule : associationRuleList) {             System.out.printf("%2d: %s\n", i++, rule);         }          System.out.printf("Mined association rules in %d milliseconds.\n",                           (endTime - startTime) / 1_000_000);     } } 

Iterate over deepest values in a nested Association

Is it possible to iterate over the values of the deepest layer of keys in a nested association? For example:

assoc = <| "a"->0, "b"-> <| "c"->"one" ,"d"->2 , "e"->3|>, "f"->4|> 

Would it be possible to iterate over just the values of at the deepest level in this example {0,"one",2,3,4}? Or, possible to iterate over the deepest level of keys such that I could test the type for the value of each key?

Is a security association (SA) implemented in ESP and AH protocols?

I’m reading about security associations. I’ve understood that a SA is a virtual connection between a client and a sever, in which all the security parameters, such as encryption algorithm, IP origin and source HMAC algorithm… are defined.

My question is: Is SA implemented when using AH and ESP protocols, or only in ESP when confidentiality is required?

And there goes another question: How does the router know whether to use IPsec or not? By using the protocol field in the IP header?

How to return latest records in nested association?

This query works just fine but it is taking so much time.

SELECT * FROM replies WHERE replies.topic_id IN (   SELECT topics.id FROM topics   INNER JOIN categories ON topics. category_id = categories.id   WHERE   topics.hidden = 0 AND topics.deleted = 0   AND (categories.private_category = 0 OR categories.private_category IS NULL) ) AND replies.deleted = 0 AND replies.total_points > -1 ORDER BY replies.id DESC LIMIT 10" 

This query should return the latest replies from topics. Each reply belongs to topic (post). Each post belongs to category. The app has nested replies.