Ejemplo n.º 1
0
        public void Should_return_term_mapped_to_prefixed_name()
        {
            // given
            const string term = "time_prop";

            // when
            var uri = ContextHelpers.GetExpandedIri(SingleContext, term);

            // then
            uri.Should().Be(Xsd.time);
        }
Ejemplo n.º 2
0
        public void Should_return_mapped_prefixed_term()
        {
            // given
            const string term = "xsd:integer";

            // when
            var uri = ContextHelpers.GetExpandedIri(SingleContext, term);

            // then
            uri.Should().Be(Xsd.integer);
        }
Ejemplo n.º 3
0
        public void Should_return_directly_mapped_term()
        {
            // given
            const string term = "givenName";

            // when
            var uri = ContextHelpers.GetExpandedIri(SingleContext, term);

            // then
            uri.Should().Be(Foaf.givenName);
        }
Ejemplo n.º 4
0
        public void Should_return_null_if_it_is_no_mapped()
        {
            // given
            const string term = "no_such_term";

            // when
            var uri = ContextHelpers.GetExpandedIri(EmptyContext, term);

            // then
            uri.Should().BeNull();
        }
Ejemplo n.º 5
0
        public string GetPropertyId(PropertyInfo property)
        {
            var context = this.contextResolver.GetContext(property.ReflectedType);

            if (context != null)
            {
                return(ContextHelpers.GetExpandedIri(context, property.GetJsonPropertyName()));
            }

            return(null);
        }
        /// <summary>
        /// Gets the property identifier from the @context
        /// or as concatenation of class and property name.
        /// </summary>
        public string GetPropertyId(PropertyInfo property, Uri classId)
        {
            var context = _contextResolver.GetContext(property.ReflectedType);

            if (context != null)
            {
                var mappedTerm = ContextHelpers.GetExpandedIri(context, property.GetJsonPropertyName());

                if (mappedTerm != null)
                {
                    return(mappedTerm);
                }
            }

            return(GetFallbackPropertyId(property, property.GetJsonPropertyName(), classId));
        }