關系型數據庫的核心單元是_核中的數據關系

關系型數據庫的核心單元是

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.pswp.cn/news/387844.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/387844.shtml
英文地址,請注明出處:http://en.pswp.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。 這…