/// <summary>
        /// Gets the vocab element list associated with this state instance.
        /// </summary>
        /// <returns>The vocab element list associated with this state instance</returns>
        public VocabElementList GetVocabElementList()
        {
            var rootQuads = defaultQuads.GetSubjectQuads(this.Client.BuildUri(this.Request).ToString());

            // Create and populate the vocabulary element list
            VocabElementList vocabElementList = new VocabElementList();
            var identifierProperty            = VocabConstants.DC_NAMESPACE + "identifier";

            if (rootQuads.HasPredicateQuad(identifierProperty))
            {
                vocabElementList.Id = rootQuads.GetPredicateQuad(VocabConstants.DC_NAMESPACE + "identifier").GetObject().GetValue();
            }
            vocabElementList.Uri         = rootQuads.First().GetSubject().GetValue();
            vocabElementList.Title       = rootQuads.GetPredicateQuad(VocabConstants.DC_NAMESPACE + "title").GetObject().GetValue();
            vocabElementList.Description = rootQuads.GetPredicateQuad(VocabConstants.DC_NAMESPACE + "description").GetObject().GetValue();

            // Populate the list of vocabulary elements within the vocabulary element list
            foreach (var element in defaultQuads.GetPredicateQuads(JSONLDConsts.RdfFirst))
            {
                var node  = element.GetObject();
                var quads = defaultQuads.GetSubjectQuads(node.GetValue());

                vocabElementList.AddElement(MapToVocabElement(quads));
            }

            return(vocabElementList);
        }
示例#2
0
 public void Initialize()
 {
     places = new FamilySearchStateFactory().NewPlacesState(new Uri("https://integration.familysearch.org/platform/collections/places"));
     places.AuthenticateViaOAuth2Password(Resources.TestUserName, Resources.TestPassword, Resources.TestClientId);
     places     = (FamilySearchPlaces)places.Get();
     placeTypes = places.ReadPlaceTypes();
     list       = placeTypes.GetVocabElementList();
 }