Skip to content

Entity Definition

Pu Chen edited this page Oct 16, 2017 · 1 revision

Let's define some entities/nouns so that we can take advantage of Grammaticus' grammar engine.

names.xml

This file contains the entities(nouns)/adjectives for a given language. names.xml is the default name. If you want to use other name instead of names.xml, please refer to Configure Grammaticus section of Getting Started.

names.xml is backed by names.dtd.

Define entity(noun)

Following is the DTD to define a standard entity(noun).

<!ELEMENT noun (value)+>
<!ATTLIST noun
  name          ID          #REQUIRED
  alias		CDATA       #IMPLIED
  entity	CDATA	    #IMPLIED
  access        CDATA       #IMPLIED
  %noun.type;               #IMPLIED
  %gender;                   "n"
  %starts;                  #REQUIRED
  %standardField;	    "y"
  >
Attribute Description
name The name of entity. To be used in message.
alias The alias name for plural form.
entity The object type associated with this label.
Type "entity" if this is for standard object, where all form are required "field" if this requires both singular/plural form, other forms are not required, but can be specified and renamed

An example for names.xml with an entity definition.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE names SYSTEM "names.dtd">
<names>
<noun name="Activity" entity="Activity" type="entity" alias="Activities"
	gender="n" startsWith="v">
	<value plural="n">Activity</value>
	<value plural="y">Activities</value>
</noun>
</names>

Define adjectives

Following is the DTD for adjective definition.

<!ELEMENT adjective (value)+>
<!ATTLIST adjective
  name          ID          #REQUIRED
  position      (b|a)       #IMPLIED
  %starts;                  "c"
  >

An example to define an adjective.

<adjective name="My" startsWith="c">
   <value plural="n">My</value>
</adjective>

Define article

Following is the DTD for adjective definition.

<!ELEMENT article (value)+>
<!ATTLIST article
  name          ID          #REQUIRED
  type          (n|a|the|i|d)     #REQUIRED
  >

An example to define an article.

<article name="The" type="the">
   <value plural="n">The</value>
</article>