问题描述
很抱歉,您没有提出过天真的问题,但是在遵循所有可用教程的过程中,我陷入了困境.因此,有没有一种方法可以从简单的列表填充数据库数据库,而不是通过读取文件来加载数据库数据库?
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:
数据库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 String
s?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 String
s into double[]
and then use ArrayAdapterDatabaseConnection
; which will wrap the double[]
as DoubleVector
for you and construct the bundles.
这篇关于ELKI-使用列表< String>对象以填充数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!