public void CreateSubject_ValidSubjectValue_SetTriplesSubject()
        {
            // Arrange
            IRDFTripleBuilder builder = new RDFTripleBuilder();
            var uriMappings = new Dictionary<string, string>
                               {
                                   {"foaf", "http://xmlns.com/foaf/0.1/"},
                                   {"dc", "http://purl.org/dc/elements/1.1/"},
                                   {"xsd","http://www.w3.org/2001/XMLSchema#"}
                               };
            // Act
            builder.CreateSubject("http://example.org/john-d/","http://example.org/john-d/", null, uriMappings);

            var result = builder.GetTriple();

            // Assert
            Assert.AreEqual("http://example.org/john-d/", result.Subject);
        }
        public void CreateObject_ValidObjectURIorSafeCURIEValue_SetTriplesObject()
        {
            // Arrange
            IRDFTripleBuilder builder = new RDFTripleBuilder();
            var uriMappings = new Dictionary<string, string>
                               {
                                   {"foaf", "http://xmlns.com/foaf/0.1/"},
                                   {"dc", "http://purl.org/dc/elements/1.1/"},
                                   {"xsd","http://www.w3.org/2001/XMLSchema#"}
                               };
            // Act
            builder.CreateObject("http://example.org/john-d/#me", null, Constants.UriDataType, "http://example.org/john-d/", null, uriMappings);

            var result = builder.GetTriple();

            // Assert
            Assert.IsNotNull(result.Object);
            Assert.AreEqual("http://example.org/john-d/#me", result.Object.Uri);
        }
Exemple #3
0
 private void ConstructTriple(ParserContext context, RDFConstructDto dto, string baseURL, string vocabulary, IDictionary<string, string> uriMappings)
 {
     IRDFTripleBuilder builder = new RDFTripleBuilder();
     builder.CreateSubject(dto.Subject, baseURL, vocabulary, uriMappings);
     builder.CreatePredicate(dto.Predicate, baseURL, vocabulary, uriMappings);
     builder.CreateObject(dto.Object, dto.Language, dto.DataType, baseURL, vocabulary, uriMappings);
     _constructedTiples.Add(builder.GetTriple());
 }