Esempio n. 1
0
        public string DataLink(ROntologyDatatypePropertyDefinition prop)
        {
            SDataLink result         = null;
            SDataLink somelangresult = null;

            foreach (var dprop in DirectProperties <SDataLink>().Where(p => p.Definition == prop))
            {
                if (dprop.Lang == "ru")
                {
                    result = dprop;
                    break;
                }
                if (dprop.Lang == "en")
                {
                    result = dprop;
                }
                else
                {
                    somelangresult = dprop;
                }
            }
            if (result == null && somelangresult != null)
            {
                result = somelangresult;
            }
            return(result == null ? null : result.InnerText);
        }
Esempio n. 2
0
        public static string DateFirst(this SNode sNode)
        {
            var    dp = sNode.DataProperty("from-date");
            string df = dp == null ? null : dp.InnerText;

            if (df != null)
            {
                return(df);
            }
            return(sNode.InverseProperties("referred")
                   .Select((Func <SObjectLink, string>)((SObjectLink p) =>
            {
                SDataLink dprop = p.Source.DataProperty("some-date");
                if (dprop != null)
                {
                    return dprop.InnerText;
                }
                dprop = p.Source.DataProperty("date");
                if (dprop != null)
                {
                    return dprop.InnerText;
                }
                return (string)null;
            }))
                   .OrderBy(d => d).FirstOrDefault());
        }
Esempio n. 3
0
        public SDataLink DataProperty(XName propName, XName lang)
        {
            SDataLink result         = null;
            SDataLink somelangresult = null;

            foreach (var dprop in DirectProperties <SDataLink>(propName))
            {
                if (dprop.Lang == lang)
                {
                    result = dprop;
                    break;
                }
                if (dprop.Lang == "en")
                {
                    result = dprop;
                }
                else
                {
                    somelangresult = dprop;
                }
            }
            if (result == null && somelangresult != null)
            {
                result = somelangresult;
            }
            return(result);
        }