public void CreatePredicate_ValidPredicateValue_SetTriplesPredicate()
        {
            // 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.CreatePredicate("[dc:creator]","http://example.org/john-d/", null, uriMappings);

            var result = builder.GetTriple();

            // Assert
            Assert.AreEqual("http://purl.org/dc/elements/1.1/creator", result.Predicate);
        }
        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);
        }
Beispiel #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());
 }