def to_rdf(self, g: Graph, emit_type_arc: bool = False) -> BNode: # _:x rdf:type owl:Class . # _:x owl:unionOf T(SEQ CE1 ... CEn) . x = BNode() g.add((x, RDF.type, OWL.Class)) g.add((x, OWL.unionOf, SEQ(g, self.classExpressions))) return x
def to_rdf(self, g: Graph, emit_type_arc: bool = False) -> BNode: # _:x rdf:type rdfs:Datatype . # _:x owl:oneOf T(SEQ lt1 ... ltn) . x = BNode() g.add((x, RDF.type, RDFS.Datatype)) g.add((x, OWL.oneOf, SEQ(g, self.literal))) return x
def to_rdf(self, g: Graph, emit_type_arc: bool = False) -> BNode: # _:x rdf:type owl:Class . # _:x owl:oneOf T(SEQ a1 ... an) . x = BNode() g.add((x, RDF.type, OWL.Class)) g.add((x, OWL.oneOf, SEQ(g, self.individuals))) return x
def to_rdf(self, g: Graph, emit_type_arc: bool = False) -> BNode: # _:x rdf:type owl:Class . # _:x owl:intersectionOf T(SEQ CE1 ... CEn) . subj = BNode() g.add((subj, RDF.type, OWL.Class)) g.add((subj, OWL.intersectionOf, SEQ(g, self.classExpressions))) return subj
def to_rdf(self, g: Graph) -> BNode: """ _:x rdf:type owl:Class . _:x owl:unionOf T(SEQ CE1 ... CEn) . """ rval = BNode() g.add((rval, RDF.type, OWL.Class)) g.add((rval, OWL.unionOf, SEQ(g, self.classExpressions))) return rval
def to_rdf(self, g: Graph) -> None: if len(self.individuals) == 2: self.add_triple(g, self.individuals[0].to_rdf(g), OWL.differentFrom, self.individuals[1].to_rdf(g)) elif len(self.individuals) > 2: subj = BNode() g.add((subj, RDF.type, OWL.AllDifferent)) g.add((subj, OWL.memebers, SEQ(g, self.individuals))) self.TANN(g, subj) return None
def to_rdf(self, g: Graph, emit_type_arc: bool = False) -> None: if len(self.classExpressions) == 2: self.add_triple(g, self.classExpressions[0].to_rdf(g), OWL.disjointWith, self.classExpressions[1].to_rdf(g)) else: subj = BNode() g.add((subj, RDF.type, OWL.AllDisjointClasses)) g.add((subj, OWL.members, SEQ(g, self.classExpressions))) self.TANN(g, subj)
def to_rdf(self, g: Graph) -> BNode: """ _:x rdf:type owl:Class . _:x owl:oneOf T(SEQ a1 ... an) . :param g: :return: """ rval = BNode() g.add((rval, RDF.type, OWL.Class)) g.add((rval, OWL.oneOf, SEQ(g, self.individuals))) return rval
def to_rdf(self, g: Graph) -> BNode: subj = BNode() if self.dataPropertyExpression >= 2: g.add((subj, RDF.type, OWL.Restriction)) g.add((subj, OWL.onProperties, SEQ(g, self.dataPropertyExpression))) g.add((subj, OWL.allValuesFrom, self.dataRange.to_rdf(g))) else: g.add((subj, RDF.type, OWL.Restriction)) g.add((subj, OWL.onProperties, self.dataPropertyExpression)) g.add((subj, OWL.allValuesFrom, self.dataRange.to_rdf(g)))
def to_rdf(self, g: Graph, emit_type_arc: bool = False) -> BNode: # _:x rdf:type rdfs:Datatype . # _:x owl:onDatatype T(DT) . # _:x owl:withRestrictions T(SEQ _:y1 ... _:yn) . # _:y1 F1 lt1 . # ... # _:yn Fn ltn . x = BNode() g.add((x, RDF.type, RDFS.Datatype)) g.add((x, OWL.onDatatype, self.datatype.to_rdf(g))) g.add((x, OWL.withRestrictions, SEQ(g, self.restrictions))) return x
def to_rdf(self, g: Graph, emit_type_arc: bool = False) -> None: # T(OPE1) owl:propertyDisjointWith T(OPE2) . # N > 2: # _:x rdf:type owl:AllDisjointProperties . # _:x owl:members T(SEQ OPE1 ... OPEn) . if len(self.objectPropertyExpressions) > 2: x = BNode() g.add((x, RDF.type, OWL.AllDisjointProperties)) self.add_triple(g, x, OWL.members, SEQ(g, self.objectPropertyExpressions)) else: self.add_triple(g, self.objectPropertyExpressions[0].to_rdf(g), OWL.propertyDisjointWith, self.objectPropertyExpressions[1].to_rdf(g))
def to_rdf(self, g: Graph, emit_type_arc: bool = False) -> None: # N == 2 # T(a1) owl:differentFrom T(a2) . # N > 2 # _:x rdf:type owl:AllDifferent . # _:x owl:members T(SEQ a1 ... an) . # TODO: Spec says members, tooling says "distinctMembers" -- error in spec? if len(self.individuals) == 2: self.add_triple(g, self.individuals[0].to_rdf(g), OWL.differentFrom, self.individuals[1].to_rdf(g)) elif len(self.individuals) > 2: subj = BNode() g.add((subj, RDF.type, OWL.AllDifferent)) g.add((subj, OWL.distinctMembers, SEQ(g, self.individuals))) self.TANN(g, subj) return None
def to_rdf(self, g: Graph, emit_type_arc: bool = False) -> BNode: # N == 1 # _:x rdf:type owl:Restriction . # _:x owl:onProperty T(DPE) . # _:x owl:allValuesFrom T(DR) . # N >= 2 # _:x rdf:type owl:Restriction . # _:x owl:onProperties T(SEQ DPE1 ... DPEn) . # _:x owl:allValuesFrom T(DR) . subj = BNode() g.add((subj, RDF.type, OWL.Restriction)) if len(self.dataPropertyExpressions) >= 2: g.add((subj, OWL.onProperties, SEQ(g, self.dataPropertyExpressions))) else: g.add((subj, OWL.onProperty, self.dataPropertyExpressions[0].to_rdf(g))) g.add((subj, OWL.allValuesFrom, self.dataRange.to_rdf(g))) return subj
def to_rdf(self, g: Graph, emit_type_arc: bool = False) -> None: # T(CE) owl:hasKey T(SEQ OPE1 ... OPEm DPE1 ... DPEn ) . self.add_triple( g, self.classExpression.to_rdf(g), OWL.hasKey, SEQ(g, self.objectPropertyExpressions + self.dataPropertyExpressions))
def to_rdf(self, g: Graph, emit_type_arc: bool = False) -> None: # T(C) owl:disjointUnionOf T(SEQ CE1 ... CEn) . self.add_triple(g, self.cls.to_rdf(g), OWL.disjointUnionOf, SEQ(g, self.disjointClassExpressions))
def to_rdf(self, g: Graph, emit_type_arc: bool = False) -> BNode: return SEQ(g, self.objectPropertyExpressions)
def to_rdf(self, g: Graph) -> BNode: return SEQ(g, self.objectPropertyExpressions)
def to_rdf(self, g: Graph) -> BNode: subj = BNode() g.add((subj, RDF.type, OWL.Class)) g.add((subj, OWL.intersectionOf, SEQ(g, self.classExpressions))) return subj