def setUp(self): self.rule = Rule({}, {(RDF.type, RDF.type, RDF.Property)}) self.rule_se1 = Rule({(uuu, aaa, xxx)}, {(uuu, aaa, xxx.nnn)}, name='se1') self.empty_graph = Graph() self.graph = Graph({(EX.a, EX.property, EX.b), (EX.b, EX.property, EX.c)}) self.context = Context()
if e <= entailed: return True for triple in e: if triple not in entailed: for entailed_triple in entailed: pattern = Pattern(entailed_triple) if pattern.matches(triple): break else: return False return True # Simple entailment rules # http://www.w3.org/TR/rdf-mt/#simpleRules se1 = Rule({(uuu, aaa, xxx)}, {(uuu, aaa, xxx.nnn)}, name='se1') se2 = Rule({(uuu, aaa, xxx)}, {(uuu, aaa, uuu.nnn)}, name='se2') SIMPLE_ENTAILMENT = Entailment([se1, se2]) # Literal generalization rule lg = Rule({(uuu, aaa, lll)}, {(uuu, aaa, lll.nnn)}, name='lg') SIMPLE_ENTAILMENT_LG = Entailment([lg]) # RDF entailment rules # http://www.w3.org/TR/rdf-mt/#RDFRules rdf1 = Rule({(uuu, aaa, yyy)}, {(aaa, RDF.type, RDF.Property)}, name='rdf1') rdf2 = Rule({(uuu, aaa, llx)}, {(llx.nnn, RDF.type, RDF.XMLLiteral)}, name='rdf2')