有这样的数据库吗?
背景:好的,所以我正在寻找我认为是对象数据库的东西。 然而,我所研究的(诚然少数)对象数据库都是简单的持久层,而不是成熟的 DBMS。 我不知道我正在寻找的内容是否被认为是对象数据库,所以任何帮助我指明正确方向的帮助都将非常感激。
我不想给您两页来描述我正在寻找的内容,因此我将使用一个示例来说明我的观点。 假设我有一个需要存储的“BlogPost”对象。 像这样的伪代码:(
class BlogPost
title:String
body:String
author:User
tags:List<String>
comments:List<Comment>
假设 Comment
是它自己的类。)
现在,在关系数据库中,author
将存储为指向 的外键>User.id
,tags
和 comments
将使用单独的表存储为一对多或多对多关系的关系。 我想要的是一个执行以下操作的数据库引擎:
- 使用直接引用存储相关对象(
author
、tags
等),而不是使用外键,这需要额外查找; 换句话说,数据库本身应该支持彼此之上的对象 - 允许我向博客文章添加评论或标签,而无需检索整个对象,更新它,然后将其放回数据库(就像面向文档的数据库——CouchDB 就是一个例子)
我想我正在寻找的是一个导航数据库,但我不知道。 有什么与我的想法有一点相似的吗? 如果是的话,它叫什么? (或者更好的是,给我一个实际的工作数据库。)或者我太挑剔了?
编辑:
只是澄清一下,我不是在寻找 ORM 或抽象层或类似的东西。 我正在寻找一个在内部执行此操作的实际数据库。 抱歉,如果我太难了,但我已经搜索过,但找不到任何东西。
编辑:
此外,针对 JVM 的一些东西会很棒,但此时我真的不关心它在什么平台上运行。
Background: Okay, so I'm looking for what I guess is an object database. However, the (admittedly few) object databases that I've looked at have been simple persistence layers, and not full-blown DBMSs. I don't know if what I'm looking for is even considered an object database, so really any help in pointing me in the right direction would be very appreciated.
I don't want to give you two pages describing what I'm looking for so I'll use an example to illustrate my point. Let's say I have a "BlogPost" object that I need to store. Something like this, in pseudocode:
class BlogPost
title:String
body:String
author:User
tags:List<String>
comments:List<Comment>
(Assume Comment
is its own class.)
Now, in a relational database, author
would be stored as a foreign key pointing to a User.id
, and the tags
and comments
would be stored as one-to-many or many-to-many relationships using a separate table to store the relationships. What I'd like is a database engine that does the following:
- Stores related objects (
author
,tags
, etc.) with a direct reference instead of using foreign keys, which require an additional lookup; in other words, objects on top of each other should be natively supported by the database - Allows me to add a comment or a tag to the blog post without retrieving the entire object, updating it, and then putting it back into the database (like a document-oriented database -- CouchDB being an example)
I guess what I'm looking for is a navigational database, but I don't know. Is there anything even remotely similar to what I'm thinking of? If so, what is it called? (Or better yet, give me an actual working database.) Or am I being too picky?
Edit:
Just to clarify, I am NOT looking for an ORM or an abstraction layer or anything like that. I am looking for an actual database that does this internally. Sorry if I'm being difficult, but I've searched and I couldn't find anything.
Edit:
Also, something for the JVM would be excellent, but at this point I really don't care what platform it runs on.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(11)
我认为您所描述的内容可以轻松地在 图形数据库。 然后,您可以导航到要进行更改的节点/边缘,而无需检索其他任何内容。 对于 JVM,有 Neo4j 开源图形数据库(我是该团队的一员)。 您可以在 高可扩展性 中阅读相关内容,作为概述的一部分: thinkvitamin 或在 此 stackoverflow 线程。 至于标签,我认为如果您想查找相关标签和类似的内容,将它们存储在图形数据库中可以给您带来一些额外的优势。 只需在邮件列表上写一行,然后我相信社区会帮助你。
I think what you are describing could easily be modeled in a graph database. Then you get the benefit of navigating to the nodes/edges where you want to make changes without any need to retrieve anything else. For the JVM there's the Neo4j open source graph database (where I'm part of the team). You can read about it over at High Scalability, as part of an overview at thinkvitamin or in this stackoverflow thread. As for the tags, I think storing them in a graph database can give you some extra advantages if you want to find related tags and similar stuff. Just drop a line on the mailing list, and I'm sure the community will help you out.
您可以尝试使用 C# 和 Java 版本的 db4o 。
You could try out db4o which is available in C# and Java.
我想我们正在寻找这个:http://www.odbms.org/。 这个网站有一些关于对象数据库的好信息,包括 Objectivity,这是一个非常好的对象数据库。
I think our looking for this: http://www.odbms.org/. This site has some good info on Object Databases, including Objectivity, which is a pretty good object database.
大象这样做: http://common-lisp.net/project/elephant/
Elephant does this: http://common-lisp.net/project/elephant/
正是您所描述的可以通过在普通 RDBMS 上运行的 (N)Hibernate 来完成。
将这样的持久层与普通数据库一起使用的优点是您拥有一个标准的数据库系统并结合了方便的编程。 您以非常自然的方式声明您的类,并且 (N)Hibernate 提供了一种在引用/列表和外键关系之间进行转换的方法。
Java 教程: http://docs.jboss .org/hibernate/stable/core/reference/en/html/tutorial-firstapp.html
.NET 教程:https://web.archive.org/web/20081212181310/ http://blogs.hibernatingrhinos.com/nhibernate/archive/2008/04/01/your-first-nhibernate-based-application.aspx
如果您坚持认为不想使用支持良好的标准 RDBMS,并且宁愿将您的数据信任为更奇特且测试较少的东西,您正在寻找 对象关系数据库。
然而,无论如何,这样的产品最好的实现方式可能是使其成为标准 RDBMS 之上的一层。 这可能就是为什么像 (N)Hibernate 这样的 ORM 是最流行的解决方案——它们允许应用标准 RDBMS 软件(以及广泛可用的管理/用户技能),而且编程体验 99% 是基于对象的。
Exactly what you've described can be done with (N)Hibernate running on an ordinary RDBMS.
The advantage of using such a persistence layer with an ordinary database is that you have a standard database system combined with convenient programming. You declare your classes in a very natural way, and (N)Hibernate provides a way to translate betweeen references/lists and foreign key relationships.
Java tutorial: http://docs.jboss.org/hibernate/stable/core/reference/en/html/tutorial-firstapp.html
.NET tutorial: https://web.archive.org/web/20081212181310/http://blogs.hibernatingrhinos.com/nhibernate/archive/2008/04/01/your-first-nhibernate-based-application.aspx
If you insist that you don't want to use a well-supported standard RDBMS and would rather trust your data to something more exotic and less heavily tested, you're looking for an Object Relational Database.
However, such a product would probably be best implemented by making it be a layer over a standard RDBMS anyway. This is probably why ORMs like (N)Hibernate are the most popular solution - they allow standard RDBMS software (and widely available management/user skills) to be applied, and yet the programming experience is 99% object-based.
这正是 LINQ 的设计目的。
This is exactly what LINQ was designed for.
有各种各样的术语,都链接到对象关系映射,又名 ORM,它可能是您查找的最有用的一个。 许多编程语言都存在 ORM 库。
There's a variety of terms, all linked to Object-Relational Mapping, aka ORM, which is probably going to be the most useful one for you to look up. ORM libraries exist for many programming languages.
Oracle 的 嵌套表 提供了该功能的一部分,尽管在更新中,您不能只添加嵌套表的一行 - 您必须替换整个嵌套表。
Oracle's nested tables provide some part of that functionality, though in updates, you cannot just add a row to the nested table - you have to replace the whole nested table.
我猜您正在寻找具有“EntityFirst”方法的 ORM。
在 EntityFirst 方法中,开发人员最不关心数据库。 您只需要构建您的实体或对象。 然后,ORM 负责将实体存储在数据库中并根据您的意愿检索它们。
据我所知,唯一的 EntityFirst ORM“Signum”。 这是一个构建在 .net 之上的出色框架。 我建议您观看 SignumFramework 网站上的一些视频,然后我相信你会发现它很有用。
链接文本:http://www.signumframework.com
谢谢。
I guess you're looking for an ORM with "EntityFirst" approach.
In EntityFirst approach the developer is least[not-at-all] concerned with Database. You just have to build your entities or objects. The ORM then takes care of storing the entities in Database and retrieving them at your will.
The only EntityFirst ORM witihn my knowledge "Signum". It's a wonderful framework built on top of .net. I recommend you to go thrgouh some videos on the SignumFramework website and I'm sure you'll find it useful.
Link Text: http://www.signumframework.com
Thanks.
也许是 ZODB?
很好的介绍在这里找到:
http://www.ibm.com/developerworks/aix/library/au -zodb/
ZODB perhaps?
good introduction find here:
http://www.ibm.com/developerworks/aix/library/au-zodb/
您可以尝试 STSdb、DB4O、Perst ...,它们可用于 C# 和 Java。
You could try out STSdb, DB4O, Perst ... which is available in C# and Java.