Пример #1
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);
        }
Пример #2
0
 /// <summary>Writes a representation of this PlainLiteral to the supplied RdfWriter.</summary>
 /// <remarks></remarks>
 public virtual void Write(RdfWriter writer)
 {
     if (itsLanguage == null)
     {
         writer.WritePlainLiteral(itsLexicalValue);
     }
     else
     {
         writer.WritePlainLiteral(itsLexicalValue, itsLanguage);
     }
 }
Пример #3
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);
        }