Ejemplo n.º 1
0
        protected void EnsureData()
        {
            if (Statements == null)
            {
                Statements = Source.SelectList(new Statement(Uid, null, null), true);
            }

            PropertiesHash = new Dictionary <Entity, PropertyView>();
            var groups = new Dictionary <Entity, IList <Resource> >();

            // collect and group-by-property
            foreach (var st in Statements)
            {
                if (!groups.ContainsKey(st.Predicate))
                {
                    groups[st.Predicate] = new List <Resource>();
                }
                if (!groups[st.Predicate].Contains(st.Object))
                {
                    groups[st.Predicate].Add(st.Object);
                }
            }

            foreach (var group in groups)
            {
                var valueList    = new List <object>();
                var refList      = new List <ResourceView>();
                var propertyView = new ResourceView(group.Key, Source);
                foreach (var res in group.Value)
                {
                    if (res is Literal)
                    {
                        valueList.Add(GetObject((Literal)res));
                    }
                    else if (res is Entity)
                    {
                        refList.Add(new ResourceView((Entity)res, Source));
                    }
                }
                var prop = new PropertyView(propertyView, valueList, refList);
                PropertiesHash[propertyView.Uid] = prop;
            }
        }
Ejemplo n.º 2
0
 public PropertyView(ResourceView p, IList <object> values, IList <ResourceView> refs)
 {
     Property   = p;
     Values     = values;
     References = refs;
 }
Ejemplo n.º 3
0
        protected void EnsureData()
        {
            if (Statements == null)
                Statements = Source.SelectList(new Statement(Uid, null, null), true);

            PropertiesHash = new Dictionary<Entity, PropertyView>();
            var groups = new Dictionary<Entity, IList<Resource>>();

            // collect and group-by-property
            foreach (var st in Statements) {
                if (!groups.ContainsKey(st.Predicate))
                    groups[st.Predicate] = new List<Resource>();
                if (!groups[st.Predicate].Contains(st.Object))
                    groups[st.Predicate].Add(st.Object);
            }

            foreach (var group in groups) {
                var valueList = new List<object>();
                var refList = new List<ResourceView>();
                var propertyView = new ResourceView(group.Key, Source);
                foreach (var res in group.Value) {
                    if (res is Literal)
                        valueList.Add(GetObject((Literal)res));
                    else if (res is Entity)
                        refList.Add(new ResourceView((Entity)res, Source));
                }
                var prop = new PropertyView(propertyView, valueList, refList);
                PropertiesHash[propertyView.Uid] = prop;
            }
        }
Ejemplo n.º 4
0
 public PropertyView this[ResourceView prop]
 {
     get {
         return this[prop.Uid];
     }
 }
Ejemplo n.º 5
0
 public PropertyView(ResourceView p, IList<object> values, IList<ResourceView> refs)
 {
     Property = p;
     Values = values;
     References = refs;
 }
Ejemplo n.º 6
0
 public PropertyView this[ResourceView prop] {
     get {
         return(this[prop.Uid]);
     }
 }