Esempio n. 1
0
 internal void ReadFromComponentSchema(ComponentSchema schema)
 {
     ThrowIfInitialized();
     _initialized = true;
     InitializeComponent();
     ReadComponentSchema(schema);
 }
Esempio n. 2
0
 protected override void ReadComponentSchema(ComponentSchema schema)
 {
     Strength     = schema.GetValue("strength", 10);
     Dexterity    = schema.GetValue("dexterity", 10);
     Constitution = schema.GetValue("constitution", 10);
     Intelligence = schema.GetValue("intelligence", 10);
     Wisdom       = schema.GetValue("wisdom", 10);
     Charisma     = schema.GetValue("charisma", 10);
     Class        = schema.GetValue <ObjectSchema>("class").Instantiate <CharacterClass>();
 }
Esempio n. 3
0
        public override async Task <SigmaGraphModel> Execute(UriQuery query)
        {
            // find query text
            var uri    = _perspectiveNamingConvention.Decompose(query.Uri);
            var schema = await _queryService.Execute(new PerspectiveSchemaQuery()
            {
                PerspectiveId = uri.PerspectiveId,
                Substitutions = query.Parameters,
                UserName      = Auth.UserName
            }, this);

            if (uri.Page == null || uri.ComponentId == null)
            {
                return(null);
            }

            var statements = uri.Section.HasValue
                ? schema.Pages[uri.Page.Value].Sections[uri.Section.Value].Statements
                : schema.Pages[uri.Page.Value].Statements;

            ComponentSchema graphComponent = null;

            foreach (var statement in statements)
            {
                if (
                    statement.Component?.Statements?
                    .FirstOrDefault(
                        s => s.Assignement?.Name == "Uri" &&
                        ((string)s.Assignement?.Value) == uri.ComponentId) != null)
                {
                    graphComponent = statement.Component;
                }
            }

            if (graphComponent == null)
            {
                return(null);
            }

            var graphQuery = new StringBuilder();

            foreach (var statement in graphComponent.Statements)
            {
                if (statement.Assignement != null && QUERY_CLAUSES.Contains(statement.Assignement.Name))
                {
                    graphQuery.Append(statement.Assignement.Name.ToUpper());
                    graphQuery.Append(" ");
                    graphQuery.Append(statement.Assignement.Value);
                    graphQuery.Append("\n");
                }
            }
            _log.Debug(graphQuery);

            // query graph
            var graphModel = await _queryService.Execute(new SigmaQuery()
            {
                NetworkId = query.NetworkId,
                DoLayout  = true,
                QueryText = graphQuery.ToString(),
                Cache     = query.Cache
            }, this);

            return(graphModel);
        }
Esempio n. 4
0
 protected virtual void ReadComponentSchema(ComponentSchema schema)
 {
 }
Esempio n. 5
0
 protected override void ReadComponentSchema(ComponentSchema schema)
 {
     RaceName = schema.GetValue("race_name", "none");
 }
Esempio n. 6
0
 public void ReadComponentSchema(ComponentSchema schema)
 {
 }