public Concept CreateConcept(Concept conceptToCreate)
 {
     conceptToCreate.LastUpdated = DateTime.Now;
     _conceptRepository.Add(conceptToCreate);
     _conceptRepository.Persist();
     Log.Debug("Concept added");
     return conceptToCreate;
 }
示例#2
0
        /// <summary>
        /// Create a QualityStatement from scratch, and add it to a Repository.
        /// </summary>
        public QualityStatement CreateAndRegisterQualityStatement()
        {
            // Create the QualityStatement object and give it a label.
            QualityStatement statement = new QualityStatement();
            statement.Label.Current = "Sample Quality Statement";

            // A QualityStatement is made up of QualityStatementItems.
            // QualityStatementItems have two important pieces of information:
            // a defining Concept, and some content.
            // The defining Concept specifies the type of information recorded
            // by the item. For example, "Contact organization".
            // The content is the actual information, like "Statistics Denmark".

            // First, let's create the Concepts.
            Concept concept1 = new Concept();
            concept1.Label.Current = "Contact organization";

            Concept concept2 = new Concept();
            concept2.Label.Current = "Statistical Unit";

            Concept concept3 = new Concept();
            concept3.Label.Current = "Statitistical Population";

            // Now let's create the QualityStatementItems, and assign the appropriate
            // Concepts and some information.
            QualityStatementItem item1 = new QualityStatementItem();
            item1.ComplianceConcept = concept1;
            item1.ComplianceDescription.Current = "Statistics Denmark";

            QualityStatementItem item2 = new QualityStatementItem();
            item2.ComplianceConcept = concept2;
            item2.ComplianceDescription.Current = "Person";

            QualityStatementItem item3 = new QualityStatementItem();
            item3.ComplianceConcept = concept3;
            item3.ComplianceDescription.Current = "Denmark";

            // Add each of the items to the QualityStatement.
            statement.Items.Add(item1);
            statement.Items.Add(item2);
            statement.Items.Add(item3);

            // Add the QualityStatement and the Concepts to the Repository.
            var client = RepositoryIntro.GetClient();
            CommitOptions options = new CommitOptions();
            client.RegisterItem(statement, options);
            client.RegisterItem(concept1, options);
            client.RegisterItem(concept2, options);
            client.RegisterItem(concept3, options);

            // Also, write an XML file just so we can see how things look.
            string fileName = @"statement.xml";
            DDIWorkflowSerializer serializer = new DDIWorkflowSerializer();
            serializer.SerializeFragments(fileName, statement);

            return statement;
        }
        public Concept UpdateConcept(Concept updatedConcept)
        {
            var conceptToUpdate = _conceptRepository.FindOne(c => c.Id == updatedConcept.Id);
            conceptToUpdate.ConceptTerm = updatedConcept.ConceptTerm;
            conceptToUpdate.LastUpdated = DateTime.Now;
            _conceptRepository.Persist();

            return conceptToUpdate;
        }
		public bool TryGetFactValue(Concept concept, out int value)
		{
			if (facts.ContainsKey(concept))
			{
			    value = facts[concept];
			    return true;
			}
			else
				value = 0;
				return false;
		}
 public void Verify_Add_Should_AddTheEntityToTheContext()
 {
     // Arrange
     Mock<IDbSet<Concept>> mockSetConcepts;
     var mockContext = ConceptsMockingSetup.DoMockingSetupForContext(false, out mockSetConcepts);
     var repository = new ConceptsRepository(mockContext.Object);
     var concepts = new Concept { Active = true, CustomKey = "SALVATORE-RAA", };
     // Act
     repository.Add(concepts);
     // Assert
     mockSetConcepts.Verify(x => x.Add(concepts), Times.Once);
 }
示例#6
0
        internal static ConceptRef Create(Concept concept)
        {
            if (concept == null)
                return null;

            ConceptRef conceptRef = new ConceptRef();
            conceptRef.Id = concept.Id;
            conceptRef.Version = concept.Version;
            conceptRef.AgencyId = concept.AgencyId;
            conceptRef.SchemeRef = ConceptSchemeRef.Create(concept.ConceptScheme);

            return conceptRef;
        }
示例#7
0
        public ActionResult Create(Concept concept, FormCollection form)
        {
            //if (ModelState.IsValid)
            //{

            //Concept concept = new Concept();
            // Deserialize (Include white list!)
            bool isModelUpdated = TryUpdateModel(concept, new[] { "ConceptName" }, form.ToValueProvider());
            
            // Validate
            if (String.IsNullOrEmpty(concept.ConceptTerm))
                ModelState.AddModelError("ConceptName", "Concept Name is required!");

            if (ModelState.IsValid)
            {
                _conceptApplicationService.CreateConcept(concept);

                return RedirectToAction("Index");
            }

            return View(concept);
        }
示例#8
0
 public ActionResult Edit(Concept concept, FormCollection form)
 {
     _conceptApplicationService.UpdateConcept(concept);
     return RedirectToAction("Index");
 }
        private void CreateVariableGroups()
        {
            //Get concepts that are used, add the implicit ones and except for "0" create variable groups from them in the relevant variable scheme and put into the working set
             this.usedConcepts = variablesConcepts.Values.Distinct().ToList();

             //add implicit level-1 groups that are parents of level-2 groups
             var implicits = new List<string>();
             foreach (var uc in this.usedConcepts)
             {
                 if (uc.Length == 1 + 2 + 2)
                 {
                     if (!usedConcepts.Contains(uc.Substring(0, 3)))
                     {
                         implicits.Add(uc.Substring(0,3));
                     }
                 }
             }
             this.usedConcepts.AddRange(implicits.Distinct());

            //get the concept scheme from the repository
            //I assume there is only one
            //if there is none, get concepts from the working set
            ConceptScheme vgConceptScheme = new ConceptScheme();
            var client = Utility.GetClient();
            var facet = new SearchFacet();
            facet.ItemTypes.Add(DdiItemType.ConceptScheme);
            SearchResponse response = client.Search(facet);
            bool fromRepo = false;
            if (response.ReturnedResults > 0)
            {
                fromRepo = true;
                vgConceptScheme = client.GetItem(response.Results[0].CompositeId, ChildReferenceProcessing.Populate) as ConceptScheme;
            }

             var variableScheme = WorkingSet.OfType<VariableScheme>().Where(x => string.Compare(x.ItemName.Best, this.vsName, ignoreCase: true) == 0).First();
             foreach (var uc in this.usedConcepts)
             {
                 if (uc != "0")
                 {
                     VariableGroup vg = new VariableGroup();
                     vg.TypeOfGroup = "ConceptGroup";
                     Concept vgConcept = new Concept();
                     if (fromRepo)
                     {
                         vgConcept = vgConceptScheme.Concepts.Where(x => string.Compare(x.ItemName.Best, uc, ignoreCase: true) == 0).First();
                     }
                     else    //from working set
                     {
                         vgConcept = WorkingSet.OfType<Concept>().Where(x => string.Compare(x.ItemName.Best, uc, ignoreCase: true) == 0).First();
                     }

                     vg.Concept = vgConcept;
                     vg.ItemName.Add("en-GB", "Variable Group - " + vgConcept.Label.Best);
                     //Trace.WriteLine("   " + vg.ItemName.Best);
                     variableScheme.VariableGroups.Add(vg);
                 }
             }
             WorkingSet.AddRange(variableScheme.VariableGroups);
             Trace.WriteLine("  concept groups: " + variableScheme.VariableGroups.Count().ToString() + " for " + this.vsName);
        }
示例#10
0
 public ConversationEventArgs( Concept.ConversationInfo info )
 {
     Info = info;
 }
 private string CreateEntry(Concept.Message message)
 {
     return String.Format(_messageTemplate, message.Timestamp, message.Conversation.Identifier, message.Author.Name);
 }
示例#12
0
    public void GeneratePreviewFromConcept(Unitoken core, Concept concept)
    {
        StartCoroutine(GenerateEdges(core, concept));

        Debug.Log("Generating Concept Edges");
    }
示例#13
0
        public Concept CreateAndInsertAConcept()
        {
            Language language = null;
            var      guid     = Guid.Parse("C56A4180-65AA-42EC-A945-5FD21DEC0538");

            var category = new MetaCategory
            {
                Name        = "Name",
                Description = "Description"
            };
            var typeGroup = new TypeGroup
            {
                Name        = "Name",
                Description = "Description"
            };

            var status = new Status
            {
                Name              = "Name",
                Description       = "Description",
                LanguageVariation = Guid.NewGuid()
            };

            var meta = new MetaData
            {
                Name              = "Name",
                Abbreviation      = "Abb",
                Description       = "Description",
                Category          = category,
                Status            = status,
                LanguageVariation = Guid.NewGuid()
            };
            //MediaTypes
            var mediaType = new MediaType
            {
                Title = "Title"
            };
            //Media
            var media = new Media
            {
                Source      = "MediaSource",
                MediaTypeId = mediaType.Id
            };

            var concept = new Concept
            {
                AuthorEmail       = "AuthorEmail",
                SourceAuthor      = "SourceAuthor",
                AuthorName        = "AuthorName",
                Content           = "Content",
                Source            = "Source",
                Title             = "Title",
                ExternalId        = "ExternalID",
                GroupId           = guid,
                LanguageVariation = guid,
                MediaIds          = new List <int>()
            };

            language            = InsertLanguage(language);
            category.LanguageId = language.Id;
            category.TypeGroup  = typeGroup;
            status.LanguageId   = language.Id;
            meta.LanguageId     = language.Id;
            concept.LanguageId  = language.Id;

            category = InsertCategory(category);

            status = InsertStatus(status);

            meta.Category = category;
            meta.Status   = status;
            meta          = InsertMeta(meta);

            concept.MediaIds = new List <int>();
            concept.Meta     = new List <MetaData> {
                meta
            };
            concept.MetaIds = new List <int> {
                meta.Id
            };
            concept.Status = status;
            concept.Media  = new List <Media> {
                media
            };

            concept = InsertConcept(concept);

            return(concept);
        }
示例#14
0
        private void AddEntity(QueryDefinition queryDefinition, IEnumerable <EntityDefinition> definitions,
                               IDataRecord reader, Guid recordGuid, string definitionName)
        {
            if (definitions == null)
            {
                return;
            }

            foreach (var d in queryDefinition.FindDefinition(definitions, reader))
            {
                var personId = reader.GetLong(d.PersonId);

                try
                {
                    Concept conceptDef = null;
                    if (d.Concepts != null && d.Concepts.Any())
                    {
                        conceptDef = d.Concepts[0];
                    }

                    bool added;
                    var  pb =
                        personBuilders.GetOrAdd(personId.Value, key => new Lazy <IPersonBuilder>(() => createPersonBuilder()),
                                                out added).Value;

                    if (pb.Chunk == null)
                    {
                        pb.JoinToChunkData(chunk);
                    }

                    pb.JoinToVocabulary(d.Vocabulary);
                    var keyMasterOffset = pb.Chunk.KeyMasterOffset;

                    foreach (var entity in d.GetConcepts(conceptDef, reader, keyMasterOffset))
                    {
                        if (entity == null)
                        {
                            continue;
                        }

                        entity.SourceRecordGuid = recordGuid;
                        AddEntity(entity);

                        switch (entity.GeEntityType())
                        {
                        case EntityType.DrugExposure:
                        {
                            if (queryDefinition.DrugCost != null && queryDefinition.DrugCost[0].Match(reader))
                            {
                                AddChildData(entity, queryDefinition.DrugCost[0].CreateEnity((DrugExposure)entity, reader));
                            }
                            break;
                        }

                        case EntityType.ProcedureOccurrence:
                        {
                            if (queryDefinition.ProcedureCost != null && queryDefinition.ProcedureCost[0].Match(reader))
                            {
                                AddChildData(entity,
                                             queryDefinition.ProcedureCost[0].CreateEnity((ProcedureOccurrence)entity, reader,
                                                                                          keyMasterOffset));
                            }
                            break;
                        }

                        case EntityType.VisitOccurrence:
                        {
                            if (queryDefinition.VisitCost != null && queryDefinition.VisitCost[0].Match(reader))
                            {
                                AddChildData(entity,
                                             queryDefinition.VisitCost[0].CreateEnity((VisitOccurrence)entity, reader,
                                                                                      keyMasterOffset));
                            }
                            break;
                        }

                        case EntityType.DeviceExposure:
                        {
                            if (queryDefinition.DeviceCost != null && queryDefinition.DeviceCost[0].Match(reader))
                            {
                                AddChildData(entity,
                                             queryDefinition.DeviceCost[0].CreateEnity((DeviceExposure)entity, reader,
                                                                                       keyMasterOffset));
                            }
                            break;
                        }

                        case EntityType.Observation:
                        {
                            if (queryDefinition.ObservationCost != null && queryDefinition.ObservationCost[0].Match(reader))
                            {
                                AddChildData(entity,
                                             queryDefinition.ObservationCost[0].CreateEnity((Observation)entity, reader));
                            }
                            break;
                        }

                        case EntityType.Measurement:
                        {
                            if (queryDefinition.MeasurementCost != null && queryDefinition.MeasurementCost[0].Match(reader))
                            {
                                AddChildData(entity,
                                             queryDefinition.MeasurementCost[0].CreateEnity((Measurement)entity, reader));
                            }
                            break;
                        }
                        }
                    }
                }
                catch (Exception e)
                {
                    throw new Exception(string.Format("PersonId={0} | DefinitionFileName={1} | DefinitionName={2}", personId, queryDefinition.FileName, definitionName), e);
                }
            }
        }
示例#15
0
 public int GetIndex(Concept concept)
 {
     return(_concepts[concept.Mode].IndexOf(concept));
 }
示例#16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ConceptViewModel"/> class.
 /// </summary>
 /// <param name="concept">The concept.</param>
 /// <param name="conceptSetId">The guid of the Concept Set that the Concept is associated with</param>
 public ConceptViewModel(Concept concept, Guid conceptSetId) : this(concept)
 {
     ConceptSetId = conceptSetId;
 }
示例#17
0
 public Concept InsertConcept(Concept concept)
 {
     throw new NotImplementedException();
 }
示例#18
0
        public TestSemanticNetwork(ILanguage language)
        {
            #region Semantic network

            SemanticNetwork = new SemanticNetwork(language);
            SemanticNetwork
            .WithModule <BooleanModule>()
            .WithModule <ClassificationModule>()
            .WithModule <SetModule>()
            .WithModule <MathematicsModule>()
            .WithModule <ProcessesModule>();
            ((LocalizedStringVariable)SemanticNetwork.Name).SetLocale("ru-RU", "Тестовая база знаний");
            ((LocalizedStringVariable)SemanticNetwork.Name).SetLocale("en-US", "Test knowledgebase");

            #endregion

            #region Subject Areas

            SemanticNetwork.Concepts.Add(SubjectArea_Transport = new Concept(nameof(SubjectArea_Transport), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Транспорт" },
                { "en-US", "Transport" },
            }), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Средства передвижения." },
                { "en-US", "Vehicles." },
            })));

            SemanticNetwork.Concepts.Add(SubjectArea_Numbers = new Concept(nameof(SubjectArea_Numbers), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Числа" },
                { "en-US", "Numbers" },
            }), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Числа." },
                { "en-US", "Numbers." },
            })));

            SemanticNetwork.Concepts.Add(SubjectArea_Processes = new Concept(nameof(SubjectArea_Processes), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Процессы" },
                { "en-US", "Processes" },
            }), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Процессы." },
                { "en-US", "Processes." },
            })));

            #endregion

            #region Base Concepts

            SemanticNetwork.Concepts.Add(Base_Vehicle = new Concept(nameof(Base_Vehicle), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Транспортное средство" },
                { "en-US", "Vehicle" },
            }), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Устройство для перевозки людей и/или грузов." },
                { "en-US", "System which is indended for transportation of humans and cargo." },
            })));

            #endregion

            #region Signs

            SemanticNetwork.Concepts.Add(Sign_MotorType = new Concept(nameof(Sign_MotorType), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Движитель" },
                { "en-US", "Mover" },
            }), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Система, обеспечивающая движение." },
                { "en-US", "Initiator of movement." },
            })));

            SemanticNetwork.Concepts.Add(Sign_AreaType = new Concept(nameof(Sign_AreaType), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Среда передвижения" },
                { "en-US", "Movement area" },
            }), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Среда, для которой предназначено транспортное средство." },
                { "en-US", "Place, where vehicles can move." },
            })));

            #endregion

            #region Motor types

            SemanticNetwork.Concepts.Add(MotorType_Muscles = new Concept(nameof(MotorType_Muscles), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Мускульная сила" },
                { "en-US", "Muscles" },
            }), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Использования для приведения в движение мускульной силы: собственной, других людей, животных." },
                { "en-US", "To use own muscles in order to move." },
            })));

            SemanticNetwork.Concepts.Add(MotorType_Steam = new Concept(nameof(MotorType_Steam), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Паровая тяга" },
                { "en-US", "Steam engine" },
            }), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Использование для движения расширяющей силы нагретого пара." },
                { "en-US", "To use steam engine to move." },
            })));

            SemanticNetwork.Concepts.Add(MotorType_Combusion = new Concept(nameof(MotorType_Combusion), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Внутреннее сгорание" },
                { "en-US", "Combustion engine" },
            }), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Использование для движения расширяющей силы топлива, сжигаемого в закрытых цилиндрах." },
                { "en-US", "To use combustion engine to move." },
            })));

            SemanticNetwork.Concepts.Add(MotorType_Jet = new Concept(nameof(MotorType_Jet), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Реактивная тяга" },
                { "en-US", "Jet engine" },
            }), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Выталкивание вещества в обратном направлении, обычно сжигаемого топлива." },
                { "en-US", "To use jet engine to move." },
            })));

            #endregion

            #region Area types

            SemanticNetwork.Concepts.Add(AreaType_Ground = new Concept(nameof(AreaType_Ground), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Земля" },
                { "en-US", "Ground" },
            }), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Наземный транспорт." },
                { "en-US", "Plain ground." },
            })));

            SemanticNetwork.Concepts.Add(AreaType_Water = new Concept(nameof(AreaType_Water), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Вода" },
                { "en-US", "Water" },
            }), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Плавучий транспорт." },
                { "en-US", "Water surface." },
            })));

            SemanticNetwork.Concepts.Add(AreaType_Air = new Concept(nameof(AreaType_Air), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Воздух" },
                { "en-US", "Air" },
            }), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Возможность полёта." },
                { "en-US", "Fly in air." },
            })));

            #endregion

            #region Certain Transportation Devices

            SemanticNetwork.Concepts.Add(Vehicle_Bicycle = new Concept(nameof(Vehicle_Bicycle), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Велосипед" },
                { "en-US", "Bicycle" },
            }), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Двухколёсный даритель радости." },
                { "en-US", "Two wheels of fun." },
            })));

            SemanticNetwork.Concepts.Add(Vehicle_Curragh = new Concept(nameof(Vehicle_Curragh), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Курага" },
                { "en-US", "Curragh" },
            }), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Первая человеческая потуга создать лодку." },
                { "en-US", "It is not a bot itself yet." },
            })));

            SemanticNetwork.Concepts.Add(Vehicle_SteamLocomotive = new Concept(nameof(Vehicle_SteamLocomotive), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Паровоз" },
                { "en-US", "Steam locomotive" },
            }), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Устаревший тип локомотива." },
                { "en-US", "Obsolete train." },
            })));

            SemanticNetwork.Concepts.Add(Vehicle_Steamboat = new Concept(nameof(Vehicle_Steamboat), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Пароход" },
                { "en-US", "Steamboat" },
            }), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Устаревший тип корабля." },
                { "en-US", "Obsolete boat type." },
            })));

            SemanticNetwork.Concepts.Add(Vehicle_Car = new Concept(nameof(Vehicle_Car), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Автомобиль" },
                { "en-US", "Car" },
            }), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Четырёхколёсное механическое т/с." },
                { "en-US", "4-wheels standard vehicle." },
            })));

            SemanticNetwork.Concepts.Add(Vehicle_Motorcycle = new Concept(nameof(Vehicle_Motorcycle), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Мотоцикл" },
                { "en-US", "Motorcycle" },
            }), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Двухколёсное механическое т/с, возможно с коляской." },
                { "en-US", "Half of a car." },
            })));

            SemanticNetwork.Concepts.Add(Vehicle_Fighter = new Concept(nameof(Vehicle_Fighter), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Поршневой истребитель" },
                { "en-US", "Fighter" },
            }), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Устаревший самолёт для ведения воздушного боя." },
                { "en-US", "Obsolete aircraft." },
            })));

            SemanticNetwork.Concepts.Add(Vehicle_Airbus = new Concept(nameof(Vehicle_Airbus), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Аэробус" },
                { "en-US", "Airbus" },
            }), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Гражданский самолёт для перевозки пассажиров." },
                { "en-US", "Large civil airplane." },
            })));

            SemanticNetwork.Concepts.Add(Vehicle_JetFighter = new Concept(nameof(Vehicle_JetFighter), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Реактивный истребитель" },
                { "en-US", "Jet fighter" },
            }), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Современный самолёт для ведения воздушного боя." },
                { "en-US", "Modern aircraft." },
            })));

            #endregion

            #region Car parts

            SemanticNetwork.Concepts.Add(Part_Engine = new Concept(nameof(Part_Engine), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Двигатель" },
                { "en-US", "Engine" },
            }), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Двигатель." },
                { "en-US", "Engine." },
            })));

            SemanticNetwork.Concepts.Add(Part_Wheels = new Concept(nameof(Part_Wheels), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Колёса" },
                { "en-US", "Wheels" },
            }), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Колёса." },
                { "en-US", "Wheels." },
            })));

            SemanticNetwork.Concepts.Add(Part_Body = new Concept(nameof(Part_Body), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Кузов" },
                { "en-US", "Car body" },
            }), new LocalizedStringVariable(new Dictionary <String, String>
            {
                { "ru-RU", "Кузов." },
                { "en-US", "Car body." },
            })));

            #endregion

            #region Comparable Values

            Func <String, LocalizedStringVariable> getString = text => new LocalizedStringVariable(
                new Dictionary <String, String>
            {
                { "ru-RU", text },
                { "en-US", text },
            });
            Func <Int32, LocalizedStringVariable> getStringByNumber = number => getString(number.ToString());

            SemanticNetwork.Concepts.Add(Number0 = new Concept("0", getStringByNumber(0), getStringByNumber(0)));

            SemanticNetwork.Concepts.Add(NumberZero = new Concept("_0_", getString("_0_"), getString("_0_")));

            SemanticNetwork.Concepts.Add(NumberNotZero = new Concept("!0", getString("!0"), getString("!0")));

            SemanticNetwork.Concepts.Add(Number1 = new Concept("1", getStringByNumber(1), getStringByNumber(1)));

            SemanticNetwork.Concepts.Add(Number1or2 = new Concept("1 || 2", getString("1 || 2"), getString("1 || 2")));

            SemanticNetwork.Concepts.Add(Number2 = new Concept("2", getStringByNumber(2), getStringByNumber(2)));

            SemanticNetwork.Concepts.Add(Number2or3 = new Concept("2 || 3", getString("2 || 3"), getString("2 || 3")));

            SemanticNetwork.Concepts.Add(Number3 = new Concept("3", getStringByNumber(3), getStringByNumber(3)));

            SemanticNetwork.Concepts.Add(Number3or4 = new Concept("3 || 4", getString("3 || 4"), getString("3 || 4")));

            SemanticNetwork.Concepts.Add(Number4 = new Concept("4", getStringByNumber(4), getStringByNumber(4)));

            #endregion

            #region Processes

            SemanticNetwork.Concepts.Add(ProcessA = new Concept(nameof(ProcessA), getString("Process A")));
            SemanticNetwork.Concepts.Add(ProcessB = new Concept(nameof(ProcessB), getString("Process B")));

            #endregion

            #region Concept Attributes

            Sign_MotorType.WithAttribute(IsSignAttribute.Value);
            Sign_AreaType.WithAttribute(IsSignAttribute.Value);

            MotorType_Muscles.WithAttribute(IsValueAttribute.Value);
            MotorType_Steam.WithAttribute(IsValueAttribute.Value);
            MotorType_Combusion.WithAttribute(IsValueAttribute.Value);
            MotorType_Jet.WithAttribute(IsValueAttribute.Value);
            AreaType_Ground.WithAttribute(IsValueAttribute.Value);
            AreaType_Water.WithAttribute(IsValueAttribute.Value);
            AreaType_Air.WithAttribute(IsValueAttribute.Value);

            Number0.WithAttribute(IsValueAttribute.Value);
            NumberZero.WithAttribute(IsValueAttribute.Value);
            NumberNotZero.WithAttribute(IsValueAttribute.Value);
            Number1.WithAttribute(IsValueAttribute.Value);
            Number1or2.WithAttribute(IsValueAttribute.Value);
            Number2.WithAttribute(IsValueAttribute.Value);
            Number2or3.WithAttribute(IsValueAttribute.Value);
            Number3.WithAttribute(IsValueAttribute.Value);
            Number3or4.WithAttribute(IsValueAttribute.Value);
            Number4.WithAttribute(IsValueAttribute.Value);

            ProcessA.WithAttribute(IsProcessAttribute.Value);
            ProcessB.WithAttribute(IsProcessAttribute.Value);

            #endregion

            #region Statements

            SemanticNetwork.DeclareThat(SubjectArea_Transport).IsSubjectAreaOf(Base_Vehicle);
            SemanticNetwork.DeclareThat(SubjectArea_Transport).IsSubjectAreaOf(Sign_MotorType);
            SemanticNetwork.DeclareThat(SubjectArea_Transport).IsSubjectAreaOf(MotorType_Muscles);
            SemanticNetwork.DeclareThat(SubjectArea_Transport).IsSubjectAreaOf(MotorType_Steam);
            SemanticNetwork.DeclareThat(SubjectArea_Transport).IsSubjectAreaOf(MotorType_Combusion);
            SemanticNetwork.DeclareThat(SubjectArea_Transport).IsSubjectAreaOf(MotorType_Jet);
            SemanticNetwork.DeclareThat(SubjectArea_Transport).IsSubjectAreaOf(Sign_AreaType);
            SemanticNetwork.DeclareThat(SubjectArea_Transport).IsSubjectAreaOf(AreaType_Ground);
            SemanticNetwork.DeclareThat(SubjectArea_Transport).IsSubjectAreaOf(AreaType_Water);
            SemanticNetwork.DeclareThat(SubjectArea_Transport).IsSubjectAreaOf(AreaType_Air);
            SemanticNetwork.DeclareThat(SubjectArea_Transport).IsSubjectAreaOf(Vehicle_Bicycle);
            SemanticNetwork.DeclareThat(SubjectArea_Transport).IsSubjectAreaOf(Vehicle_Curragh);
            SemanticNetwork.DeclareThat(SubjectArea_Transport).IsSubjectAreaOf(Vehicle_SteamLocomotive);
            SemanticNetwork.DeclareThat(SubjectArea_Transport).IsSubjectAreaOf(Vehicle_Steamboat);
            SemanticNetwork.DeclareThat(SubjectArea_Transport).IsSubjectAreaOf(Vehicle_Car);
            SemanticNetwork.DeclareThat(SubjectArea_Transport).IsSubjectAreaOf(Vehicle_Motorcycle);
            SemanticNetwork.DeclareThat(SubjectArea_Transport).IsSubjectAreaOf(Vehicle_Fighter);
            SemanticNetwork.DeclareThat(SubjectArea_Transport).IsSubjectAreaOf(Vehicle_Airbus);
            SemanticNetwork.DeclareThat(SubjectArea_Transport).IsSubjectAreaOf(Vehicle_JetFighter);
            SemanticNetwork.DeclareThat(SubjectArea_Transport).IsSubjectAreaOf(Part_Body);
            SemanticNetwork.DeclareThat(SubjectArea_Transport).IsSubjectAreaOf(Part_Engine);
            SemanticNetwork.DeclareThat(SubjectArea_Transport).IsSubjectAreaOf(Part_Wheels);

            SemanticNetwork.DeclareThat(SubjectArea_Numbers).IsSubjectAreaOf(Number0);
            SemanticNetwork.DeclareThat(SubjectArea_Numbers).IsSubjectAreaOf(NumberZero);
            SemanticNetwork.DeclareThat(SubjectArea_Numbers).IsSubjectAreaOf(NumberNotZero);
            SemanticNetwork.DeclareThat(SubjectArea_Numbers).IsSubjectAreaOf(Number1);
            SemanticNetwork.DeclareThat(SubjectArea_Numbers).IsSubjectAreaOf(Number1or2);
            SemanticNetwork.DeclareThat(SubjectArea_Numbers).IsSubjectAreaOf(Number2);
            SemanticNetwork.DeclareThat(SubjectArea_Numbers).IsSubjectAreaOf(Number2or3);
            SemanticNetwork.DeclareThat(SubjectArea_Numbers).IsSubjectAreaOf(Number3);
            SemanticNetwork.DeclareThat(SubjectArea_Numbers).IsSubjectAreaOf(Number3or4);
            SemanticNetwork.DeclareThat(SubjectArea_Numbers).IsSubjectAreaOf(Number4);

            SemanticNetwork.DeclareThat(SubjectArea_Processes).IsSubjectAreaOf(ProcessA);
            SemanticNetwork.DeclareThat(SubjectArea_Processes).IsSubjectAreaOf(ProcessB);

            SemanticNetwork.DeclareThat(Base_Vehicle).HasSign(Sign_MotorType);
            SemanticNetwork.DeclareThat(Base_Vehicle).HasSign(Sign_AreaType);

            SemanticNetwork.DeclareThat(Sign_MotorType).IsAncestorOf(MotorType_Muscles);
            SemanticNetwork.DeclareThat(Sign_MotorType).IsAncestorOf(MotorType_Steam);
            SemanticNetwork.DeclareThat(Sign_MotorType).IsAncestorOf(MotorType_Combusion);
            SemanticNetwork.DeclareThat(Sign_MotorType).IsAncestorOf(MotorType_Jet);
            SemanticNetwork.DeclareThat(Sign_AreaType).IsAncestorOf(AreaType_Ground);
            SemanticNetwork.DeclareThat(Sign_AreaType).IsAncestorOf(AreaType_Water);
            SemanticNetwork.DeclareThat(Sign_AreaType).IsAncestorOf(AreaType_Air);
            SemanticNetwork.DeclareThat(Base_Vehicle).IsAncestorOf(Vehicle_Bicycle);
            SemanticNetwork.DeclareThat(Base_Vehicle).IsAncestorOf(Vehicle_Curragh);
            SemanticNetwork.DeclareThat(Base_Vehicle).IsAncestorOf(Vehicle_SteamLocomotive);
            SemanticNetwork.DeclareThat(Base_Vehicle).IsAncestorOf(Vehicle_Steamboat);
            SemanticNetwork.DeclareThat(Base_Vehicle).IsAncestorOf(Vehicle_Car);
            SemanticNetwork.DeclareThat(Base_Vehicle).IsAncestorOf(Vehicle_Motorcycle);
            SemanticNetwork.DeclareThat(Base_Vehicle).IsAncestorOf(Vehicle_Fighter);
            SemanticNetwork.DeclareThat(Base_Vehicle).IsAncestorOf(Vehicle_Airbus);
            SemanticNetwork.DeclareThat(Base_Vehicle).IsAncestorOf(Vehicle_JetFighter);

            SemanticNetwork.DeclareThat(Vehicle_Bicycle).HasSignValue(Sign_MotorType, MotorType_Muscles);
            SemanticNetwork.DeclareThat(Vehicle_Curragh).HasSignValue(Sign_MotorType, MotorType_Muscles);
            SemanticNetwork.DeclareThat(Vehicle_SteamLocomotive).HasSignValue(Sign_MotorType, MotorType_Steam);
            SemanticNetwork.DeclareThat(Vehicle_Steamboat).HasSignValue(Sign_MotorType, MotorType_Steam);
            SemanticNetwork.DeclareThat(Vehicle_Car).HasSignValue(Sign_MotorType, MotorType_Combusion);
            SemanticNetwork.DeclareThat(Vehicle_Motorcycle).HasSignValue(Sign_MotorType, MotorType_Combusion);
            SemanticNetwork.DeclareThat(Vehicle_Fighter).HasSignValue(Sign_MotorType, MotorType_Combusion);
            SemanticNetwork.DeclareThat(Vehicle_Airbus).HasSignValue(Sign_MotorType, MotorType_Jet);
            SemanticNetwork.DeclareThat(Vehicle_JetFighter).HasSignValue(Sign_MotorType, MotorType_Jet);
            SemanticNetwork.DeclareThat(Vehicle_Bicycle).HasSignValue(Sign_AreaType, AreaType_Ground);
            SemanticNetwork.DeclareThat(Vehicle_Curragh).HasSignValue(Sign_AreaType, AreaType_Water);
            SemanticNetwork.DeclareThat(Vehicle_SteamLocomotive).HasSignValue(Sign_AreaType, AreaType_Ground);
            SemanticNetwork.DeclareThat(Vehicle_Steamboat).HasSignValue(Sign_AreaType, AreaType_Water);
            SemanticNetwork.DeclareThat(Vehicle_Car).HasSignValue(Sign_AreaType, AreaType_Ground);
            SemanticNetwork.DeclareThat(Vehicle_Motorcycle).HasSignValue(Sign_AreaType, AreaType_Ground);
            SemanticNetwork.DeclareThat(Vehicle_Fighter).HasSignValue(Sign_AreaType, AreaType_Air);
            SemanticNetwork.DeclareThat(Vehicle_Airbus).HasSignValue(Sign_AreaType, AreaType_Air);
            SemanticNetwork.DeclareThat(Vehicle_JetFighter).HasSignValue(Sign_AreaType, AreaType_Air);

            SemanticNetwork.DeclareThat(Vehicle_Car).HasPart(Part_Body);
            SemanticNetwork.DeclareThat(Vehicle_Car).HasPart(Part_Engine);
            SemanticNetwork.DeclareThat(Vehicle_Car).HasPart(Part_Wheels);

            SemanticNetwork.DeclareThat(Number0).IsEqualTo(NumberZero);
            SemanticNetwork.DeclareThat(NumberNotZero).IsNotEqualTo(NumberZero);
            SemanticNetwork.DeclareThat(Number0).IsLessThan(Number1);
            SemanticNetwork.DeclareThat(Number1).IsLessThan(Number2);
            SemanticNetwork.DeclareThat(Number3).IsGreaterThan(Number2);
            SemanticNetwork.DeclareThat(Number4).IsGreaterThan(Number3);
            SemanticNetwork.DeclareThat(Number1).IsLessThanOrEqualTo(Number1or2);
            SemanticNetwork.DeclareThat(Number1or2).IsLessThanOrEqualTo(Number2);
            SemanticNetwork.DeclareThat(Number2).IsLessThanOrEqualTo(Number2or3);
            SemanticNetwork.DeclareThat(Number3).IsGreaterThanOrEqualTo(Number2or3);
            SemanticNetwork.DeclareThat(Number4).IsGreaterThanOrEqualTo(Number3or4);
            SemanticNetwork.DeclareThat(Number3or4).IsGreaterThanOrEqualTo(Number3);

            SemanticNetwork.DeclareThat(ProcessA).StartsBeforeOtherStarted(ProcessB);
            SemanticNetwork.DeclareThat(ProcessA).FinishesAfterOtherFinished(ProcessB);

            #endregion
        }
 private void SelectConcept(int conceptId)
 {
     _concept = Concept.CreateConcept(_sqlClient.FindConcept(conceptId));
 }
示例#20
0
 public void Link(Concept concept1, Concept concept2)
 {
     concept1.Relate(concept2);
     _relations.Add(new Relation(concept1, concept2));
 }
示例#21
0
        /// <summary>
        /// Creates the tag list.
        /// </summary>
        /// <returns>A list of concepts.</returns>
        private static IEnumerable<Concept> CreateTagList()
        {
            // get all the tags and count the number of usages
            var dic = new Dictionary<string, Concept>();
            foreach (var post in Post.Posts)
            {
                if (!post.IsVisible)
                {
                    continue;
                }

                foreach (var tag in post.Tags)
                {
                    if (dic.ContainsKey(tag))
                    {
                        var concept = dic[tag];
                        concept.Score++;
                        if (post.DateModified > concept.LastUpdated)
                        {
                            concept.LastUpdated = post.DateModified;
                        }

                        dic[tag] = concept;
                    }
                    else
                    {
                        dic[tag] = new Concept(post.DateModified, 1, tag);
                    }
                }
            }

            return FindMax(dic);
        }
示例#22
0
 /// <summary>
 /// Forces a refresh of the object
 /// </summary>
 public override void Refresh()
 {
     base.Refresh();
     this.m_unitOfMeasure = null;
 }
示例#23
0
 public static void InvalidActualType()
 {
     ThrowsAny <ConstraintViolationException>(() => Concept.Assert(typeof(Number <DateTime>)));
 }
示例#24
0
        protected View CreateConceptView(Concept concept)
        {
            View view;

            var inflater = LayoutInflater.From(Activity.BaseContext);

            if (concept is InputText)
            {
                view = inflater.Inflate(Resource.Layout.InputTextConcept, null);
                if ((concept as InputText).LetterCount > 0)
                {
                    (view as EditText).SetMinEms((concept as InputText).LetterCount);
                }
                else
                {
                    (view as EditText).SetMinEms((concept as InputText).Text.Length - ((concept as InputText).Text.Length / 2));
                }

                if ((concept as InputText).Size > 0)
                {
                    (view as EditText).SetTextSize(Android.Util.ComplexUnitType.Dip, (concept as InputText).Size);
                }
            }
            else if (concept is BaseText)
            {
                var baseText = (concept as BaseText);
                if (baseText.LetterTags != null && baseText.LetterTags.Count > 0)
                {
                    view = ApplyLetterTags(inflater, baseText);
                }
                else
                {
                    view = inflater.Inflate(Resource.Layout.BaseText, null);
                    var tvText = view.FindViewById <TextView>(Resource.Id.tvText);
                    DecorateText(tvText, baseText, new Android.Graphics.Color(
                                     ContextCompat.GetColor(Activity.BaseContext, Resource.Color.neon)),
                                 TextDecorationType.Background);
                    SetTextAlign(tvText, baseText);
                    SetTextColor(tvText, baseText);
                    AdjustTextSize(tvText, baseText);
                }

                if (baseText is ISound && baseText.SoundPath != null)
                {
                    var speakerDecorator = (ViewGroup)inflater.Inflate(Resource.Layout.BaseTextSpeaker, null);
                    speakerDecorator.AddView(view);
                    view = speakerDecorator;
                }

                if (IsTextCardCallback(concept as BaseText))
                {
                    var cardView = (FrameLayout)inflater.Inflate(Resource.Layout.CardConcept, null);

                    if (baseText.Size > 0)
                    {
                        cardView.LayoutParameters = new FrameLayout.LayoutParams(
                            baseText.Size > 0 ? ToPx(baseText.Size) : ViewGroup.LayoutParams.MatchParent,
                            baseText.Size > 0 ? ToPx(baseText.Size) : ViewGroup.LayoutParams.MatchParent);
                    }

                    cardView.AddView(view);
                    view = cardView;
                }
                else
                {
                    if (!baseText.ShowAsPlainText)
                    {
                        var borderedView = (FrameLayout)inflater.Inflate(Resource.Layout.BaseTextBordered, null);
                        borderedView.AddView(view);
                        view = borderedView;
                    }
                }
            }
            else if (concept is Speaker)
            {
                view = inflater.Inflate(Resource.Layout.SpeakerConcept, null);

                if (IsSpeakerCardCallback(concept as Speaker))
                {
                    var cardView = (FrameLayout)inflater.Inflate(Resource.Layout.CardConcept, null);
                    cardView.AddView(view);
                    view = cardView;
                }
                else
                {
                    view.SetBackgroundResource(Resource.Drawable.concept_bordered);
                }
            }
            else if (concept is Picture)
            {
                var picture = concept as Picture;

                view = inflater.Inflate(Resource.Layout.PictureConcept, null);

                if (concept.ActivateOnSuccess || concept.ActivateOnMistake)
                {
                    int defaultSize = (IsSmallHeight() ? 100 : 120);
                    (view as ViewGroup).GetChildAt(0).LayoutParameters = new FrameLayout.LayoutParams(ToPx(defaultSize), ToPx(defaultSize));
                }

                if (picture.Size > 0)
                {
                    (view as ViewGroup).GetChildAt(0).LayoutParameters = new FrameLayout.LayoutParams(
                        picture.Size > 0 ? ToPx(picture.Size) : ViewGroup.LayoutParams.MatchParent,
                        picture.Size > 0 ? ToPx(picture.Size) : ViewGroup.LayoutParams.MatchParent);
                }

                if (!string.IsNullOrEmpty(picture.ImagePath))
                {
                    var bitmap = BitmapLoader.Instance.LoadBitmap(CountPictureItems(), Activity.BaseContext, picture.ImagePath);
                    if (bitmap != null)
                    {
                        var ivPicture = view.FindViewById <ImageView>(Resource.Id.ivPicture);
                        ivPicture.SetImageBitmap(bitmap);
                    }
                }

                if (IsPictureCardCallback(picture))
                {
                    var cardView = (FrameLayout)inflater.Inflate(Resource.Layout.CardConcept, null);
                    cardView.AddView(view);
                    view = cardView;
                }
            }
            else if (concept is Models.Space)
            {
                view = new Android.Widget.Space(Activity.BaseContext);
                view.LayoutParameters = new LinearLayout.LayoutParams(ToPx((concept as Models.Space).Width), ToPx((concept as Models.Space).Height));
            }
            else
            {
                view = inflater.Inflate(Resource.Layout.BaseText, null);
                var tvText = view.FindViewById <TextView>(Resource.Id.tvText);
                tvText.Text = string.Format("Concept type {0} does not exist!", concept.GetType().ToString());
            }

            // Attach concept object to view
            SetTag <Concept>(view, Resource.Id.concept_tag_key, concept);

            // Attach click handler
            view.Click += ConceptView_Click_PlaySound;

            return(view);
        }
示例#25
0
 public bool Implies(Concept a, Concept b)
 {
     throw new NotImplementedException();
 }
示例#26
0
        public static SearchKeyType CreateNew(int depth = 0)
        {
            rt.srz.model.srz.SearchKeyType entity = new rt.srz.model.srz.SearchKeyType();

            // You may need to maually enter this key if there is a constraint violation.
            entity.Id = System.Guid.NewGuid();

            entity.Code                 = "123";
            entity.Name                 = "Test Test Test Test Test Test Test Test Test";
            entity.IsActive             = true;
            entity.FirstName            = true;
            entity.LastName             = true;
            entity.MiddleName           = true;
            entity.Birthday             = true;
            entity.Birthplace           = true;
            entity.Snils                = true;
            entity.DocumentType         = true;
            entity.DocumentSeries       = true;
            entity.DocumentNumber       = true;
            entity.Okato                = true;
            entity.PolisType            = true;
            entity.PolisSeria           = true;
            entity.PolisNumber          = true;
            entity.FirstNameLength      = default(Int16);
            entity.LastNameLength       = default(Int16);
            entity.MiddleNameLength     = default(Int16);
            entity.BirthdayLength       = default(Int16);
            entity.AddressStreet        = true;
            entity.AddressStreetLength  = default(Int16);
            entity.AddressHouse         = true;
            entity.AddressRoom          = true;
            entity.AddressStreet2       = true;
            entity.AddressStreetLength2 = default(Int16);
            entity.AddressHouse2        = true;
            entity.AddressRoom2         = true;
            entity.DeleteTwinChar       = true;
            entity.IdenticalLetters     = "Test Test ";
            entity.Recalculated         = true;
            entity.Enp       = true;
            entity.MainEnp   = true;
            entity.Weight    = 76;
            entity.Insertion = true;

            using (rt.srz.business.manager.IConceptManager conceptManager = ObjectFactory.GetInstance <IConceptManager>())
            {
                var     all       = conceptManager.GetAll(1);
                Concept entityRef = null;
                if (all.Count > 0)
                {
                    entityRef = all[0];
                }

                if (entityRef == null && depth < 3)
                {
                    depth++;
                    entityRef = ConceptTests.CreateNew(depth);
                    ObjectFactory.GetInstance <ISessionFactory>().GetCurrentSession().Save(entityRef);
                }

                entity.OperationKey = entityRef;
            }

            using (rt.srz.business.manager.IOrganisationManager organisationManager = ObjectFactory.GetInstance <IOrganisationManager>())
            {
                entity.Tfoms = null;
            }

            return(entity);
        }
示例#27
0
 public Concept SaveConcept(Concept concept)
 {
     throw new NotImplementedException();
 }
 public override bool IsMatch(Concept concept)
 {
     return(!kind.HasValue || concept.RawKind == kind.Value);
 }
示例#29
0
 /// <summary>
 /// Refresh the object forcing delay load
 /// </summary>
 public override void Refresh()
 {
     base.Refresh();
     this.m_interpretationConcept = null;
 }
示例#30
0
        public List <Concept> GetConceptAnswers(Concept concept)
        {
            List <Concept> answers = new List <Concept>();

            return(answers);
        }
示例#31
0
 /// <summary>
 /// Forces a refresh of underlying data
 /// </summary>
 public override void Refresh()
 {
     base.Refresh();
     this.m_value = null;
 }
示例#32
0
 public Boolean GetIfConceptHasAnswers(Concept concept)
 {
     return(false);
 }
示例#33
0
 public ConceptRefDTO(Concept c)
 {
     Id          = c.Id;
     UniversalId = c.UniversalId?.ToString();
 }
 public void SetRefsetConcept(Concept refsetConcept)
 {
     this.refsetConcept = refsetConcept;
 }
示例#35
0
 /// <summary>
 /// Force a refresh of delay load properties
 /// </summary>
 public override void Refresh()
 {
     base.Refresh();
     this.m_genderConcept = null;
 }
 public void SetReferencedConcept(Concept referencedConcept)
 {
     this.referencedConcept = referencedConcept;
 }
示例#37
0
 public MessageEventArgs(Concept.Message message)
 {
     Message = message;
 }
示例#38
0
        private Concept CreateConcept()
        {
            var concent = new Concept(_conceptScheme, _equipmentScheme);

            return(concent);
        }
示例#39
0
        public async Task <PatientMedicationIdentifierDto> Handle(AddMedicationToPatientCommand message, CancellationToken cancellationToken)
        {
            var patientFromRepo = await _patientRepository.GetAsync(f => f.Id == message.PatientId, new string[] {
                "PatientClinicalEvents",
                "PatientMedications.Concept.MedicationForm"
            });

            if (patientFromRepo == null)
            {
                throw new KeyNotFoundException("Unable to locate patient");
            }

            Concept conceptFromRepo = null;

            if (message.ConceptId > 0)
            {
                conceptFromRepo = await _conceptRepository.GetAsync(message.ConceptId, new string[] { "MedicationForm" });

                if (conceptFromRepo == null)
                {
                    throw new KeyNotFoundException("Unable to locate concept");
                }
            }

            Product productFromRepo = null;

            if (message.ProductId.HasValue && message.ProductId > 0)
            {
                productFromRepo = await _productRepository.GetAsync(p => p.Id == message.ProductId);

                if (productFromRepo == null)
                {
                    throw new KeyNotFoundException("Unable to locate product");
                }
                conceptFromRepo = productFromRepo.Concept;
            }

            if (conceptFromRepo == null)
            {
                throw new KeyNotFoundException("Unable to locate concept");
            }

            var medicationDetail = await PrepareMedicationDetailAsync(message.Attributes);

            if (!medicationDetail.IsValid())
            {
                medicationDetail.InvalidAttributes.ForEach(element => throw new DomainException(element));
            }

            var newPatientMedication = patientFromRepo.AddMedication(conceptFromRepo, message.StartDate, message.EndDate, message.Dose, message.DoseFrequency, message.DoseUnit, productFromRepo, message.SourceDescription);

            _modelExtensionBuilder.UpdateExtendable(newPatientMedication, medicationDetail.CustomAttributes, "Admin");

            _patientRepository.Update(patientFromRepo);

            await AddOrUpdateMedicationsOnReportInstanceAsync(patientFromRepo, newPatientMedication.StartDate, newPatientMedication.EndDate, newPatientMedication.DisplayName, newPatientMedication.PatientMedicationGuid);

            await _unitOfWork.CompleteAsync();

            _logger.LogInformation($"----- Medication {conceptFromRepo.ConceptName} created");

            var mappedPatientMedication = _mapper.Map <PatientMedicationIdentifierDto>(newPatientMedication);

            return(CreateLinks(mappedPatientMedication));
        }
示例#40
0
        public void ItShouldNotFilterWhenNoFilter()
        {
            var concept = new Concept <int>();

            Assert.IsTrue(concept.Filter(Month.January));
        }
        public void BuildAndRegisterConcepts()
        {
            // Setting the default agency like this means
            // we don't need to manually set it for every
            // item we create.
            VersionableBase.DefaultAgencyId = "int.example";

            // Create a scheme to hold the concepts.
            ConceptScheme scheme = new ConceptScheme();
            scheme.Label.Current = "Transportation Modes";

            // Create 6 concepts, setting up a small hierarchy.
            Concept transportMode = new Concept();
            transportMode.Label.Current = "Transport Mode";

            Concept auto = new Concept();
            auto.SubclassOf.Add(transportMode);
            auto.Label.Current = "Auto";

            Concept car = new Concept();
            car.SubclassOf.Add(auto);
            car.Label.Current = "Car";

            Concept truck = new Concept();
            truck.SubclassOf.Add(auto);
            truck.Label.Current = "Truck";

            Concept bike = new Concept();
            bike.SubclassOf.Add(transportMode);
            bike.Label.Current = "Bike";

            Concept walk = new Concept();
            walk.SubclassOf.Add(transportMode);
            walk.Label.Current = "Walk";

            // Add the concpts to the scheme.
            scheme.Concepts.Add(transportMode);
            scheme.Concepts.Add(auto);
            scheme.Concepts.Add(car);
            scheme.Concepts.Add(truck);
            scheme.Concepts.Add(bike);
            scheme.Concepts.Add(walk);

            var client = GetClient();
            CommitOptions options = new CommitOptions();

            // Gather all the scheme and all the items in the scheme,
            // so we can register them with a single call to the repository.
            ItemGathererVisitor gatherer = new ItemGathererVisitor();
            scheme.Accept(gatherer);

            // Register the items with the repository.
            client.RegisterItems(gatherer.FoundItems, options);

            // Alternatively, we could register the items one at a time, like this.

            //client.RegisterItem(scheme, options);
            //client.RegisterItem(transportMode, options);
            //client.RegisterItem(auto, options);
            //client.RegisterItem(car, options);
            //client.RegisterItem(truck, options);
            //client.RegisterItem(bike, options);
            //client.RegisterItem(walk, options);
        }
示例#42
0
        public void ItShouldNotRunWhenNotFiltersAndNotOperation()
        {
            var concept = new Concept <int>();

            Assert.Throws(typeof(RuleException), concept.Run);
        }
 public void Verify_MapToEntity_WithExistingEntity_AssignsConceptProperties()
 {
     // Arrange
     var mapper = new ConceptMapper();
     var model = ConceptsMockingSetup.DoMockingSetupForConceptModel();
     // Act
     IConcept existingEntity = new Concept { Id = 1 };
     mapper.MapToEntity(model.Object, ref existingEntity);
     // Assert
     Assert.Equal(model.Object.StartYear, existingEntity.StartYear);
     // Related Objects
     Assert.Equal(model.Object.PrimaryImageFileId, existingEntity.PrimaryImageFileId);
     Assert.Equal(model.Object.FirstIssueAppearanceId, existingEntity.FirstIssueAppearanceId);
     // Associated Objects
     model.VerifyGet(x => x.ConceptAliases, Times.Once);
     //Assert.Equal(model.Object.ConceptAliases?.Count, existingEntity.ConceptAliases?.Count);
     model.VerifyGet(x => x.ConceptIssuesAppearedIn, Times.Once);
     //Assert.Equal(model.Object.ConceptIssuesAppearedIn?.Count, existingEntity.ConceptIssuesAppearedIn?.Count);
     model.VerifyGet(x => x.ConceptIssues, Times.Once);
     //Assert.Equal(model.Object.ConceptIssues?.Count, existingEntity.ConceptIssues?.Count);
     model.VerifyGet(x => x.ConceptMovies, Times.Once);
     //Assert.Equal(model.Object.ConceptMovies?.Count, existingEntity.ConceptMovies?.Count);
     model.VerifyGet(x => x.ConceptVolumes, Times.Once);
     //Assert.Equal(model.Object.ConceptVolumes?.Count, existingEntity.ConceptVolumes?.Count);
 }
示例#44
0
 /// <summary>
 /// Forces refreshing of delay load properties
 /// </summary>
 public override void Refresh()
 {
     base.Refresh();
     this.m_componentType = null;
 }
		public void Add(Concept concept, int value)
		{
			facts.Add(concept, value);
		}
示例#46
0
        } // FollowMissingShipToPath

        /// <summary>
        /// The control flow for loading a rollout spreadsheet.
        /// </summary>
        private void LoadRolloutFlow()
        {
            log4net.Config.XmlConfigurator.ConfigureAndWatch(new FileInfo(Path.GetDirectoryName(Assembly.GetAssembly(typeof(FileIO)).Location) + @"\" + "log4net.config"));
            this.dgv_DataDisplay.DataSource = null;
            MissingShipToCSV = null; // make sure to clear this out each time we load a spreadsheet
            // 1.) Get the file to load
            string FileToLoad = FileIO.GetFileName(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), FileFilter);

            if (String.Empty != FileToLoad)
            {
                try
                {
                    // 2.) Load the file
                    log.Debug($"Attempting to load file {FileToLoad} using \t as a delimiter");
                    conceptCSV = new ConceptCSV(FileToLoad, "\t");
                    using (LoadingForm frm = new LoadingForm())
                    {
                        frm.AddText("Loading Concept Spreadsheet.");
                        frm.Visible = true;
                        conceptCSV.ReadConcept();
                        // 3.) Validate the required columns exist in the spreadsheet
                        log.Debug($"Attempting to validate all required columns exist in the file.");
                        frm.AddText("Validating Concept Required Columns Exist.");
                        if (!ValidateConceptHeader(ref conceptCSV))
                        {
                            return;
                        }
                        // 4a.) Validate the data in the rows match the column requirements
                        log.Debug("Validating all row data in all required columns.");
                        frm.AddText("Validating data in concept spreadsheet.");
                        if (!ValidateConceptRows(ref conceptCSV))
                        {
                            return;
                        }
                        // 4b.) Validate the Shipping Vendor
                        log.Debug("Validating the shipping vendor is V or V3.");
                        frm.AddText("Validating the shipping vendor is a vendor in JDE.");
                        if (!CheckShippingVendor(conceptCSV))
                        {
                            return;
                        }
                        // 4c.) Validate the concept ID exists for the Customer C3 Record
                        log.Debug("Validating the Customer Number has a concept in ABAC08.");
                        frm.AddText("Validating the Customer Number has a concept code.");
                        if (!ConceptCodeExists(conceptCSV))
                        {
                            return;
                        }
                        // 5.) Verify the ship to addresses exist
                        log.Debug("Verify all Ship To addresses exist");
                        frm.AddText("Checking for missing ship to addresses in JDE.");
                        List <string> MissingShipTo = conceptCSV.CheckForMissingShipToAddresses();
                        if (0 < MissingShipTo.Count)
                        {
                            // 6a.) We found new ship to addresses, so start down that path
                            log.Debug("There are Ship To addresses that are missing.  Should we add them?");
                            frm.AddText("Found missing ship to addresses.");
                            FollowMissingShipToPath(MissingShipTo, conceptCSV, frm);
                            frm.Visible = false;
                        }
                        else
                        {
                            // 6b.) All ship to addresses exist.  So, verify the item numbers are valid
                            log.Debug("Verify all items exist in JDE.");
                            frm.AddText("No missing ship to addresses.");
                            frm.AddText("Checking for missing item numbers.");
                            List <string> MissingItems = conceptCSV.CheckForMissingItemNumbers();
                            if (0 < MissingItems.Count)
                            {
                                log.Debug("There are item numbers that don't exist in JDE.");
                                using (new CenterDialog(this))
                                {
                                    MessageBox.Show($"The following part numbers don't exist in JDE.  Please change them or add them to the 3SUW branch plant: {String.Join(",", MissingItems)}",
                                                    "Data Error!!",
                                                    MessageBoxButtons.OK,
                                                    MessageBoxIcon.Error);
                                }
                                frm.Close();
                                return;
                            }
                            else
                            {
                                log.Debug("All items exist in JDE");
                                frm.AddText("All items exist in JDE.");
                                using (new CenterDialog(this))
                                {
                                    DialogResult result = MessageBox.Show($"All {conceptCSV.DT.Rows.Count} rows of data are valid in JDE.\r\nLoad the EDI Data into JDE?\r\nSelect No to preview the detail data before load.",
                                                                          "Load EDI Data?",
                                                                          MessageBoxButtons.YesNoCancel,
                                                                          MessageBoxIcon.Information);
                                    if (DialogResult.Cancel == result)
                                    {
                                        return;
                                    }

                                    // 7.) Save the data into a concept & save that to JDE
                                    log.Debug($"Tranform the conceptCSV into a concept");
                                    frm.AddText("Transforming the spreadsheet into a concept object.");
                                    Concept concept = XfrmConcept.CSVtoConcept(conceptCSV);
                                    if (DialogResult.Yes == result)
                                    {
                                        log.Debug($"Populating header file F47011 with data");
                                        frm.AddText("Populating the EDI header file with concept data.");
                                        JDE.PopulateF47011(concept);
                                        log.Debug($"Populating detail file F47012 with data");
                                        frm.AddText("Populating the EDI detail file with concept data & freight lines.");
                                        JDE.PopulateF47012(concept);
                                        frm.AddText("Success!");
                                        // 8.) Prompt the user to go to JDE
                                        log.Debug($"Successfully processed the EDI information into F47011 and F47012");
                                        MessageBox.Show("The concept was successfully loaded into JDE.\r\nPlease go to JDE, review the data, and run the Rollout Order Import report.",
                                                        "Success!",
                                                        MessageBoxButtons.OK,
                                                        MessageBoxIcon.Information);
                                        frm.Close();
                                    }
                                    else if (DialogResult.No == result)
                                    {
                                        frm.AddText("Success!");
                                        frm.Close();
                                        this.dgv_DataDisplay.DataSource = concept.OrderDetails;
                                    }
                                }
                            }
                        }
                    }
                }
                catch (Exception er)
                {
                    log.Error($"{er.Message} + {er.InnerException} + {er.StackTrace}");
                    using (new CenterDialog(this))
                    {
                        MessageBox.Show($"{er.Message} + {er.InnerException} + {er.StackTrace}",
                                        "Error in Rollout",
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Error);
                    }
                }
            }
        } // LoadRolloutFlow
示例#47
0
文件: Apml.cs 项目: rajgit31/RajBlog
        // modified version of what's happening in the tag cloud
        private List<Concept> CreateTagList()
        {
            // get all the tags and count the number of usages
            Dictionary<string, Concept> dic = new Dictionary<string, Concept>();
            foreach (Post post in Post.Posts)
            {
                if (post.IsVisible)
                {
                    foreach (string tag in post.Tags)
                    {
                        if (dic.ContainsKey(tag))
                        {
                            Concept concept = dic[tag];
                            concept.Score++;
                            if (post.DateModified > concept.LastUpdated)
                                concept.LastUpdated = post.DateModified;
                            dic[tag] = concept;
                        }
                        else
                        {
                            dic[tag] = new Concept(post.DateModified, 1, tag);
                        }
                    }
                }
            }

            return FindMax(dic);
        }
示例#48
0
        /// <summary>
        /// This method builds up a DdiInstance and writes it to a 
        /// valid DDI 3.1. XML file.
        /// </summary>
        public void BuildSomeDdiAndWriteToXml()
        {
            // It is helpful to set some default properties before
            // working with the SDK's model. These two properties
            // determine the default language and agency identifier
            // for every item.
            MultilingualString.CurrentCulture = "en-US";
            VersionableBase.DefaultAgencyId = "example.org";

            // Start out by creating a new DDIInstance.
            // The DdiInstance can hold StudyUnits, Groups, and ResourcePackages.
            DdiInstance instance = new DdiInstance();
            Instance = instance;
            instance.DublinCoreMetadata.Title.Current = "My First Instance";

            // Since we set the CurrentCulture to "en-US", that last line is
            // equivalent to this next one.
            instance.DublinCoreMetadata.Title["en-US"] = "My First Instance";

            // We can set multiple languages, if we want to.
            instance.DublinCoreMetadata.Title["fr"] = "TODO";

            // Add a ResourcePackage to the DdiInstance. There are three things to do.
            // 1. First, create it.
            // 2. Then, set whatever properties you like. Here, we just set the Title.
            // 3. Add the item to it's parent. In this case, that's the DdiInstance.
            ResourcePackage resourcePackage = new ResourcePackage();
            resourcePackage.DublinCoreMetadata.Title.Current = "RP1";
            instance.AddChild(resourcePackage);

            // Now let's add a ConceptScheme to the ResourcePackage. We'll do this
            // using the same three steps we used to create the ResourcePackage.
            ConceptScheme conceptScheme = new ConceptScheme();
            conceptScheme.ItemName.Current = "My Concepts";
            conceptScheme.Description.Current = "Just some concepts for testing.";
            resourcePackage.AddChild(conceptScheme);

            // Let's add some Concepts to the ConceptScheme.
            string[] conceptLabels = { "Pet", "Dog", "Cat", "Bird", "Fish", "Monkey" };
            foreach (string label in conceptLabels)
            {
                // Again, for each Concept we create, we want to perform the
                // same three steps as above:
                // 1. instantiate, 2. assign properties, 3. add to parent.
                Concept concept = new Concept();
                concept.Label.Current = label;
                conceptScheme.AddChild(concept);
            }

            // Let's create a collection of questions.
            QuestionScheme questionScheme = new QuestionScheme();
            questionScheme.ItemName.Current = "Sample Questions";
            resourcePackage.QuestionSchemes.Add(questionScheme);

            // First, we can ask for a name. This will just collect textual data.
            Question q1 = new Question();
            q1.QuestionText.Current = "What is your name?";
            q1.ResponseDomains.Add(new TextDomain());
            questionScheme.Questions.Add(q1);

            // Next, we can ask what method of transportation somebody used to get to Minneapolis.
            Question transportationQuestion = new Question();
            transportationQuestion.QuestionText.Current = "How did you get to Minneapolis?";

            // For this question, the respondent will choose from a list of answers.
            // Let's make that list.
            CategoryScheme catScheme = new CategoryScheme();
            resourcePackage.CategorySchemes.Add(catScheme);

            var codeScheme = new CodeList();
            resourcePackage.CodeSchemes.Add(codeScheme);

            // Add the first category and code: Airplane
            Category airplaneCategory = new Category();
            airplaneCategory.Label.Current = "Airplane";
            Code airplaneCode = new Code
            {
                Value = "0",
                Category = airplaneCategory
            };
            catScheme.Categories.Add(airplaneCategory);
            codeScheme.Codes.Add(airplaneCode);

            // Car
            Category carCategory = new Category();
            carCategory.ItemName.Current = "Car";
            Code carCode = new Code
            {
                Value = "1",
                Category = carCategory
            };
            catScheme.Categories.Add(carCategory);
            codeScheme.Codes.Add(carCode);

            // Train
            Category trainCategory = new Category();
            trainCategory.ItemName.Current = "Train";
            Code trainCode = new Code
            {
                Value = "2",
                Category = trainCategory
            };
            catScheme.Categories.Add(trainCategory);
            codeScheme.Codes.Add(trainCode);

            // Now that we have a Category and CodeScheme, we can create
            // a CodeDomain and assign this as the type of data the transportation
            // question will collect.
            CodeDomain codeDomain = new CodeDomain();
            codeDomain.Codes = codeScheme;
            transportationQuestion.ResponseDomains.Add(codeDomain);
            questionScheme.Questions.Add(transportationQuestion);

            // We have created a DdiInstance, a ResourcePackage, some concepts,
            // and some questions.
            //
            // Now what?
            //
            // Let's save all this to a DDI 3.1 XML file.
            //
            // First, we can call EnsureCompliance to make sure
            // our objects have all fields that are required
            // by the DDI 3.1 schemas. If we missed anything,
            // this method will fill in some defaults for us.
            DDIWorkflowSerializer.EnsureCompliance(instance);

            // Now, create the serializer object that will save our items to XML.
            // Setting UseConciseBoundedDescription to false makes sure we
            // write every item, and not just references to items.
            DDIWorkflowSerializer serializer = new DDIWorkflowSerializer();
            serializer.UseConciseBoundedDescription = false;

            // Getting a valid XML representation of our model is just one method call.
            XmlDocument xmlDoc = serializer.Serialize(instance);

            // Finally, save the XML document to a file.
            xmlDoc.Save("sample.xml");
        }