public Usage(JObjectWithUsages node, string property, JToken value)
 {
     Node     = node;
     Property = property;
     Value    = value;
 }
        private static bool IsWellFormedListNode(JObjectWithUsages node, string property, Dictionary <string, JArray> nodeUsagesMap)
        {
            // While property equals rdf:rest, the array value of the member of node usages map associated with the
            // @id member of node has only one member, the value associated to the usages member of node has exactly 1 entry,
            // node has a rdf:first and rdf:rest property, both of which have as value an array consisting of a single element,
            // and node has no other members apart from an optional @type member whose value is an array with a single item equal
            // to rdf:List, node represents a well-formed list node.

            if (!RdfSpecsHelper.RdfListRest.Equals(property))
            {
                return(false);
            }
            var nodeId = node["@id"].Value <string>();

            if (nodeId == null)
            {
                return(false);
            }

            // Not mentioned in spec, but if node is not a blank node we should not merge it into a list array
            if (!JsonLdProcessor.IsBlankNodeIdentifier(nodeId))
            {
                return(false);
            }

            var mapEntry = nodeUsagesMap[nodeId] as JArray;

            if (mapEntry == null || mapEntry.Count != 1)
            {
                return(false);
            }

            if (node.Usages.Count != 1)
            {
                return(false);
            }

            var first = node[RdfSpecsHelper.RdfListFirst] as JArray;
            var rest  = node[RdfSpecsHelper.RdfListRest] as JArray;

            if (first == null || rest == null)
            {
                return(false);
            }
            if (first.Count != 1 || rest.Count != 1)
            {
                return(false);
            }
            var type = node["@type"] as JArray;

            if (type != null && (type.Count != 1 ||
                                 type.Count == 1 && !type[0].Value <string>().Equals(RdfSpecsHelper.RdfList)))
            {
                return(false);
            }
            var propCount = node.Properties().Count();

            if (type == null && propCount != 3 || type != null && propCount != 4)
            {
                return(false);
            }
            return(true);
        }