示例#1
0
        public void roundTripWriteTwoUUTTriplesWithSameSubject()
        {
            RdfXmlWriterTestHarness harness = new RdfXmlWriterTestHarness();

            harness.expect("<http://example.com/subj> <http://example.com/pred> \"fizz\"^^<http://www.w3.org/2001/XMLSchema#integer> .");
            harness.expect("<http://example.com/subj> <http://example.com/pred2> \"bang\"^^<http://www.w3.org/2001/XMLSchema#integer> .");

            RdfWriter rdfWriter = harness.getRdfWriter();

            rdfWriter.StartOutput();
            rdfWriter.StartSubject();
            rdfWriter.WriteUriRef("http://example.com/subj");
            rdfWriter.StartPredicate();
            rdfWriter.WriteUriRef("http://example.com/pred");
            rdfWriter.StartObject();
            rdfWriter.WriteTypedLiteral("fizz", "http://www.w3.org/2001/XMLSchema#integer");
            rdfWriter.EndObject();
            rdfWriter.EndPredicate();
            rdfWriter.StartPredicate();
            rdfWriter.WriteUriRef("http://example.com/pred2");
            rdfWriter.StartObject();
            rdfWriter.WriteTypedLiteral("bang", "http://www.w3.org/2001/XMLSchema#integer");
            rdfWriter.EndObject();
            rdfWriter.EndPredicate();
            rdfWriter.EndSubject();
            rdfWriter.EndOutput();


            bool testPassed = harness.verify();

            Assert.IsTrue(testPassed);
        }
示例#2
0
        public void roundTripTwoUUUTriplesWithSameSubjectDifferentPredicateNamespaces()
        {
            RdfXmlWriterTestHarness harness = new RdfXmlWriterTestHarness();

            harness.expect("<http://example.com/subj> <http://ex1.example.com/pred> <http://example.com/obj> .");
            harness.expect("<http://example.com/subj> <http://ex2.example.com/pred> <http://example.com/obj2> .");

            RdfWriter rdfWriter = harness.getRdfWriter();

            rdfWriter.StartOutput();
            rdfWriter.StartSubject();
            rdfWriter.WriteUriRef("http://example.com/subj");
            rdfWriter.StartPredicate();
            rdfWriter.WriteUriRef("http://ex1.example.com/pred");
            rdfWriter.StartObject();
            rdfWriter.WriteUriRef("http://example.com/obj");
            rdfWriter.EndObject();
            rdfWriter.EndPredicate();
            rdfWriter.StartPredicate();
            rdfWriter.WriteUriRef("http://ex2.example.com/pred");
            rdfWriter.StartObject();
            rdfWriter.WriteUriRef("http://example.com/obj2");
            rdfWriter.EndObject();
            rdfWriter.EndPredicate();
            rdfWriter.EndSubject();
            rdfWriter.EndOutput();


            Assert.IsTrue(harness.verify());
        }
示例#3
0
        public void roundTripWriteTwoUUPWithLanguageTriplesWithSameSubject()
        {
            RdfXmlWriterTestHarness harness = new RdfXmlWriterTestHarness();

            harness.expect("<http://example.com/subj> <http://example.com/pred> \"fizz\"@fr .");
            harness.expect("<http://example.com/subj> <http://example.com/pred2> \"bang\"@it .");

            RdfWriter rdfWriter = harness.getRdfWriter();

            rdfWriter.StartOutput();
            rdfWriter.StartSubject();
            rdfWriter.WriteUriRef("http://example.com/subj");
            rdfWriter.StartPredicate();
            rdfWriter.WriteUriRef("http://example.com/pred");
            rdfWriter.StartObject();
            rdfWriter.WritePlainLiteral("fizz", "fr");
            rdfWriter.EndObject();
            rdfWriter.EndPredicate();
            rdfWriter.StartPredicate();
            rdfWriter.WriteUriRef("http://example.com/pred2");
            rdfWriter.StartObject();
            rdfWriter.WritePlainLiteral("bang", "it");
            rdfWriter.EndObject();
            rdfWriter.EndPredicate();
            rdfWriter.EndSubject();
            rdfWriter.EndOutput();

            bool testPassed = harness.verify();

            Assert.IsTrue(testPassed);
        }
示例#4
0
        public void roundTripTwoUUUTriplesWithSameSubjectAndPredicate()
        {
            RdfXmlWriterTestHarness harness = new RdfXmlWriterTestHarness();

            harness.expect("<http://example.com/subj> <http://example.com/pred> <http://example.com/obj> .");
            harness.expect("<http://example.com/subj> <http://example.com/pred> <http://example.com/obj2> .");
            writeTwoUUUTriplesWithSameSubjectAndPredicate(harness.getRdfWriter());

            Assert.IsTrue(harness.verify());
        }
示例#5
0
        public void roundTripWriteSingleUUUTriple()
        {
            RdfXmlWriterTestHarness harness = new RdfXmlWriterTestHarness();

            harness.expect("<http://example.com/subj> <http://example.com/pred> <http://example.com/obj> .");

            writeSingleUUUTriple(harness.getRdfWriter());

            Assert.IsTrue(harness.verify());
        }
示例#6
0
        public void roundTripWriteSingleBUBTripleWithSameNodeId()
        {
            RdfXmlWriterTestHarness harness = new RdfXmlWriterTestHarness();

            harness.expect("_:genid1 <http://example.com/pred> _:genid1 .");

            RdfWriter rdfWriter = harness.getRdfWriter();

            rdfWriter.StartOutput();
            rdfWriter.StartSubject();
            rdfWriter.WriteBlankNode("foo");
            rdfWriter.StartPredicate();
            rdfWriter.WriteUriRef("http://example.com/pred");
            rdfWriter.StartObject();
            rdfWriter.WriteBlankNode("foo");
            rdfWriter.EndObject();
            rdfWriter.EndPredicate();
            rdfWriter.EndSubject();
            rdfWriter.EndOutput();

            Assert.IsTrue(harness.verify());
        }
示例#7
0
        public void roundTripWriteSingleUUPWithoutLanguageTriple()
        {
            RdfXmlWriterTestHarness harness = new RdfXmlWriterTestHarness();

            harness.expect("<http://example.com/subj> <http://example.com/pred> \"fizz\" .");
            RdfWriter rdfWriter = harness.getRdfWriter();

            rdfWriter.StartOutput();
            rdfWriter.StartSubject();
            rdfWriter.WriteUriRef("http://example.com/subj");
            rdfWriter.StartPredicate();
            rdfWriter.WriteUriRef("http://example.com/pred");
            rdfWriter.StartObject();
            rdfWriter.WritePlainLiteral("fizz");
            rdfWriter.EndObject();
            rdfWriter.EndPredicate();
            rdfWriter.EndSubject();
            rdfWriter.EndOutput();

            bool testPassed = harness.verify();

            Assert.IsTrue(testPassed);
        }