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

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

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.mzph.cn/news/387844.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

MongoDB第二天

集合的操作: db.表名称 show tables / collection db.表名.drop() 文档的操作: 插入数据 db.表名.insert({"name":"jerry"}) db.insertMany([{"name":"sb",...}]) var ul {"name":"sb"} db.sb.insert(ul) db.sb.…

Python 主成分分析PCA

Python 主成分分析PCA 主成分分析&#xff08;PCA&#xff09;是一种基于变量协方差矩阵对数据进行压缩降维、去噪的有效方法&#xff0c;PCA的思想是将n维特征映射到k维上&#xff08;k<n&#xff09;&#xff0c;这k维特征称为主元&#xff0c;是旧特征的线性组合&#xf…

小程序 国际化_在国际化您的应用程序时忘记的一件事

小程序 国际化The hidden bugs waiting to be found by your international users您的国际用户正在等待发现的隐藏错误 While internationalizing our applications, we focus on the things we can see: text, tool-tips, error messages, and the like. But, hidden in our …

三. 性能测试领域

能力验证&#xff1a; 概念&#xff1a;系统能否在A条件下具备B能力 应用&#xff1a;为客户进行系统上线后的验收测试&#xff0c;作为第三方对一个已经部署系统的性能验证 特点&#xff1a;需要在已确定的环境下运行 需要根据典型场景设计测试方案和用例 一个典型场景包括操…

PCA主成分分析Python实现

作者&#xff1a;拾毅者 出处&#xff1a;http://blog.csdn.net/Dream_angel_Z/article/details/50760130 Github源码&#xff1a;https://github.com/csuldw/MachineLearning/tree/master/PCA PCA&#xff08;principle component analysis&#xff09; &#xff0c;主成分分…

scp

将文件或目录从本地通过网络拷贝到目标端。拷贝目录要带 -r 参数 格式&#xff1a;scp 本地用户名IP地址:文件名1 远程用户名IP地址:文件名 2 例&#xff1a; scp media.repo root192.168.20.32:/etc/yum.repos.d/ 将远程主机文件或目录拷贝到本机&#xff0c;源和目的参数调换…

robo 3t连接_使用robo 3t studio 3t连接到地图集

robo 3t连接Robo 3T (formerly Robomongo) is a graphical application to connect to MongoDB. The newest version now includes support for TLS/SSL and SNI which is required to connect to Atlas M0 free tier clusters.Robo 3T(以前称为Robomongo )是用于连接MongoDB的…

JavaWeb--JavaEE

一、JavaEE平台安装1、升级eclipseEE插件2、MyEclipse二、配置Eclipse工作空间1.字体设置 2.工作空间编码 UTF-83.JDK版本指定 4.集成Tomcat Server运行环境5.配置server webapps目录 端口号 启动时间等三、创建第一个Web项目1.创建 Web Project2.设置 tomcat、创建web.xml3.目…

软件需求规格说明书通用模版_通用需求挑战和机遇

软件需求规格说明书通用模版When developing applications there will be requirements that are needed on more than one application. Examples of such common requirements are non-functional, cookie consent and design patterns. How can we work with these types of…

python版PCA(主成分分析)

python版PCA&#xff08;主成分分析&#xff09; 在用统计分析方法研究这个多变量的课题时&#xff0c;变量个数太多就会增加课题的复杂性。人们自然希望变量个数较少而得到的信息较多。在很多情形&#xff0c;变量之间是有一定的相关关系的&#xff0c;当两个变量之间有一定…

干货|Spring Cloud Bus 消息总线介绍

2019独角兽企业重金招聘Python工程师标准>>> 继上一篇 干货&#xff5c;Spring Cloud Stream 体系及原理介绍 之后&#xff0c;本期我们来了解下 Spring Cloud 体系中的另外一个组件 Spring Cloud Bus (建议先熟悉 Spring Cloud Stream&#xff0c;不然无法理解 Spr…

一类动词二类动词三类动词_基于http动词的完全无效授权技术

一类动词二类动词三类动词Authorization is a basic feature of modern web applications. It’s a mechanism of specifying access rights or privileges to resources according to user roles. In case of CMS like applications, it needs to be equipped with advanced l…

主成份分析(PCA)详解

主成分分析法&#xff08;Principal Component Analysis&#xff09;大多在数据维度比较高的时候&#xff0c;用来减少数据维度&#xff0c;因而加快模型训练速度。另外也有些用途&#xff0c;比如图片压缩&#xff08;主要是用SVD&#xff0c;也可以用PCA来做&#xff09;、因…

thinkphp5记录

ThinkPHP5 隐藏index.php问题 thinkphp模板输出cookie,session中… 转载于:https://www.cnblogs.com/niuben/p/10056049.html

portainer容器可视化管理部署简要笔记

参考链接&#xff1a;https://www.portainer.io/installation/ 1、单个宿主机部署in Linux&#xff1a;$ docker volume create portainer_data$ docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer 2、单…

证明您履历表经验的防弹五步法

How many times have you gotten the question “Tell me more about your work experience at …” or “Describe an experience when you had to overcome a technical challenge”? Is your answer solid and bullet-proof every single time you have to respond? If no…

2018-2019-1 20165231 实验四 外设驱动程序设计

博客链接&#xff1a;https://www.cnblogs.com/heyanda/p/10054680.html 转载于:https://www.cnblogs.com/Yhooyon/p/10056173.html

如何安装pylab:python如何导入matplotlib模块

pylab是python下挺不错的一个画图模块&#xff0c;使用也非常简单&#xff0c;记得Mit的计算机科学及编程导论有节课也是用到了这个工具&#xff0c;但这个工具安装不象用起来那么方便&#xff0c;小编就图文全程直播下吧 工具/原料 python2.7.10win10 32位方法/步骤 1缺省状态…

微信扫描二维码和浏览器扫描二维码 ios和Android 分别进入不用的提示页面

实现微信扫描二维码和浏览器扫描二维码 ios和Android 分别进入不用的提示页面 而进入商城下载该项目 详情地址&#xff1a;gitee.com/DuJiaHui123… 1.创建完之后 替换文件里面的ios项目地址和Android地址 2.网页上线 3.百度搜索 二维码生成 把上线后的地址生成二维码 4.可以把…

详解getchar()函数与缓冲区

1、首先&#xff0c;我们看一下这段代码&#xff1a; 它的简单意思就是从键盘读入一个字符&#xff0c;然后输出到屏幕。理所当然&#xff0c;我们输入1&#xff0c;输出就是1&#xff0c;输入2&#xff0c;输出就是2。 那么我们如果输出的是12呢&#xff1f; 它的输出是1。 这…