def test_bnode(self): g = Graph() b1 = BNode() g.add((URIRef("http://*****:*****@context": self.ctxt({ "list": { "@id": "http://www.example.com/list", "@type": "@id" }, "first": { "@id": "http://www.example.com/first", "@type": "@id" }, "rest": { "@id": "http://www.example.com/rest", "@type": "@id" }, "rdf": str(RDF) }), "@id": "foo", "list": { "first": "http://www.example.com/value", "rest": "rdf:nil" } }, obj)
def test_inverse(self): g = Graph() g.add((URIRef("http://*****:*****@context": self.ctxt({ "prop": "http://www.example.com/prop", "backLink": { "@id": "http://www.example.com/backLink", "@type": "@id" } }), "@id": "foo", "prop": "foo", "@reverse": { "backLink": {"@id": "http://www.example.com/bar"} } }, obj)
def test_others(self): g = Graph() g.add((URIRef("http://*****:*****@context": self.ctxt({ "prop": "http://www.example.com/prop" }), "@graph": [ { "@id": "foo", "prop": { "@value": "foo", "@language": "en" } }, { "@id": "foo_typo", "prop": { "@value": "bar", "@language": "en" } } ] }, obj)
def test_drb(self): g = Graph() b = BNode("bar") g.add((URIRef("http://*****:*****@context": self.ctxt({ "prop1": { "@id": "http://www.example.com/prop1", "@type": "@id" }, "prop2": { "@id": "http://www.example.com/prop2", "@type": "@id" } }), "@id": "foo", "prop1": "_:bar", "prop2": "_:bar" }, obj)
def test_int(self): g = Graph() g.add((URIRef("http://*****:*****@context": self.ctxt({"prop": "http://www.example.com/prop"}), "@id": "foo", "prop": 3}, obj)
def test_type(self): g = Graph() g.add((URIRef("http://*****:*****@context": self.ctxt({"rdf": str(RDF)}), "@id": "foo", "@type": "http://www.example.com/Bar"}, obj)
def test_simple(self): g = Graph() g.add((URIRef("http://*****:*****@context": self.ctxt({ "bar": "http://www.example.com/bar" }), "@id": "foo", "bar": { "@value": "foo", "@language": "en" } }, obj)
def test_multi(self): g = Graph() g.add((URIRef("http://*****:*****@context": self.ctxt({ "mp": "http://www.example.com/mp", "dp": "http://www.example.com/dp", "op": { "@id": "http://www.example.com/op", "@type": "@id" } }), "@id": "foo", "mp": [ {"@id": "http://www.example.com/bar"}, {"@value": "foo", "@language": "en"} ], "op": ["foo#baz", "http://www.example.com/bar"], "dp": [ {"@value": "bar", "@type": "http://www.example.com/type"}, "baz" ] }, obj)