设置二维表的核心数据 [英] Setting up Core Data for 2 dimensional table

查看:87
本文介绍了设置二维表的核心数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

+----+------------+------------+------------+
| id | infinitive | ind pre je | ind pre tu |
+----+------------+------------+------------+
|  1 | aimer      | aime       | aimes      |
|  2 | aller      | vais       | vas        |
|  3 | courir     | cours      | cours      |
|  4 | servir     | sers       | sers       |
|  5 | mourir     | meurs      | meurs      |
|  6 | dormir     | dors       | dors       |
|  7 | sentir     | sens       | sens       |
|  8 | vêtir      | vêts       | vêts       |
|  9 | fuir       | fuis       | fuis       |
| 10 | tenir      | tiens      | tiens      |
+----+------------+------------+------------+

我正在开发一个法语共轭应用,该应用通过以不定形式显示动词来测试用户的共轭和所需的时态。目的是让用户输入该动词的共轭形式并按下按钮以检查其答案。如果答案正确,则会生成一个新的动词,等等。

I'm working on a French conjugation app that tests users on their conjugation by displaying a verb in infinitive form and the tense required. The goal is for the user to input the conjugated form of that verb and press a button to check their answer. If the answer is correct, a new verb will be generated, etc.

我有一个二维数据集,请参见上面的表格的小尺寸版本数据。我正在尝试找出如何最好地在核心数据中设置数据库,因为它显然不适合核心数据所具有的一维实体属性模型。

I have a 2-dimensional data set, please see table above for a small-scale version of the data. I'm trying to work out how best to setup my database in core data because it doesn't clearly fit in the 1-dimensional entity-attribute model that core data has.

理想情况下,我希望能够允许用户选择他们要测试的时态,并对动词进行分类-正则,不规则,常用动词,等等。

Ideally I would like to be able to allow users to select which tenses they would like to be tested on and also categorising the verbs - regular form, irregular form, common verbs, etc.

我应该将每个共轭动词设为与其代词有关系的实体,而其代词又与其时态有关系,而后者又与不定式有关系动词形式?

Should I make each conjugated verb an entity that has a relationship with it's pronoun which has a relationship with its tense, which in turn has a relationship with its infinitive verb form?

例如:

ate --过去时-吃饭

(共轭形式)-(代词)-(时态)-(不定式形式)

(conjugated form)- (pronoun)- (tense) - (infinitive form)

推荐答案

我建议存储两个实体:动词和词缀。动词与词缀具有一对多关系。

I would recommend storing two entities: verbs and conjugations. Verbs has a one-to-many relationship with conjugations.

因此,动词具有以下属性:不定式 isRegular 共轭(关系)

So Verb would have the following properties: infinitive, isRegular conjugations(relationship)

每个共轭将具有:动词(关系),时态代词共轭

And each conjugation would have: verb (relationship), tense, pronoun, conjugation.

代词或时态的实体,因为它们是固定事物(总是恰好有3个时态),并且不会随用户数据的增加或减少。因此,使这些值成为枚举更有意义。

It does not make sense to have an entity for pronouns or tenses as they are set things (there are always exactly 3 tenses) and do not increase or decrease with the user's data. So it makes more sense for these values to be enums.

这篇关于设置二维表的核心数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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