关系型数据库的核心单元是

Nucleoid is an open source (Apache 2.0), a runtime environment that provides logical integrity in declarative programming, and at the same time, it stores declarative statements so that it doesn’t require external database, in short it can be used as database.

Nucleoid是一个开放源代码(Apache 2.0),它是一个运行时环境,可在声明式编程中提供逻辑完整性,同时,它存储声明性语句,因此不需要外部数据库,总之可以用作数据库。

数据结构 (Data Structure)

Data structures are defined in declarative syntax. Let’s say name is a variable, and by program requirements, name must be:

数据结构以声明性语法定义。 假设name是一个变量,并且根据程序要求, name必须为:

  • less than 10 characters少于10个字符
  • first character is upper case第一个字符为大写
  • contains no underscore character不含下划线字符

so, this can be 3 separate declarations:

因此,这可以是3个单独的声明:

> if( name.length > 10 ) {    throw "INVALID_SIZE"  }> if( ! /[A-Z]/.test( name.charAt(0) )) {    throw "INVALID_FIRST_CHARACTER"  }> if( name.indexOf("_") > -1 ) {    throw "INVALID_SPECIAL_CHARACTER"  }

人际关系 (Relationships)

Relationships of objects are defined similar to database’s relationships, but it requires to define in declarative syntax.

对象的关系的定义与数据库的关系类似,但是需要使用声明性语法进行定义。

一对一 (One-to-One)

One-to-one’s defined as referring object’s property to another object instance.

一对一的定义是将对象的属性引用到另一个对象实例。

> class Driver {}> class Vehicle {}> driver1 = new Driver();> vehicle1 = new Vehicle();> driver1.vehicle = vehicle1;

Bidirectional relationships requires additional declaration in order to keep both side synced, so not recommended unless absolutely required, associative entity may be used as alternative.

双向关系需要额外的声明才能使双方保持同步,因此除非绝对必要,否则不建议使用关联实体作为替代。

Still all the declarations are applicable to the property:

所有声明仍然适用于该属性:

> Vehicle.type = "CAR"> driver1.vehicle.type"CAR"

一对多 (One-to-Many)

One-to-Many is defined in three ways:

一对多定义有以下三种方式:

列在身边 (List as in One’s side)

It is a list created as property:

这是一个创建为属性的列表:

> class Customer {}> class Order {}> Customer.orders = [];> customer1 = new Customer();> order1 = new Order();> customer1.orders.push(order1);

像Manys一样的财产 (Property as in Many’s side)

It is a property created, which refers to other instance:

这是一个创建的属性,它引用其他实例:

> class Employee {}> class Project {}> employee1 = new Employee()> project1 = new Project();> project1.employee = employee1;

Both of first 2 options are not bidirectional.

前两个选项都不是双向的。

关联实体 (Associative Entity)

In this case, both objects will be registered in associative object:

在这种情况下,两个对象都将被注册到关联对象中:

> class User {}> class Company {}> class Registration {}> if ( Registrations.filter( r => r.user == User ).length > 1 ) {    throw "USER_ALREADY_REGISTERED"  }> user1 = new User();> company1 = new Company();> registration1 = new Registration();> registration1.company = company1;> registration1.user = user1;

Having a declaration of if ( Registrations.filter( r => r.user == User ).length > 1 ){ .. } adds One-to-Many constraint. In this case, registering user1 to another company throws "USER_ALREADY_REGISTERED":

如果声明为if ( Registrations.filter( r => r.user == User ).length > 1 ){ .. }添加一对多约束。 在这种情况下,向另一家公司注册user1会引发"USER_ALREADY_REGISTERED"

> company2 = new Company();> registration2 = new Registration();> registration2.company = company2> registration2.user = user1;> "USER_ALREADY_REGISTERED"

多对多 (Many-to-Many)

Many-to-Many is relatively straightforward as only possible with associative entity without carrying any additional constraint.

多对多是相对直接的,只有在没有任何附加约束的情况下,才可能具有关联实体。

> class Passenger {}> class Flight {}> class Ticket {}> passenger1 = new Passenger();> flight1 = new Flight();> ticket1 = new Ticket();> ticket1.passenger = passenger1> ticket1.flight = flight1;> flight2 = new Flight();> ticket2 = new Ticket();> ticket2.passenger = passenger1> ticket2.flight = flight2;

查询 (Queries)

Queries is done with functional programming.

查询是通过函数式编程完成的。

The runtime stores each instance into its class list like driver1 = new Driver() will be part of Drivers.

运行时将每个实例存储到其类列表中,例如 driver1 = new Driver() 将成为 Drivers 一部分

一对一 (One-to-One)

> Drivers.filter( d=> d.state == "GA").filter( d => d.vehicle.year > 2010)// Finds drivers in GA state with car younger than 2010

一对多 (One-to-Many)

> Orders.filter( o => o.price > 100 && o.customer.id == 192)// Finds orders with bigger than $100 prize of customer with id 192

Other direction

其他方向

> Customers.find( c=> c.id == 192).orders.filter( o=>o.price > 100)

多对多 (Many-to-Many)

Tickets.filter( t => t.passenger.id == 6912 && t.flight.destination == "LA")// Finds ticket of passenger with id 6912 for destination to FL

Reference: https://nucleoid.org/tutorial/

参考: https : //nucleoid.org/tutorial/

翻译自: https://medium.com/nucleoid/data-relationships-in-nucleoid-e3837512d264

关系型数据库的核心单元是


http://www.taodudu.cc/news/show-994780.html

相关文章:

  • 小程序 国际化_在国际化您的应用程序时忘记的一件事
  • robo 3t连接_使用robo 3t studio 3t连接到地图集
  • 软件需求规格说明书通用模版_通用需求挑战和机遇
  • 一类动词二类动词三类动词_基于http动词的完全无效授权技术
  • 一年了
  • 将DataSet中的操作更新到Access数据库
  • 我喜欢的一首歌--《幸福的瞬间》
  • XForum 里用 Filter 编程实现安全访问控制
  • chedandekaoyan
  • Microsoft好员工的十个标准
  • GARFIELD@11-20-2004
  • SPS用户管理的问题
  • 最近关注的一些东西
  • 吉他谱——单身情歌
  • 新增两款Skin(clover与Valentine)
  • 同一页面引入多个JS文件的编码问题
  • 中小企业的软件需求问题
  • 读《.NET本质论》样章有感
  • 域名与国家对应表
  • 介绍一种Web上打印技术
  • 分类法过时了吗?【ZZ】
  • 【转贴】想应聘的瞧仔细了:HW分析大全
  • 18 个经典故事
  • SAP的软件设置
  • 介绍我的一位同事的开源RSS阅读器
  • how to get the space size of some tables in one database?
  • 右键单击文件夹进入命令行窗口
  • 你的QQ为谁隐身?
  • 一些感动的日子
  • 整理javascript操作文件说明.

关系型数据库的核心单元是_核中的数据关系相关推荐

  1. GEE系列:第4单元 Google 地球引擎中的数据导入和导出

    GEE从入门到实战的10个系列单元: GEE系列:第1单元 Google地球引擎简介 GEE系列:第2单元 探索数据集 GEE系列:​第3单元 栅格遥感影像波段特征及渲染可视化 GEE系列:第4单元 ...

  2. 福州传一卓越编程培训第二天2023 05 23 数据库sqlite增删改查,excel中的数据输出为sql语句

    数据库基本概念 ​ 数据库即 存储数据的系统(DBS database sysytem) ​ 数据库系统 ​   数据库的管理系统软件 DBMS manager ​   数据文件 db文件 ​ 存储数 ...

  3. 数据库分片教程mysql_简述MySQL分片中快速数据迁移

    操作实践背景: travelrecord表定义为10个分片,尝试将10个分片中的2个分片转移到第二台MySQL上,并完成记录, 要求最快的数据迁移做法,中断业务时间最短 思路一利用mysqldump: ...

  4. 查询oracle数据库的表格数据类型,excel表格中如何查询数据库数据类型-我想把excel表格中的数据导入oracle数据库中,想在......

    在excel表里,什么是:字段.记录.数据类型.多工... declare @t table(id numeric(18,2)) insert into @t SELECT   col1 FROM   ...

  5. Visual FoxPro初学:建立数据库,创建表,向表中添加数据

    一.怎样建立数据库 建立数据库的方法有很多.用菜单建立数据库的步骤如下: 1.单击"文件(F)"."新建(N)-"; 2.选择"数据库"文件 ...

  6. 数据挖掘中数据预处理方法_数据挖掘中的数据预处理

    数据挖掘中数据预处理方法 In the previous article, we have discussed the Data Exploration with which we have star ...

  7. mysql数据库+易语言的应用_易语言mysql数据应用源码

    易语言mysql数据应用源码 易语言mysql数据应用源码 系统结构:注册账号,连接Mysql,用户注册验证码,修改密码验证码,忘记密码验证码,修改密码,忘记密码, ======窗口程序集1 | | ...

  8. SQL SERVER 数据库 怎么从一个服务器一个表中把数据插入到另一个服务器中的一个表内(纯复制)...

    2019独角兽企业重金招聘Python工程师标准>>> 在这里有两个概念:本地数据源.远程数据源! 本地数据源指的是单个服务器上的数据而远程数据源指的是另一个SQL实例上的数据. 如 ...

  9. 带宽与码元的关系_通信中的带宽关系、以及码元、波特率、比特率、奈奎斯特带宽...

    1.带宽分类: 第一零点带宽.奈奎斯特带宽.信道带宽. 注意: 1)其中 第一零点带宽.奈奎斯特带宽 属于系统带宽: 2)信道带宽一般是第一零点带宽的二倍(带宽取得都是正半轴),也可以理解为在到信道时 ...

最新文章

  1. 在Ubuntu中使用OTB-50测试ECO模型
  2. 顺序循环队列队满队空的两种判别方式
  3. oracle 外键子查询,外键、联合查询、子查询
  4. STM32驱动LCD实战
  5. 不可描述⁄( ⁄•⁄ω⁄•⁄ )⁄!亚马逊用机器学习找有声书中情色片段
  6. 解决Macbook安装win10/win11时遇到的WDF_Violation 蓝屏错误问题 - 安装Bootcamp驱动蓝屏
  7. halcon联合C#开发--连接大华相机读取二维码附源码
  8. 程序员微信名昵称_推荐几个高逼格的微信昵称?
  9. python基础系统学习整理,自学者可以参考的不二笔记
  10. 计算机无法显示移动硬盘,电脑不显示移动硬盘怎么办 检测不到移动硬盘的原因...
  11. Android屏幕适配之解决白屏启动的正确姿势
  12. python剔除st股_剔除st股公式,剔除非st股票
  13. ubuntu18.04 安装flash。
  14. POJ 1265 Area
  15. 利用JS制作简易计算器
  16. java截取视频第几秒与另一个秒之间生成gif
  17. 笔记本突然没有WiFi了,网卡驱动带有感叹号,Intel(R) Wireless-AC 9462 #2 : 对本驱动程序而言,版本号错误。
  18. 华为C/C++笔试题(附答案,华为面试题系列)
  19. Java高级开发0-1项目实战-青鸟商城-Day04
  20. Linux内核移植 part3:sdmmc驱动

热门文章

  1. 骑马与砍杀python代码_GitHub - yunwei1237/scottish-fold: 一个关于骑马与砍杀的剧本制作工具...
  2. I/O 多路复用之select
  3. 信道分配 以太网
  4. java小程序查看器,成功拿到offer
  5. android 调试技巧
  6. 【安富莱二代示波器教程】第8章 示波器设计—测量功能
  7. alpha冲刺day8
  8. ES6标准入门(第二版)pdf
  9. C# winform 窗体怎么隐藏标题栏,不显示标题栏
  10. flex 有关数据类型强制转