コード例 #1
0
 def test_same_value_same_id_not_empty_object_property(self):
     do = self.ctx.DataObject(ident=R.URIRef("http://example.org"))
     do1 = self.ctx.DataObject(ident=R.URIRef("http://example.org"))
     dz = self.ctx.DataObject(ident=R.URIRef("http://example.org/vip"))
     dz1 = self.ctx.DataObject(ident=R.URIRef("http://example.org/vip"))
     c = DataObject.ObjectProperty("boots", do)
     c1 = DataObject.ObjectProperty("boots", do1)
     do.boots(dz)
     do1.boots(dz1)
     self.assertEqual(c.identifier, c1.identifier)
コード例 #2
0
    def test_object_property_diff_value_insert_order_same_id(self):
        do = self.ctx.DataObject(ident=R.URIRef("http://example.org"))
        do1 = self.ctx.DataObject(ident=R.URIRef("http://example.org"))

        oa = self.ctx.DataObject(ident=R.URIRef("http://example.org/a"))
        ob = self.ctx.DataObject(ident=R.URIRef("http://example.org/b"))
        oc = self.ctx.DataObject(ident=R.URIRef("http://example.org/c"))

        c = DataObject.ObjectProperty("boots", do, multiple=True)
        c1 = DataObject.ObjectProperty("boots", do1, multiple=True)

        do.boots(oa)
        do.boots(ob)
        do.boots(oc)

        do1.boots(oc)
        do1.boots(oa)
        do1.boots(ob)

        self.assertEqual(c.identifier, c1.identifier)
コード例 #3
0
 def test_defined_statements_across_contexts_object_property(self):
     '''
     Statements have the Context included as a regular attribute, so we don't filter
     by the property's current context
     '''
     do = self.ctx.DataObject(ident=R.URIRef("http://example.org/1"))
     ctx = Context('http://example.org/ctx/')
     do.bugs = DataObject.ObjectProperty(multiple=True)
     dp = self.ctx.DataObject(ident=R.URIRef("http://example.org/2"))
     ctx(do).bugs(do)
     do.bugs(dp)
     stmts = list(ctx(do).bugs.defined_statements)
     assert stmts == [
         Statement(do, do.bugs, do, ctx),
         Statement(do, do.bugs, dp, self.context)
     ]