示例#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 Write(RdfWriter writer)
        {
            writer.StartOutput();
            foreach (Statement statement in itsStatements)
            {
                statement.Write(writer);
            }

            writer.EndOutput();
        }
示例#5
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);
     }
 }
示例#6
0
 public virtual void Write(RdfWriter writer)
 {
     writer.StartSubject();
     itsSubject.Write(writer);
     writer.StartPredicate();
     itsPredicate.Write(writer);
     writer.StartObject();
     itsObject.Write(writer);
     writer.EndObject();
     writer.EndPredicate();
     writer.EndSubject();
 }
示例#7
0
        public void roundTripTwoUUUTriplesWithSameSubject()
        {
            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/pred2> <http://example.com/obj2> .");

            RdfWriter rdfWriter = harness.getRdfWriter();

            writeTwoUUUTriplesWithSameSubject(harness.getRdfWriter());

            Assert.IsTrue(harness.verify());
        }
示例#8
0
 public void writeSingleUUUTriple(RdfWriter rdfWriter)
 {
     rdfWriter.StartOutput();
     rdfWriter.StartSubject();
     rdfWriter.WriteUriRef("http://example.com/subj");
     rdfWriter.StartPredicate();
     rdfWriter.WriteUriRef("http://example.com/pred");
     rdfWriter.StartObject();
     rdfWriter.WriteUriRef("http://example.com/obj");
     rdfWriter.EndObject();
     rdfWriter.EndPredicate();
     rdfWriter.EndSubject();
     rdfWriter.EndOutput();
 }
示例#9
0
        public void Write(RdfWriter writer)
        {
            writer.StartOutput();
            IEnumerator statementEnum = GetStatementEnumerator();

            while (statementEnum.MoveNext())
            {
                ResourceStatement statement = (ResourceStatement)statementEnum.Current;
                writer.StartSubject();
                GetBestDenotingNode(statement.GetSubject()).Write(writer);
                writer.StartPredicate();
                GetBestDenotingNode(statement.GetPredicate()).Write(writer);
                writer.StartObject();
                GetBestDenotingNode(statement.GetObject()).Write(writer);
                writer.EndObject();
                writer.EndPredicate();
                writer.EndSubject();
            }
            writer.EndOutput();
        }
示例#10
0
 public void writeTwoUUUTriplesWithSameSubject(RdfWriter rdfWriter)
 {
     rdfWriter.StartOutput();
     rdfWriter.StartSubject();
     rdfWriter.WriteUriRef("http://example.com/subj");
     rdfWriter.StartPredicate();
     rdfWriter.WriteUriRef("http://example.com/pred");
     rdfWriter.StartObject();
     rdfWriter.WriteUriRef("http://example.com/obj");
     rdfWriter.EndObject();
     rdfWriter.EndPredicate();
     rdfWriter.StartPredicate();
     rdfWriter.WriteUriRef("http://example.com/pred2");
     rdfWriter.StartObject();
     rdfWriter.WriteUriRef("http://example.com/obj2");
     rdfWriter.EndObject();
     rdfWriter.EndPredicate();
     rdfWriter.EndSubject();
     rdfWriter.EndOutput();
 }
示例#11
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());
        }
示例#12
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);
        }
示例#13
0
 /// <summary>Writes a representation of this BlankNode to the supplied RdfWriter.</summary>
 /// <remarks></remarks>
 public virtual void Write(RdfWriter writer)
 {
     writer.WriteBlankNode("spiral" + GetHashCode());
 }
示例#14
0
 public void Write(RdfWriter writer)
 {
     ++WriteCalled;
 }
示例#15
0
 public virtual void Write(RdfWriter writer)
 {
     itsAssertions.Write(writer);
 }
示例#16
0
 public void Write(RdfWriter writer)
 {
     //NOOP
 }
 public void Write(RdfWriter writer)
 {
     itsStore.Write(writer);
 }
示例#18
0
 public override void Write(RdfWriter writer)
 {
     // NOOP
 }
示例#19
0
 public void Should_serialize_statements_grouped_by_graph()
 {
     RdfWriter.Verify(instance => instance.Write(It.IsAny <StreamWriter>(), It.Is <IEnumerable <KeyValuePair <Iri, IEnumerable <Statement> > > >(collection => Match(collection))));
 }
示例#20
0
 public void Should_serialize_into_a_given_stream()
 {
     RdfWriter.Verify(instance => instance.Write(Buffer, It.IsAny <IEnumerable <KeyValuePair <Iri, IEnumerable <Statement> > > >()));
 }
示例#21
0
 public void Write(RdfWriter writer)
 {
 }
示例#22
0
 /// <summary>Writes a representation of this TypedLiteral to the supplied RdfWriter.</summary>
 /// <remarks></remarks>
 public void Write(RdfWriter writer)
 {
     writer.WriteTypedLiteral(itsLexicalValue, itsDataTypeUriRef);
 }
示例#23
0
 public override void Write(RdfWriter writer)
 {
     itsMethodCalls.RecordMethodCall("Write", writer);
 }
示例#24
0
 /// <summary>Writes a representation of this UriRef to the supplied RdfWriter.</summary>
 public virtual void Write(RdfWriter writer)
 {
     writer.WriteUriRef(itsUriRef);
 }
示例#25
0
 public bool WasWriteCalledWith(RdfWriter writer)
 {
     return(itsMethodCalls.WasMethodCalledWith("Write", writer));
 }