protected MemberRepresentationStrategy(HttpRequestMessage req, PropertyContextSurface propertyContext, RestControlFlags flags) : base(flags)
 {
     this.req             = req;
     this.propertyContext = propertyContext;
     objectUri            = new UriMtHelper(req, propertyContext);
     self = new MemberRelType(RelValues.Self, new UriMtHelper(req, propertyContext));
 }
Ejemplo n.º 2
0
        private void DeleteOneRelationship(Node node, RelType type, Direction direction, int which)
        {
            Relationship last    = null;
            int          counter = 0;
            IEnumerable <Relationship> relationships = node.GetRelationships(type, direction);

            using (ResourceIterator <Relationship> relationshipIterator = ( ResourceIterator )relationships.GetEnumerator())
            {
                while (relationshipIterator.MoveNext())
                {
                    Relationship rel = relationshipIterator.Current;
                    if (IsLoop(rel) == (direction == Direction.BOTH))
                    {
                        last = rel;
                        if (counter++ == which)
                        {
                            rel.Delete();
                            return;
                        }
                    }
                }
            }
            if (which == int.MaxValue && last != null)
            {
                last.Delete();
                return;
            }

            fail("Couldn't find " + (direction == Direction.BOTH ? "loop" : "non-loop") + " relationship " + type.name() + " " + direction + " to delete");
        }
Ejemplo n.º 3
0
 public ActionRepresentationStrategy(HttpRequestMessage req, ActionContextSurface actionContext, RestControlFlags flags) : base(flags)
 {
     this.req           = req;
     this.actionContext = actionContext;
     self          = new MemberRelType(RelValues.Self, new UriMtHelper(req, actionContext));
     parameterList = GetParameterList();
 }
Ejemplo n.º 4
0
 protected AbstractActionRepresentationStrategy(IOidStrategy oidStrategy, HttpRequest req, ActionContextFacade actionContext, RestControlFlags flags)
     : base(oidStrategy, flags)
 {
     Req           = req;
     ActionContext = actionContext;
     self          = new MemberRelType(RelValues.Self, new UriMtHelper(oidStrategy, req, actionContext));
 }
 public void Reset(RelType relType)
 {
     if (_relIds.ContainsKey(relType))
     {
         _relIds.Remove(relType);
     }
 }
 protected MemberRepresentationStrategy(IOidStrategy oidStrategy, HttpRequestMessage req, PropertyContextFacade propertyContext, RestControlFlags flags)
     : base(oidStrategy, flags)
 {
     Req             = req;
     PropertyContext = propertyContext;
     objectUri       = new UriMtHelper(oidStrategy, req, propertyContext);
     self            = new MemberRelType(RelValues.Self, new UriMtHelper(oidStrategy, req, propertyContext));
 }
 public void AddValues(List<String> values, RelType relType)
 {
     if (!_relIds.ContainsKey(relType))
     {
         _relIds.Add(relType, new List<String>());
     }
     _relIds[relType].AddRange(values);
 }
 public void AddValues(List <String> values, RelType relType)
 {
     if (!_relIds.ContainsKey(relType))
     {
         _relIds.Add(relType, new List <String>());
     }
     _relIds[relType].AddRange(values.Where(v => !_relIds[relType].Contains(v)));
 }
Ejemplo n.º 9
0
        private void SetLinks(HttpRequestMessage req, ITypeFacade spec, RelType parentRelType)
        {
            var tempLinks = new List <LinkRepresentation> {
                LinkRepresentation.Create(OidStrategy, parentRelType, Flags),
                LinkRepresentation.Create(OidStrategy, SelfRelType, Flags)
            };

            Links = tempLinks.ToArray();
        }
        public string Serialize()
        {
            if (RelType == RelationshipType.Custom && string.IsNullOrWhiteSpace(CustomRelType))
            {
                throw new ArgumentException("Invalid custom relationship type! Type needs to be custom as well when custom type name is explicitly set!");
            }

            return($"RELTYPE={ (RelType == RelationshipType.Custom ? CustomRelType : RelType.ToString().ToUpper()) }");
        }
Ejemplo n.º 11
0
 public void AddValues(IEnumerable <String> values, RelType relType)
 {
     if (!_relIds.TryGetValue(relType, out List <String> list))
     {
         list = new List <String>();
         _relIds.Add(relType, list);
     }
     list.AddRange(values.Where(v => !list.Contains(v)));
 }
Ejemplo n.º 12
0
            public string GetNext(RelType relType)
            {
                if (!_relIds.TryGetValue(relType, out List <string> list))
                {
                    list = new List <string>();
                    _relIds.Add(relType, list);
                }

                var newId = string.Concat("rId", (list.Count + 1).ToString());

                list.Add(newId);
                return(newId);
            }
Ejemplo n.º 13
0
        private void SetLinks(HttpRequestMessage req, ITypeFacade spec, RelType parentRelType)
        {
            var tempLinks = new List <LinkRepresentation> {
                LinkRepresentation.Create(OidStrategy, parentRelType, Flags),
                LinkRepresentation.Create(OidStrategy, SelfRelType, Flags)
            };

            if (Flags.FormalDomainModel)
            {
                tempLinks.Add(LinkRepresentation.Create(OidStrategy, new DomainTypeRelType(RelValues.ElementType, new UriMtHelper(OidStrategy, req, spec)), Flags));
            }

            Links = tempLinks.ToArray();
        }
Ejemplo n.º 14
0
 private void AssertCounts(Node me, IDictionary <RelType, int[]> expectedCounts)
 {
     assertEquals(TotalCount(expectedCounts, Direction.BOTH), me.Degree);
     assertEquals(TotalCount(expectedCounts, Direction.BOTH), me.GetDegree(Direction.BOTH));
     assertEquals(TotalCount(expectedCounts, Direction.OUTGOING), me.GetDegree(Direction.OUTGOING));
     assertEquals(TotalCount(expectedCounts, Direction.INCOMING), me.GetDegree(Direction.INCOMING));
     foreach (KeyValuePair <RelType, int[]> entry in expectedCounts.SetOfKeyValuePairs())
     {
         RelType type = entry.Key;
         assertEquals(TotalCount(entry.Value, Direction.BOTH), me.GetDegree(type));
         assertEquals(TotalCount(entry.Value, Direction.OUTGOING), me.GetDegree(type, Direction.OUTGOING));
         assertEquals(TotalCount(entry.Value, Direction.INCOMING), me.GetDegree(type, Direction.INCOMING));
         assertEquals(TotalCount(entry.Value, Direction.BOTH), me.GetDegree(type, Direction.BOTH));
     }
 }
Ejemplo n.º 15
0
        public static RelType[] GetRelData(Card C)                                                                                    /* Decodes Reloctation Data for REL cards. Returns null if invalid Reloctation Data */
        {
            string rel = Convert.ToString((long)C.W8L.LW, 2).PadLeft(36, '0') + Convert.ToString((long)C.W8R.LW, 2).PadLeft(36, '0'); /* convert W8L and W8R to 72 Bit Binary string */
            int    pos = 0;

            RelType[] r = new RelType[C.W9L.D * 2];
            for (int i = 0; i < C.W9L.D * 2; i++) /* for each decrement and address in Card */
            {
                if (pos >= rel.Length)            /* not enough data -> invalid */
                {
                    return(null);
                }
                if (rel[pos] == '0') /* Bit 0: Absolute */
                {
                    r[i] = RelType.absolute;
                }
                else
                {
                    pos++;
                    if (pos >= rel.Length)
                    {
                        return(null);
                    }
                    if (rel[pos] == '0') /*Bits 10: Relocatable Direct */
                    {
                        r[i] = RelType.relocatable_direct;
                    }
                    else  /*Bits 11: Relocatable Complemented */
                    {
                        r[i] = RelType.relocatable_complemented;
                    }
                }
                pos++;
            }
            for (int i = pos; i < rel.Length; i++)
            {
                if (rel[i] != '0')
                {
                    return(null); /* additional data at the end -> invalid */
                }
            }
            return(r);
        }
            public String GetNext(RelType relType)
            {
                if (!_relIds.ContainsKey(relType))
                {
                    _relIds.Add(relType, new List<String>());
                }

                Int32 id = _relIds[relType].Count + 1;
                while (true)
                {
                    String relId = String.Format("rId{0}", id);
                    if (!_relIds[relType].Contains(relId))
                    {
                        _relIds[relType].Add(relId);
                        return relId;
                    }
                    id++;
                }
            }
            public String GetNext(RelType relType)
            {
                if (!_relIds.ContainsKey(relType))
                {
                    _relIds.Add(relType, new List <String>());
                }

                Int32 id = _relIds[relType].Count + 1;

                while (true)
                {
                    String relId = String.Format("rId{0}", id);
                    if (!_relIds[relType].Contains(relId))
                    {
                        _relIds[relType].Add(relId);
                        return(relId);
                    }
                    id++;
                }
            }
Ejemplo n.º 18
0
            public String GetNext(RelType relType)
            {
                if (!_relIds.TryGetValue(relType, out List <String> list))
                {
                    list = new List <String>();
                    _relIds.Add(relType, list);
                }

                Int32 id = list.Count + 1;

                while (true)
                {
                    String relId = String.Concat("rId", id);
                    if (!list.Contains(relId))
                    {
                        list.Add(relId);
                        return(relId);
                    }
                    id++;
                }
            }
Ejemplo n.º 19
0
 public static void Save(RelType[] vec, string fname)
 {
     #if NO_ZSTREAM
     using (StreamWriter sw = new StreamWriter(fname))
     #else
     using (StreamWriter sw = ZStreamWriter.Open(fname))
     #endif
     {
         for (int i = 0; i < vec.Length; i++)
         {
             sw.WriteLine(vec[i]);
         }
     }
 }
Ejemplo n.º 20
0
 public static void Print(RelType[][] mat)
 {
     for (int i = 0; i < mat.Length; i++)
     {
         for (int j = 0; j < mat[i].Length; j++)
         {
             Console.Write("{0} ", mat[i][j]);
         }
         Console.WriteLine("");
     }
 }
Ejemplo n.º 21
0
 //unsafe public static byte[] CompressFloatMat(float[][] mat)
 //{
 //    unchecked
 //    {
 //        int rows = mat.Length;
 //        int cols = mat[0].Length;
 //        int maskLength = (cols + 7) >> 3;
 //        int len;
 //        byte[] bufferArray = new byte[rows * (maskLength + (cols << 2)) + 2];
 //        fixed (byte* buffer = bufferArray)
 //        {
 //            byte* b = buffer;
 //            *((int*)b) = rows;
 //            b += 4;
 //            *((int*)b) = cols;
 //            b += 4;
 //            for (int i = 0; i < mat.Length; i++)
 //            {
 //                fixed (float* row = mat[i])
 //                {
 //                    float* r = row;
 //                    float* rEnd = row + cols;
 //                    float* d = (float*)(b + maskLength);
 //                    byte bit = 1;
 //                    while (r != rEnd)
 //                    {
 //                        if (*r != 0.0F)
 //                        {
 //                            *(d++) = *r;
 //                            *b |= bit;
 //                        }
 //                        r++;
 //                        bit <<= 1;
 //                        if (bit == 0)
 //                        {
 //                            bit = 1;
 //                            b++;
 //                        }
 //                    }
 //                    b = (byte*)d;
 //                }
 //            }
 //            len = (int)(b - buffer);
 //        }
 //        if (bufferArray.Length != len)
 //        {
 //            byte[] all = bufferArray;
 //            bufferArray = new byte[len];
 //            Buffer.BlockCopy(all, 0, bufferArray, 0, bufferArray.Length);
 //        }
 //        return bufferArray;
 //    }
 //}
 public static RelType[][] LoadRelTypeJag(string fname)
 {
     char[] seps = new char[1]{'\t'};
     string[][] strArr = IOUtils.ReadSplitRows(fname, seps);
     RelType[][] mat = new RelType[strArr.Length][];
     for (int i = 0; i < strArr.Length; i++)
     {
         mat[i] = new RelType[strArr[i].Length];
         for (int j = 0; j < mat[i].Length; j++)
         {
             mat[i][j] = (RelType)Enum.Parse(typeof(RelType), strArr[i][j], true);
         }
     }
     return mat;
 }
Ejemplo n.º 22
0
 public FaviconViewModel(RelType relType)
 {
     Type = relType == RelType.Icon ? "image/png" : string.Empty;
 }
Ejemplo n.º 23
0
        private void EnsureRightDegree(int initialSize, ICollection <RelationshipCreationSpec> cspecs, ICollection <RelationshipDeletionSpec> dspecs)
        {
            IDictionary <RelType, int[]> expectedCounts = new Dictionary <RelType, int[]>(typeof(RelType));

            foreach (RelType type in RelType.values())
            {
                expectedCounts[type] = new int[3];
            }
            Node me = GraphDb.createNode();

            for (int i = 0; i < initialSize; i++)
            {
                me.CreateRelationshipTo(GraphDb.createNode(), RelType.Initial);
            }
            NewTransaction();
            expectedCounts[RelType.Initial][0] = initialSize;

            AssertCounts(me, expectedCounts);
            int counter = 0;

            foreach (RelationshipCreationSpec spec in cspecs)
            {
                for (int i = 0; i < spec.Count; i++)
                {
                    Node otherNode = null;
                    if (spec.Dir == Direction.OUTGOING)
                    {
                        otherNode = GraphDb.createNode();
                        me.CreateRelationshipTo(otherNode, spec.Type);
                    }
                    else if (spec.Dir == Direction.INCOMING)
                    {
                        otherNode = GraphDb.createNode();
                        otherNode.CreateRelationshipTo(me, spec.Type);
                    }
                    else
                    {
                        me.CreateRelationshipTo(me, spec.Type);
                    }
                    expectedCounts[spec.Type][spec.Dir.ordinal()]++;

                    if (otherNode != null)
                    {
                        assertEquals(1, otherNode.Degree);
                    }
                    AssertCounts(me, expectedCounts);
                    if (counter % 3 == 0 && counter > 0)
                    {
                        NewTransaction();
                        AssertCounts(me, expectedCounts);
                    }
                }
            }

            AssertCounts(me, expectedCounts);
            NewTransaction();
            AssertCounts(me, expectedCounts);

            // Delete one of each type/direction combination
            counter = 0;
            if (dspecs == null)
            {
                foreach (RelType type in RelType.values())
                {
                    if (!type.measure)
                    {
                        continue;
                    }
                    foreach (Direction direction in Direction.values())
                    {
                        int[] counts = expectedCounts[type];
                        if (counts[direction.ordinal()] > 0)
                        {
                            DeleteOneRelationship(me, type, direction, 0);
                            counts[direction.ordinal()]--;
                            AssertCounts(me, expectedCounts);
                            if (counter % 3 == 0 && counter > 0)
                            {
                                NewTransaction();
                                AssertCounts(me, expectedCounts);
                            }
                        }
                    }
                }
            }
            else
            {
                foreach (RelationshipDeletionSpec spec in dspecs)
                {
                    DeleteOneRelationship(me, spec.Type, spec.Dir, spec.Which);
                    expectedCounts[spec.Type][spec.Dir.ordinal()]--;
                    AssertCounts(me, expectedCounts);
                    if (counter % 3 == 0 && counter > 0)
                    {
                        NewTransaction();
                        AssertCounts(me, expectedCounts);
                    }
                }
            }

            AssertCounts(me, expectedCounts);
            NewTransaction();
            AssertCounts(me, expectedCounts);

            // Clean up
            foreach (Relationship rel in me.Relationships)
            {
                Node otherNode = rel.GetOtherNode(me);
                if (!otherNode.Equals(me))
                {
                    otherNode.Delete();
                }
                rel.Delete();
            }
            me.Delete();
        }
 protected LinkRepresentation(RelType relType, RestControlFlags flags) : base(relType, flags)
 {
     SetScalars(relType);
 }
Ejemplo n.º 25
0
 public static string ToTSV(RelType[] vec)
 {
     string ans = null;
     foreach(RelType relation in vec)
         ans += relation.ToString() + "\t";
     return ans.Remove(ans.Length-1, 1);
 }
Ejemplo n.º 26
0
 public static void Save(RelType[][] mat, string fname)
 {
     #if NO_ZSTREAM
     using (StreamWriter sw = new StreamWriter(fname))
     #else
     using (StreamWriter sw = ZStreamWriter.Open(fname))
     #endif
     {
         int nRows = mat.Length;
         int nCols;
         for (int i = 0; i < nRows; i++)
         {
             nCols = mat[i].Length;
             for (int j = 0; j < nCols-1; j++)
             {
                 sw.Write(mat[i][j]);
                 sw.Write("\t");
             }
             sw.WriteLine(mat[i][nCols-1]);
         }
     }
 }
 private void SetScalars(RelType relType)
 {
     Rel    = relType.Name;
     Method = relType.Method.ToString().ToUpper();
     Type   = relType.GetMediaType(Flags).ToString();
 }
Ejemplo n.º 28
0
 internal static RelationshipCreationSpec Create(RelType type, Direction dir, int count)
 {
     return(new RelationshipCreationSpec(type, dir, count));
 }
Ejemplo n.º 29
0
 internal RelationshipDeletionSpec(RelType type, Direction dir, int which)
 {
     this.Type  = type;
     this.Dir   = dir;
     this.Which = which;
 }
Ejemplo n.º 30
0
 internal RelationshipCreationSpec(RelType type, Direction dir, int count)
 {
     this.Type  = type;
     this.Dir   = dir;
     this.Count = count;
 }
Ejemplo n.º 31
0
 protected RefValueRepresentation(IOidStrategy oidStrategy, RelType relType, RestControlFlags flags)
     : base(oidStrategy, flags)
 {
     Href = relType.GetUri().AbsoluteUri;
 }
Ejemplo n.º 32
0
 public static void SaveSerial(RelType[][] mat, string fname)
 {
     #if NO_ZSTREAM
     using (Stream fs = new FileStream(fname, FileMode.Create))
     #else
     using (Stream fs = ZStreamOut.Open(fname))
     #endif
     {
         BinaryFormatter serializer = new BinaryFormatter();
         serializer.Serialize(fs, mat);
     }
 }
Ejemplo n.º 33
0
        /// <summary>
        /// Map a feature value to the offset in a binary vector (so that the binary vector should be
        /// set to 'one' at that offset).  Note that the EQ relations are always checked first; we conservatively
        /// allow the EQ relations to appear anywhere here, but usually they should be first.  However the LTE
        /// have to be in order.  This function assumes that there is only one GT and that it is at the end.  Note
        /// that every value gets mapped to 1 in some bin, somewhere.
        /// 
        /// It is possible that no conditions in <relations> are met.  If this occurs, return -1, to flag the calling
        /// routine to fill all slots with 0.  However, if this does occur, you need to check why this is happening and
        /// make sure that you want it to happen (e.g. all relations are of type EQ, a value falls in between, and that's OK).
        /// Here's one reason why this is a good idea: if the <relations> and <thresholds> were computed using all the
        /// training data, then if we added an extra condition to handle data _not_ in the training data, the corresponding
        /// weight in a neural net should remain at 0 anyway: otherwise, the effect on the net would be essentially random
        /// for that pattern.
        /// </summary>
        /// <param name="val"></param>
        /// <param name="thresholds"></param>
        /// <param name="relations"></param>
        /// <returns></returns>
        public static int MapNumToBin(float val, float[] thresholds, RelType[] relations)
        {
            int ans = -1;
            bool found = false;

#if DEBUG
            if (relations.Length != thresholds.Length)
            {
                throw new ArgumentOutOfRangeException("Must be same number of thresholds as relations");
            }
#endif

            for (int i=0; i<thresholds.Length; ++i)
            {
                RelType reln = relations[i];
                float thrsh = thresholds[i];
                if (reln == RelType.EQ && val == thrsh)
                {
                    ans = i;
                    found = true;
                    break;
                }
            }

            if (!found)
            {
                for (int i=0; i<thresholds.Length; ++i)
                {
                    RelType reln = relations[i];
                    float thrsh = thresholds[i];
                    if (reln == RelType.LTE && val <= thrsh)
                    {
                        ans = i;
                        found = true;
                        break;
                    }
                }
            }

            if (!found && relations[relations.Length-1] == RelType.GT && val > thresholds[thresholds.Length-1])
            {
                ans = relations.Length-1;
                found = true;
            }

            if (!found)
            {
                // Missed all tests.  Flag as 'set all slots to 0'.
                Console.WriteLine("MapNumToBin: WARNING: No condition met.  Flagging as all zeros.");
                ans = -1;
            }

            return ans;
        }
Ejemplo n.º 34
0
 public static RelType[] TSVToRelTypeArr(string tsv)
 {
     string[] fields = tsv.Split('\t');
     RelType[] values = new RelType[fields.Length];
     for(int i=0; i<fields.Length; ++i)
     {
         values[i] = (RelType)Enum.Parse(typeof(RelType), fields[i]);
     }
     return values;
 }
 public static RefValueRepresentation Create(RelType relType, RestControlFlags flags)
 {
     return(new RefValueRepresentation(relType, flags));
 }
 public static LinkRepresentation Create(RelType relType, RestControlFlags flags, params OptionalProperty[] properties)
 {
     return(properties.Any() ? CreateWithOptionals <LinkRepresentation>(new object[] { relType, flags }, properties) : new LinkRepresentation(relType, flags));
 }
 public void Reset(RelType relType)
 {
     if (_relIds.ContainsKey(relType))
         _relIds.Remove(relType);
 }
Ejemplo n.º 38
0
 internal static RelationshipDeletionSpec Delete(RelType type, Direction dir, int which)
 {
     return(new RelationshipDeletionSpec(type, dir, which));
 }
Ejemplo n.º 39
0
 public static RefValueRepresentation Create(IOidStrategy oidStrategy, RelType relType, RestControlFlags flags)
 {
     return(new RefValueRepresentation(oidStrategy, relType, flags));
 }
 protected LinkRepresentation(IOidStrategy oidStrategy, RelType relType, RestControlFlags flags)
     : base(oidStrategy, relType, flags)
 {
     SetScalars(relType);
 }
Ejemplo n.º 41
0
        /// <summary>
        /// NOTE: col is sorted in place - make a copy.  Compute a number of thresholds to
        /// use for binarization.  Attempt to use nBins.  See notes at top of this file, also
        /// headers of the called functions, for the algorithm.  Fills <thresholds> and <relations>,
        /// which are in 1-1 correspondence.
        /// </summary>
        public void CompThresholds(float[] col, int nBins, out float[] thresholds, out RelType[] relations)
        {
            int nPoints = col.Length;
            ArrayList thrsh = new ArrayList();
            ArrayList relns = new ArrayList();
#if DEBUG
            if (nBins<=0 || nBins > nPoints)
            {
                Console.WriteLine("nBins = {0}, nPoints = {1}", nBins, nPoints);
                throw new ArgumentException("nBins: illegal value");
            }
#endif

            Array.Sort(col);
            float[][] runs = ArrayUtils.RunEncode(col);
            //			Console.WriteLine("");
            //			ArrayUtils.Print(col);
            // ArrayUtils.Print(runs);

            // Step (1): The case of fewer runs than requested nBins.
            if (runs.Length <= nBins) AddThrshRlnsForAllRuns(runs, thrsh, relns);
            else
            {
                // Step (2): Populate the EQ bins.  Since the EQ bins should always be checked first, we will always put them first
                // in the list of relations + thresholds.
                bool[] EQRunsFlags = FlagEQRuns(runs);
                int nNonEQRuns = 0;
                for(int i=0; i<runs.Length; ++i)
                {
                    if(EQRunsFlags[i])
                    {
                        thrsh.Add(runs[i][2]);
                        relns.Add(RelType.EQ);
                    }
                    else ++nNonEQRuns;
                }


                if(nNonEQRuns > 0)
                {
                    float[][] truncRuns = new float[nNonEQRuns][];
                    int nTruncRuns=0;
                    for (int i=0; i<runs.Length; ++i)
                    {
                        if (!EQRunsFlags[i]) truncRuns[nTruncRuns++] = runs[i];
                    }
                    AddThrshRelnsForBlocksOfRuns(truncRuns, nBins, thrsh, relns);
                }
            }

#if DEBUG
            if(thrsh.Count != relns.Count) throw new Exception("thresholds, relations have different sizes");
#endif

            thresholds = new float[thrsh.Count];
            relations = new RelType[relns.Count];
            for (int i = 0; i < thrsh.Count; i++)
            {
                thresholds[i] = (float)thrsh[i];
                relations[i] = (RelType)relns[i];
            }

#if DEBUG
            RelType last = relations[relations.Length-1];
            if (last != RelType.EQ && last != RelType.GT) throw new Exception("relations violate GT or EQ at end rule");
            for (int i=0; i<relations.Length-1; ++i)
            {
                if (relations[i] == RelType.GT) throw new Exception("relations violate GT or EQ at end rule");
            }
#endif
        }
 public static LinkRepresentation Create(IOidStrategy oidStrategy, RelType relType, RestControlFlags flags, params OptionalProperty[] properties) =>
 properties.Any()
         ? CreateWithOptionals <LinkRepresentation>(new object[] { oidStrategy, relType, flags }, properties)
         : new LinkRepresentation(oidStrategy, relType, flags);
 /// <summary>
 /// Represents the HTML attribute "rel".
 /// </summary>
 /// <param name="rel">The value.</param>
 /// <returns>The same instance of <see cref="Hex.AttributeBuilders.HtmlAttributeBuilder"/>.</returns>
 public HtmlAttributeBuilder Rel( RelType rel )
 {
     return this.Rel( rel.ToLowerString() );
 }