コード例 #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
ファイル: TypedLiteral.cs プロジェクト: Titan512/spiralrdf
 /// <summary>Writes a representation of this TypedLiteral to the supplied RdfWriter.</summary>
 /// <remarks></remarks>
 public void Write(RdfWriter writer)
 {
     writer.WriteTypedLiteral(itsLexicalValue, itsDataTypeUriRef);
 }