本文介绍了用于存储与单个文件关联的元数据的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给出了具有关联元数据的文件集合,建议使用哪些存储该元数据的方法?

Given a collection of files which will have associated metadata, what are the recommended methods for storing this metadata?

某些文件格式支持在内部存储元数据(EXIF,ID3等),但并非所有文件格式都支持此功能,那么还有哪些更通用的选项呢?

Some files formats support storing metadata internally (EXIF,ID3,etc), but not all file formats support this, so what are more general options?

一些元数据几乎可以肯定是唯一的(标题/描述/等),而某些元数据在不同程度上可以重复(类别/标签/等).
如果需要不同类型的属性,则对元数据进行分组也可能很有用.

Some of the metadata would almost certainly be unique (titles/descriptions/etc), whilst some would be repetitive to varying degrees (categories/tags/etc).
It may also be useful to group the metadata, if different types of attribute are required.

理想情况下,解决方案应该涵盖概念,而不是特定的语言实现.

Ideally, solutions should cover concepts, rather than specific language implementations.

推荐答案

将元数据存储在数据库中具有一些优点,但是数据库的主要问题是元数据没有直接连接到您的数据.如果metada保留数据-例如目录中的特殊文件或类似的文件,则更可靠.

To store metadata in database has some advantages but main problem with database is that metadata are not directly connected to your data. It is more robust if metada stay with data - like special file in the directory or something like that.

某些文件系统提供了可用于元数据的特殊功能-例如 NTFS备用流.不幸的是,这只能用于特殊情况下的元数据存储,因为在将数据复制到不支持它的存储系统时,这些流很容易丢失.我相信linux文件系统也具有类似的存储机制.

Some filesystems offer special functionality that can be used for metadata - like NTFS Alternate streams. Unfortunately, this can be used for metadata storage in special cases only, because those streams can be easily lost when copying data to storage system that does not support it. I believe that linux filesystems have also similar storage mechanism.

无论如何,最常见的解决方案是:

Anyway, most common solutions are :

  • 单独的隐藏文件(每个目录),其中包含元数据
  • 某些应用程序将特殊隐藏目录与元数据一起使用(如Subversion,CVS等).
  • 数据库(各种类型)用于所有特定于应用程序的元数据-在大多数情况下,该数据库还可以用于缓存目的
  • separate hidden file(s) (per directory) that hold metadata
  • some application use special hidden directory with metadata (like subversion, cvs etc).
  • or database (of various kinds) for all application specific metada - this database can be used also for caching purposes in most cases

IMO没有通用解决方案.我会选择使用数据库来将元数据存储在隐藏文件中(稳健性),以使用数据库进行快速访问和缓存.

IMO there is no general purpose solution. I would choose storage of metadata in hidden file (robustness) with use of the database for fast access and caching.

这篇关于用于存储与单个文件关联的元数据的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 22:35