ELKI-使用列表< String>对象以填充数据库 [英] ELKI - Use List<String> of objects to populate the Database

查看:102
本文介绍了ELKI-使用列表< String>对象以填充数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很抱歉,您没有提出过天真的问题,但是在遵循所有可用教程的过程中,我陷入了困境. 因此,有没有一种方法可以从简单的列表填充数据库数据库,而不是通过读取文件来加载数据库数据库?

Sorry for the naive question, but I got stuck while following all the pieces of tutorials available. So, is there a way to populate a Database db from a simple List rather than loading it reading a file?

基本上我正在寻找的东西类似于:

Basically what I'm looking for is something similar to:

列出对象= ...

List objects = ...

数据库db = ClassGenericsUtil.parameterizeOrAbort(ArrayDatabase.class,params,objects);

Database db = ClassGenericsUtil.parameterizeOrAbort(ArrayDatabase.class, params, objects);

db.initialize();

db.initialize();

谢谢.

推荐答案

您的String的内容是什么? 与ELKI解析器理解的一样吗?

What are the contents of your Strings? Same as understood by the ELKI parsers?

这可能需要进行一些代码修改,因为解析器是围绕Java InputStream设计的.我不建议将List<String>包装到InputStream中,尽管这可能是最省力的方法.

This will likely require some code modifications, because the parsers are designed around Javas InputStream. I don't suggest wrapping a List<String> into an InputStream although that would probably be the least-effort approach.

为什么不尝试扩展AbstractDatabaseConnection(或实现DatabaseConnection)?数据库连接格式MultipleObjectsBundle不超过List<Object>和关系元数据;相当容易构建.

Why don't you try extending AbstractDatabaseConnection (or implementing DatabaseConnection)? The database connection format, MultipleObjectsBundle is not much more than List<Object> and relation metadata; fairly easy to construct.

或者,您可以使用自己的代码将String解析为double[],然后使用ArrayAdapterDatabaseConnection.它将为您包装double[]DoubleVector并构建捆绑包.

Alternatively, you could use your own code to parse the Strings into double[] and then use ArrayAdapterDatabaseConnection; which will wrap the double[] as DoubleVector for you and construct the bundles.

这篇关于ELKI-使用列表&lt; String&gt;对象以填充数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆