尽管JAVA API应该是一种解决方案,但我想使用etl来加载图形.更新:最后,我弄清楚了Stack Overflow的工作原理.我不应该尝试在评论中插入数据,而是更新问题.这是我的问题的具体示例:两种类型的顶点:大师(约翰,乔伊,迈克尔,罗伯特,艾伦),宠物(史努比,白色,蓝色). 两种类型的关系:喜欢(约翰喜欢史努比,迈克尔喜欢怀特,迈克尔喜欢蓝色,艾伦喜欢史努比,迈克尔喜欢怀特),属于(史努比属于Joey,怀特属于Robert,Blue属于John). 如何使用OETL将这个小网络导入OrientDB?解决方案 OrientDB ETL 工具允许您从外部源加载图形.如果您阅读OriendDB-ETL简介,读取由记录集合构成的源,对每行应用转换以生成文档记录(或顶点和可选的egdes,记住OrientDB是底层的文档数据库,它也支持图形),然后将生成的文档(或顶点/边)加载到OrientDB中.您应该使用多个JSON ETL文件来加载多个源,但是在每个源中,您可以加载多个顶点类和边,具体取决于所应用的转换(您可以应用多个).输入源可以是SQL数据库,CSV和JSON格式的文件.有关具有多个顶点类型和通过CSV源构建的边的示例,请参见 导入啤酒数据库" .使用数据库(SQL)表作为数据源时,请查看导入来自DBMS . 对于表,通常将A -edge-> B映射到关系表中(例如,对于多对多或当边缘本身具有属性时),而对于更简单的边缘类型(一对一,一对一-很多...)习惯上有一个简单的外键.ETL配置以JSON格式给出,对于SQL数据库,您可以配置SQL查询(给出结果表")以及如何将结果字段映射到顶点和相关边. 当您有多个源时,您可以添加多个JSON ETL命令,但是在处理每个源时,您可以使用变形器(请参见变形器文档中的VERTEX,EDGE和MERGE)以创建顶点和相关边. CSV转换器甚至可以直接从每个CSV行创建一个ODocument.注意:作为ETL工具(相对较新)的替代方法,您可以使用Java API以编程方式将数据导入OrientDB数据库.如果您需要加载庞大的图形,这是推荐的方法,因为您可以完全控制如何将数据加载到OrientDB中.I have 3 tables, one is for vertex A, one is for vertex B, and the third is for edges from B to A. How can I import this graph to OrientDB? For now, the tutorial just says how to import two csv files, one is for vertex A, and the other one is for vertex B and connected vertices from A. Load vertex A, then load vertex B and creating edges from A to B in the mean time.This works for simple graphs. But for complicated graphs, for example, I have three types of vertices, A, B and C, three types of edges, A -> B, B -> C, C -> A, how can I import this graph?I want to use the etl to load the graph although JAVA API should be a solution.Update:Finally, I figured out how Stack Overflow works. I shouldn't try to insert data in the comment, update the question instead.This is a concrete example for my question:Two types of vertices:masters(John, Joey, Michael, Robert, Allen),pets(Snoopy, White, Blue).Two types of relationships:like(John likes Snoopy, Michael linkes White, Michael likes Blue, Allen likes Snoopy, Michael likes White),belong to(Snoopy belongs to Joey, White belongs to Robert, Blue belongs to John).How can I import this little network into OrientDB using OETL? 解决方案 OrientDB ETL facility allows you to load graph from external sources. If you read the OriendDB-ETL introduction,a source made by a collection of records is read, a transformation is applied on each row to generate a document record (or vertex and optionally egdes, remember that OrientDB is a document database under the hood, that also supports graphs), and then load the generated documents (or vertex/edges) in OrientDB.You should use multiple JSON ETL files to load more than a single source, but in each source you may load multiple vertex classes and edges, depending on the transformations applied (you may apply multiple). Input sources could be SQL databases, CSV- and JSON - formatted files. For an example with multiple vertex types and edges built from CSV sources, see "Import the database of beers".When using database (SQL) tables as data source, take a look at Import from DBMS. For tables, it is typically to have A -edge-> B mapped into a relation table (e.g. for many-to-many or when edge itself have properties), while for simpler edge kinds (one-to-one, one-to-many...) a simple foreign key is customary.ETL configuration is given in JSON format, and for SQL databases you may configure a SQL query (giving a "results table") and how to map the result fields to both vertex and related edges. You may add multiple JSON ETL commands, when you have multiple sources, but when processing each source, you may usetransformers (see VERTEX, EDGE and MERGE in Transformers documentation) for creating vertices and related edges. The CSV transformer may even create an ODocument straight from each CSV row.Note: as an alternative to the ETL facility (which is relatively new), you may use the Java API for programmatically importing data into OrientDB databases. If you need to load huge graphs this is the recommended way, as you have full control on how data is loaded into OrientDB. 这篇关于使用etl将边缘导入OrientDB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-14 15:13