Development with DocDigitizer WorldObjects
Get a First Look at How to Use DocDigitizer World Objects as a Semantic Engine
This chapter will give you a glance at the capabilities of DocDigitizer World Objects and how to use it.
Demonstration using "Citizen card" as a Business Object
Step 1 — Open Visual Code and log in using your account (for this exercise we are using a Google account)
![Login.png 496](https://files.readme.io/8ddeba3-Login.png)
Step 2 — The “World Objects” source folders should appear
![SourceView.png 494](https://files.readme.io/117f723-SourceView.png)
Step 3 — Analyse the following Objects that represent "Citizen card," their properties, and references
![Picture3.png 566](https://files.readme.io/60011a1-Picture3.png)
Step 3.1 — The "Citizen Card" object has a reference to "Country"
![Picture4.png 487](https://files.readme.io/644e223-Picture4.png)
Step 3.2 — The "Country" object has a reference to "Language" (permit to have the name of the country in a different language/dialect)
![Picture5.png 567](https://files.readme.io/5c5050b-Picture5.png)
Step 3.3 — The "Language" object has a reference to "Dialect" (representation dialect of each language)
![Picture6.png 437](https://files.readme.io/e72e900-Picture6.png)
Step 4 — Producer Code (add values to Catalog)
In this lesson, we are using the "CitizenCard" Object
CitizenCard cc = new();
cc.Name = "António Paiva";
cc.Id = "12567893";
cc.NIF = "155331639";
cc.BirthDate = new DateTimeOffset(new DateTime(1965, 9, 25));
cc.Sex = Sex.FromCatalog(Sex.Constants.Male_);
cc.Nacionality = Country.FromCatalog(Country.Constants.JP_);
cc.Address.Street = "R. em Lisboa";
cc.Address.ZipCode.Code = "1500-297";
cc.Address.ZipCode.City = "Lisboa";
cc.Address.Country = Country.FromCatalog("PT");
cc.Address.ZipCode.Details = ZipCodeDetails.FromCatalog($"{Country.Constants.PT_}:{cc.Address.ZipCode.Code}");
cc.Family.Add(new() { FamilyMember = FamilyMember.FromCatalog(FamilyMember.Constants.Father_), Name = "Father of António" });
cc.Family.Add(new() { FamilyMember = FamilyMember.FromCatalog(FamilyMember.Constants.Mother_), Name = "Mother of António" });
Step 5 — Consumer Code (show values from Catalog)
Consuming the Object "CitizenCard" previously created
switch (r.Structured.ObjectType)
{
case CitizenCard.ObjectTypeCase:
CitizenCard cc = r.GetStructured<CitizenCard>();
c.WriteInfoLine($"{StringLib.Indent(2)}Name : {cc.Name}");
c.WriteInfoLine($"{StringLib.Indent(2)}Id : {cc.Id}");
c.WriteInfoLine($"{StringLib.Indent(2)}NIF : {cc.NIF}");
c.WriteInfoLine($"{StringLib.Indent(2)}Nacionality : {cc.Nacionality.Name}");
c.WriteInfoLine($"{StringLib.Indent(2)}Language : {cc.Nacionality.PrimaryLanguage.Name}");
c.WriteInfoLine($"{StringLib.Indent(2)}Sex : {cc.Sex.Description}");
c.WriteLine();
c.WriteInfoLine($"{StringLib.Indent(2)}Family :");
foreach (var fm in cc.Family)
c.WriteInfoLine($"{StringLib.Indent(3)}{fm.FamilyMember.Description}: {fm.Name}");
c.WriteLine();
c.WriteInfoLine($"{StringLib.Indent(2)}Address : {cc.Address.Street}");
c.WriteInfoLine($"{StringLib.Indent(2)} : {cc.Address.ZipCode.Code} {cc.Address.ZipCode.City}");
c.WriteInfoLine($"{StringLib.Indent(2)} : {cc.Address.Country.Name}");
c.WriteLine();
string[] detailLines = StringLib.ToString(cc.Address.ZipCode.Details.Detail).Split(Environment.NewLine);
c.WriteInfoLine($"{StringLib.Indent(2)}ZipCode Detail :");
foreach(string l in detailLines) c.WriteInfoLine($"{StringLib.Indent(3)}{l}");
break;
}
Step 6 — Consumer operation
![Picture9.png 566](https://files.readme.io/3a8e95d-Picture9.png)
Step 7 — Changing language dialect
In this example, in “Japanese” (JP) there are only values for properties “Language” & “Country”
For this reason, the values for “Sex” & “FamilyMember” appears in ”English." In “Portuguese” (PT), values for all the properties exist.
![Picture10.png 566](https://files.readme.io/65afbb8-Picture10.png)
![Picture11.png 567](https://files.readme.io/c62d5b1-Picture11.png)
Updated about 2 years ago