コード例 #1
0
 def test_query(self):
     query = RDFQuery(subject=TemplateWordNode("Subject"),
                      predicate=TemplateWordNode("Predicate"),
                      object=TemplateWordNode("Object"))
     self.assertIsNotNone(query)
     self.assertEquals(query.query_type, RDFQuery.QUERY)
     self.assertEquals(
         "<q><subj>Subject</subj><pred>Predicate</pred><obj>Object</obj></q>",
         query.to_xml(None, None))
コード例 #2
0
 def test_not_query(self):
     query = RDFQuery(rdf_subject=TemplateWordNode("Subject"),
                      rdf_predicate=TemplateWordNode("Predicate"),
                      rdf_object=TemplateWordNode("Object"),
                      query_type=RDFQuery.NOT_QUERY)
     self.assertIsNotNone(query)
     self.assertEquals(query.query_type, RDFQuery.NOT_QUERY)
     self.assertEquals(
         "<notq><subj>Subject</subj><pred>Predicate</pred><obj>Object</obj></notq>",
         query.to_xml(None, None))
     self.assertEquals("not=( subj=Subject, pred=Predicate, obj=Object )",
                       query.to_string(None, None))