Пример #1
0
 public void ListsAreNotNull()
 {
     var archetypeOntology = new ArchetypeOntology();
     Assert.IsNotNull(archetypeOntology.ConstraintBindings);
     Assert.IsNotNull(archetypeOntology.ConstraintDefinitions);
     Assert.IsNotNull(archetypeOntology.TerminologyBindings);
     Assert.IsNotNull(archetypeOntology.TerminologyDefinitions);
     Assert.IsNotNull(archetypeOntology.ConstraintCodes);
     Assert.IsNotNull(archetypeOntology.TerminologyAttributeNames);
     Assert.IsNotNull(archetypeOntology.TerminologyCodes);
 }
Пример #2
0
 protected void Validate(ArchetypeOntology archetypeOntology)
 {
     Invariant(archetypeOntology.TerminologyesAvailable != null, "archetypeOntology.TerminologesAvailable must not be null.");
     Invariant(archetypeOntology.SpecialisationDepth >= 0, "archetypeOntology.SpecialisationDepth must be >=0.");
     Invariant(archetypeOntology.TermCodes != null, "archetypeOntology.TermCodes must not be null.");
     Invariant(archetypeOntology.ConstraintCodes != null, "archetypeOntology.ConstraintCodes must not be null.");
     Invariant(archetypeOntology.TermAttributeNames != null, "archetypeOntology.TermAttributeNames must not be null.");
     Invariant(archetypeOntology.ParentArchetype != null, "archetypeOntology.PaentArchetype must not be null.");
     Invariant(archetypeOntology.TermAttributeNames.Has("text"), "archetypeOntology.TermAttributeNames must have 'text'");
     Invariant(archetypeOntology.TermAttributeNames.Has("description"), "archetypeOntology.TermAttributeNames must have 'description'");
 }
Пример #3
0
        public void ListsAreNotNull()
        {
            var archetypeOntology = new ArchetypeOntology();

            Assert.IsNotNull(archetypeOntology.ConstraintBindings);
            Assert.IsNotNull(archetypeOntology.ConstraintDefinitions);
            Assert.IsNotNull(archetypeOntology.TerminologyBindings);
            Assert.IsNotNull(archetypeOntology.TerminologyDefinitions);
            Assert.IsNotNull(archetypeOntology.ConstraintCodes);
            Assert.IsNotNull(archetypeOntology.TerminologyAttributeNames);
            Assert.IsNotNull(archetypeOntology.TerminologyCodes);
        }
Пример #4
0
        public Archetype(ArchetypeId archetypeId, string concept, CComplexObject definition,
                         ArchetypeOntology ontology, CodePhrase originalLanguage, RevisionHistory revisionHistory,
                         bool isControlled)
            : base(originalLanguage, revisionHistory, isControlled)
        {
            Check.Require(archetypeId != null, string.Format(CommonStrings.XMustNotBeNull, "archetypeId"));
            Check.Require(!string.IsNullOrEmpty(concept) != null, string.Format(CommonStrings.XMustNotBeNullOrEmpty, "concept"));
            Check.Require(definition != null, string.Format(CommonStrings.XMustNotBeNull, "definition"));
            Check.Require(ontology != null, string.Format(CommonStrings.XMustNotBeNull, "ontology"));

            this.archetypeId = archetypeId;
            this.definition  = definition;
            this.ontology    = ontology;
        }
Пример #5
0
 public void GetConstraintBindingThrowsException()
 {
     var archetypeOntology = new ArchetypeOntology();
     var result            = archetypeOntology.GetConstraintBinding(string.Empty, string.Empty);
 }
Пример #6
0
 public void HasConstraintCodeThrowsException()
 {
     var archetypeOntology = new ArchetypeOntology();
     var result            = archetypeOntology.HasConstraintCode(string.Empty);
 }
Пример #7
0
 public void HasTerminologyThrowsException()
 {
     var archetypeOntology = new ArchetypeOntology();
     var result            = archetypeOntology.HasTerminology(string.Empty);
 }
Пример #8
0
 public void HasLanguageThrowsException()
 {
     var archetypeOntology = new ArchetypeOntology();
     var result            = archetypeOntology.HasLanguage(string.Empty);
 }
Пример #9
0
 public void HasTerminologyThrowsException()
 {
     var archetypeOntology = new ArchetypeOntology();
     var result = archetypeOntology.HasTerminology(string.Empty);
 }
Пример #10
0
 public void HasLanguageThrowsException()
 {
     var archetypeOntology = new ArchetypeOntology();
     var result = archetypeOntology.HasLanguage(string.Empty);
 }
Пример #11
0
 public void HasConstraintCodeThrowsException()
 {
     var archetypeOntology = new ArchetypeOntology();
     var result = archetypeOntology.HasConstraintCode(string.Empty);
 }
Пример #12
0
 public void GetTerminologyBindingThrowsException()
 {
     var archetypeOntology = new ArchetypeOntology();
     var result = archetypeOntology.GetTerminologyBinding(string.Empty, string.Empty);
 }
Пример #13
0
 public void GetConstraintDefinitionThrowsException()
 {
     var archetypeOntology = new ArchetypeOntology();
     var result = archetypeOntology.GetConstraintDefinition(string.Empty, string.Empty);
 }
Пример #14
0
        public static ArchetypeOntology Map(this ARCHETYPE_ONTOLOGY model)
        {
            var ontology = new ArchetypeOntology();

            //TermDefinitions
            if (model.term_definitions != null)
            {
                foreach (CodeDefinitionSet definition in model.term_definitions)
                {
                    var itemlist = new List <ArchetypeTerminology>();
                    foreach (ARCHETYPE_TERM item in definition.items)
                    {
                        var archetypeTerminology = new ArchetypeTerminology
                        {
                            Code = item.code
                        };
                        foreach (StringDictionaryItem item2 in item.items)
                        {
                            archetypeTerminology.Items.Add(item2.id, item2.TypedValue);
                        }
                        itemlist.Add(archetypeTerminology);
                    }
                    ontology.TerminologyDefinitions.Add(definition.language, itemlist);
                }
            }

            //TermBindings
            if (model.term_bindings != null)
            {
                foreach (TermBindingSet bindingSet in model.term_bindings)
                {
                    Dictionary <string, CodePhrase> items = bindingSet.items.ToDictionary(item => item.code,
                                                                                          item => item.value.Map());
                    ontology.TerminologyBindings.Add(bindingSet.terminology, items);
                }
            }

            //ConstraintDefinitions
            if (model.constraint_definitions != null)
            {
                foreach (CodeDefinitionSet definition in model.constraint_definitions)
                {
                    var itemlist = new List <ArchetypeTerminology>();
                    foreach (ARCHETYPE_TERM item in definition.items)
                    {
                        var archetypeTerminology = new ArchetypeTerminology
                        {
                            Code = item.code
                        };
                        foreach (StringDictionaryItem item2 in item.items)
                        {
                            archetypeTerminology.Items.Add(item2.id, item2.TypedValue);
                        }
                        itemlist.Add(archetypeTerminology);
                    }
                    ontology.ConstraintDefinitions.Add(definition.language, itemlist);
                }
            }

            //ConstraintBindings
            if (model.constraint_bindings != null && model.constraint_bindings.Count > 0)
            {
                throw new NotImplementedException();
            }

            return(ontology);
        }