def cctsdoc(self, e, name): '''Return the CCTS documentation named name from the element e.''' doc = e.find(XSD.xml("annotation") + "/" + XSD.xml("documentation") + "//" + CCTS.xml(name)) if doc is None: return None return doc.text
def convert_basic(self, g): '''Convert basic components.''' root = self.openxsd("common", "UBL-CommonBasicComponents-2.1.xsd") for e in root.findall(XSD.xml('element')): t = root.find(XSD.xml("complexType") + "[@name='" + e.attrib['type'] + "']") datatype = t.find(XSD.xml("simpleContent") + "/" + XSD.xml("extension")).attrib['base'] uri = self.attriburi("cbc:" + e.attrib['name']) g.add((uri, RDF.type, MDR.Property)) g.add((uri, MDR.context, URIRef(self.ns))) g.add((uri, DCTERMS.rights, RIGHTS)) g.add((uri, DCTERMS.rightsHolder, RIGHTS_HOLDER)) g.add((uri, ADMS.representationTechnique, XMLSchema)) g.add((uri, MDR.hasXMLNamespace, URIRef(CBC))) g.add((uri, MDR.hasXMLLocalPart, Literal(e.attrib['name']))) g.add((uri, MDR.representation, self.attriburi(datatype)))
def convert_maindocs(self, g): '''Convert documents (extract property information).''' for filename in self.listdir("maindoc"): root = self.openxsd("maindoc", filename) for e in root.findall(XSD.xml('complexType') + "/" + XSD.xml('sequence') + "/" + XSD.xml('element')): if e.attrib['ref'].startswith("ext:"): continue propuri = self.attriburi(e.attrib['ref']) g.add((propuri, MDR.propertyTerm, Literal(self.cctsdoc(e, "PropertyTerm")))) propqualifier = self.cctsdoc(e, "PropertyTermQualifier") if propqualifier: g.add((propuri, MDR.propertyTermQualifier, Literal(propqualifier))) dtqualifier = self.cctsdoc(e, "DataTypeQualifier") if dtqualifier: g.add((propuri, MDR.representationQualifier, Literal(dtqualifier)))
def convert_datatypes(self, g): '''Convert data types.''' root = self.openxsd("common", "UBL-UnqualifiedDataTypes-2.1.xsd") for e in root.findall(XSD.xml('complexType')): uri = self.attriburi("udt:" + e.attrib['name']) g.add((uri, RDF.type, MDR.DataType)) g.add((uri, MDR.context, URIRef(self.ns))) g.add((uri, DCTERMS.rights, RIGHTS)) g.add((uri, DCTERMS.rightsHolder, RIGHTS_HOLDER)) g.add((uri, SKOS.definition, self.text(self.cctsdoc(e, "Definition")))) g.add((uri, MDR.representationTerm, Literal(self.cctsdoc(e, "RepresentationTermName")))) g.add((uri, ADMS.representationTechnique, XMLSchema)) g.add((uri, MDR.hasXMLNamespace, URIRef(UDT))) g.add((uri, MDR.hasXMLLocalPart, Literal(e.attrib['name'])))
def read_sdf_item(self, parsing_results): """ :param parsing_results: sth like (Pdb) parsing_results (['DSSTox_RID', '22308'], {}) """ # for now just assuming the data header (e.g. DSSTox_RID) is URI-safe header = parsing_results[0] value = ' '.join(parsing_results[1:]) # if header == 'ActivityOutcome_NCTRER': # print('%s\t%s' % (value, str(self._curr_res))) # if header.startswith('Activity'): # return contains_dot = '.' in value is_negative = value.strip().startswith('-') if is_negative: tmp = value.strip()[1:] else: tmp = value.strip() is_num = tmp.replace('.', '').isnumeric() if is_num and contains_dot: dtype = self.xsd_double elif is_num and not is_negative: dtype = self.xsd_nnint elif is_num and is_negative: dtype = self.xsd_int else: dtype = XSD.term('string') prop = self._register_and_build_property(header, dtype) if self._props_data.get(prop) is None: self._props_data[prop] = [] self._props_data[prop].append((self._curr_res, value))
def get_jsonld_context() -> List[dict]: """ Get JSON-LD context for the whole namespace. Ignores namespaces in _internal. English language only. Returns: List[dict]. Example below. ``` context = [ {"@foaf": "http://xmlns.com/foaf/0.1/", "@language": "en"}, {"@sdo": "https://schema.org/", "@language": "en"}, {"@owl": "http://www.w3.org/2002/07/owl#", "@language": "en"}, {"@xsd": "http://www.w3.org/2001/XMLSchema#", "@language": "en"}, {"@wd": "http://www.wikidata.org/entity/", "@language": "en"}, {"@wdt": "http://www.wikidata.org/prop/direct/", "@language": "en"}, {"@prov": "http://www.w3.org/ns/prov#", "@language": "en"}, {"@rdfs": "http://www.w3.org/2000/01/rdf-schema#", "@language": "en"}, {"@skos": "http://www.w3.org/2004/02/skos/core#", "@language": "en"}, ] ``` """ context = [ { "@xsd": XSD.__str__(), "@language": "en" }, { "@foaf": FOAF.__str__(), "@language": "en" }, { "@owl": OWL.__str__(), "@language": "en" }, { "@rdf": RDF.__str__(), "@language": "en" }, { "@rdfs": RDFS.__str__(), "@language": "en" }, { "@prov": PROV.__str__(), "@language": "en" }, { "@sdo": SDO.__str__(), "@language": "en" }, { "@skos": SKOS.__str__(), "@language": "en" }, { "@wd": WD.__str__(), "@language": "en" }, { "@wdt": WDT.__str__(), "@language": "en" }, { "@hc": HC.__str__(), "@language": "en" }, ] return context
# -*- coding: utf-8 -*- """ https://www.w3.org/TR/shacl/#core-components-value-type """ import rdflib from datetime import date, time, datetime from rdflib.term import Literal from rdflib.namespace import RDF, XSD from pyshacl.constraints.constraint_component import ConstraintComponent from pyshacl.consts import SH, RDFS_subClassOf, RDF_type,\ SH_IRI, SH_BlankNode, SH_Literal, SH_IRIOrLiteral, SH_BlankNodeOrIRI,\ SH_BlankNodeORLiteral from pyshacl.errors import ConstraintLoadError RDF_langString = RDF.term('langString') XSD_string = XSD.term('string') XSD_integer = XSD.term('integer') XSD_float = XSD.term('float') XSD_boolean = XSD.term('boolean') XSD_date = XSD.term('date') XSD_time = XSD.term('time') XSD_dateTime = XSD.term('dateTime') SH_class = SH.term('class') SH_datatype = SH.term('datatype') SH_nodeKind = SH.term('nodeKind') SH_ClassConstraintComponent = SH.term('ClassConstraintComponent') SH_DatatypeConstraintComponent = SH.term('DatatypeConstraintComponent') SH_NodeKindConstraintComponent = SH.term('NodeKindConstraintComponent')
""" https://www.w3.org/TR/shacl/#core-components-count """ from typing import Dict, List from rdflib.namespace import XSD from rdflib.term import Literal from pyshacl.constraints.constraint_component import ConstraintComponent from pyshacl.consts import SH from pyshacl.errors import ConstraintLoadError from pyshacl.pytypes import GraphLike from pyshacl.rdfutil import stringify_node XSD_integer = XSD.term('integer') SH_minCount = SH.term('minCount') SH_maxCount = SH.term('maxCount') SH_MinCountConstraintComponent = SH.term('MinCountConstraintComponent') SH_MaxCountConstraintComponent = SH.term('MaxCountConstraintComponent') class MinCountConstraintComponent(ConstraintComponent): """ sh:minCount specifies the minimum number of value nodes that satisfy the condition. If the minimum cardinality value is 0 then this constraint is always satisfied and so may be omitted. Link: https://www.w3.org/TR/shacl/#MinCountConstraintComponent Textual Definition: If the number of value nodes is less than $minCount, there is a validation result. """
def convert_aggregate(self, g): '''Convert aggregate components.''' root = self.openxsd("common", "UBL-CommonAggregateComponents-2.1.xsd") for e in root.findall(XSD.xml('element')): uri = self.attriburi("cac:" + e.attrib['name']) g.add((uri, RDF.type, MDR.Property)) g.add((uri, MDR.context, URIRef(self.ns))) g.add((uri, DCTERMS.rights, RIGHTS)) g.add((uri, DCTERMS.rightsHolder, RIGHTS_HOLDER)) g.add((uri, ADMS.representationTechnique, XMLSchema)) g.add((uri, MDR.hasXMLNamespace, URIRef(CAC))) g.add((uri, MDR.hasXMLLocalPart, Literal(e.attrib['name']))) g.add((uri, MDR.representation, self.attriburi("cac:" + e.attrib['type']))) # Property terms are defined below and in convert_maindocs for cls in root.findall(XSD.xml('complexType')): clsuri = self.attriburi("cac:" + cls.attrib['name']) clsubl = re.sub(r"Type$", r"", cls.attrib['name']) clsname = self.cctsdoc(cls, "ObjectClass") # Object class g.add((clsuri, RDF.type, MDR.ObjectClass)) g.add((clsuri, MDR.context, URIRef(self.ns))) g.add((clsuri, DCTERMS.rights, RIGHTS)) g.add((clsuri, DCTERMS.rightsHolder, RIGHTS_HOLDER)) g.add((clsuri, ADMS.representationTechnique, XMLSchema)) g.add((clsuri, MDR.hasXMLNamespace, URIRef(CAC))) g.add((clsuri, MDR.hasXMLLocalPart, Literal(cls.attrib['name']))) g.add((clsuri, RDFS.label, self.text(clsname))) g.add((clsuri, MDR.objectClassName, Literal(clsname))) g.add((clsuri, SKOS.definition, self.text(self.cctsdoc(cls, "Definition")))) for i, e in enumerate(cls.findall(XSD.xml('sequence') + "/" + XSD.xml('element'))): propuri = self.attriburi(e.attrib['ref']) propubl = re.sub(r"^[^:]*:", r"", e.attrib['ref']) uri = self.uri("element", clsubl + propubl) # Data Element g.add((uri, RDF.type, MDR.DataElement)) g.add((uri, MDR.context, URIRef(self.ns))) g.add((uri, DCTERMS.rights, RIGHTS)) g.add((uri, DCTERMS.rightsHolder, RIGHTS_HOLDER)) g.add((uri, ADMS.representationTechnique, XMLSchema)) g.add((uri, MDR.objectClass, clsuri)) g.add((uri, MDR.property, propuri)) g.add((uri, SKOS.definition, self.text(self.cctsdoc(e, "Definition")))) g.add((uri, MDR.order, self.integer(i + 1))) example = self.cctsdoc(e, "Examples") if example: g.add((uri, MDR.example, Literal(example))) cardmin = int(e.attrib['minOccurs']) if cardmin != 0: g.add((uri, MDR.minCardinality, self.nonneg(cardmin))) cardmax = e.attrib['maxOccurs'] if cardmax != "unbounded": g.add((uri, MDR.maxCardinality, self.nonneg(int(cardmax)))) # Property g.add((propuri, MDR.propertyTerm, Literal(self.cctsdoc(e, "PropertyTerm")))) propqualifier = self.cctsdoc(e, "PropertyTermQualifier") if propqualifier: g.add((propuri, MDR.propertyTermQualifier, Literal(propqualifier))) dtqualifier = self.cctsdoc(e, "DataTypeQualifier") if dtqualifier: g.add((propuri, MDR.representationQualifier, Literal(dtqualifier)))
# -*- coding: utf-8 -*- from rdflib import Literal from rdflib.namespace import XSD from pyshacl.rdfutil import clone_graph from pyshacl.shape import Shape from pyshacl.errors import RuleLoadError, ReportableRuntimeError from pyshacl.consts import SH_construct from pyshacl.sparql_query_helper import SPARQLQueryHelper from pyshacl.rules.shacl_rule import SHACLRule XSD_string = XSD.term('string') class SPARQLRule(SHACLRule): __slots__ = ("_constructs", "_qh") def __init__(self, shape, rule_node): """ :param shape: :type shape: Shape :param rule_node: :type rule_node: rdflib.Identifier """ super(SPARQLRule, self).__init__(shape, rule_node) construct_nodes = set(self.shape.sg.objects(self.node, SH_construct)) if len(construct_nodes) < 1: raise RuleLoadError("No sh:construct on SPARQLRule", "https://www.w3.org/TR/shacl-af/#SPARQLRule") self._constructs = []
def _init_ontology(self): # ---------------------- basic vocabulary elements -------------------- self.xsd_nnint = XSD.term('nonNegativeInteger') self.xsd_int = XSD.term('integer') self.xsd_bool = XSD.term('boolean') self.xsd_double = XSD.term('double') a = RDF.term('type') rdfs_dom = RDFS.term('domain') rdfs_rnge = RDFS.term('range') rdfs_subcls_of = RDFS.term('subClassOf') owl_class = OWL.term('Class') owl_dtype_prop = OWL.term('DatatypeProperty') owl_obj_prop = OWL.term('ObjectProperty') # --------------------------- basic classes --------------------------- # dllont:Molecule self.cls_molecule = URIRef(self._ont_uri_prefix + 'Molecule') self._g.add((self.cls_molecule, a, owl_class)) # dllont:Atom self.cls_atom = URIRef(self._ont_uri_prefix + 'Atom') self._g.add((self.cls_atom, a, owl_class)) # dllont:AtomSymbol self.cls_atom_symbol = URIRef(self._ont_uri_prefix + 'AtomSymbol') self._g.add((self.cls_atom_symbol, a, owl_class)) # ----------------- atom stereo parity class hierarchy ---------------- # dllont:AtomParity cls_atom_parity = URIRef(self._ont_uri_prefix + 'AtomParity') self._g.add((cls_atom_parity, a, owl_class)) # dllont:AtomParityNotStereo, dllont:AtomParityOdd, # dllont:AtomParityEven, dllont:AtomParityEitherOrUnmarkedStereoCenter for val in atom_stereo_parity_mapping.values(): cls = self._get_cls_uri( self._atom_stereo_parity_type_to_cls_local_part, val) self._g.add((cls, a, owl_class)) self._g.add((cls, rdfs_subcls_of, cls_atom_parity)) # ----------------- hydrogen count resources and class ---------------- # dllont:HydrogenCount self.cls_hydrogen_count = \ URIRef(self._ont_uri_prefix + 'HydrogenCount') self._g.add((self.cls_hydrogen_count, a, owl_class)) for val in hydrogen_count_mapping.values(): if val is not None: hc_res = URIRef(self._resource_uri_prefix + val.lower()) self._g.add((hc_res, a, self.cls_hydrogen_count)) # ------------------------ bond class hierarchy ----------------------- # dllont:Bond self.cls_bond = URIRef(self._ont_uri_prefix + 'Bond') self._g.add((self.cls_bond, a, owl_class)) # dllont:SingleBond, dllont:DoubleBond, dllont:TripleBond, # dllont:AromaticBond, dllont:SingleOrDoubleBond, # dllont:SingleOrAromaticBond, dllont:DoubleOrAromaticBond for val in bond_type_mapping.values(): bond_cls = self._get_bond_cls_uri(val) self._g.add((bond_cls, a, owl_class)) for sdf_type in self._bond_type_to_cls_local_part[val][1]: super_cls = self._get_bond_cls_uri(sdf_type) self._g.add((bond_cls, rdfs_subcls_of, super_cls)) # ------------------- bond isomerism class hierarchy ------------------ # dllont:NonStereoBond non_st_bond_cls = self._get_cls_uri( self._bond_stereo_to_cls_local_part, 'Not stereo') self._g.add((non_st_bond_cls, a, owl_class)) self._g.add((non_st_bond_cls, rdfs_subcls_of, self.cls_bond)) # dllont:SingleBondEitherUpOrDownStereochemistry either_up_or_down_cls = self._get_cls_uri( self._bond_stereo_to_cls_local_part, 'Either') self._g.add((either_up_or_down_cls, a, owl_class)) self._g.add(( either_up_or_down_cls, rdfs_subcls_of, self._get_bond_cls_uri('Single') )) # dllont:SingleBondUpStereochemistry up_stereo_cls = self._get_cls_uri( self._bond_stereo_to_cls_local_part, 'Up') self._g.add((up_stereo_cls, a, owl_class)) self._g.add((up_stereo_cls, rdfs_subcls_of, either_up_or_down_cls)) # dllont:SingleBondDownStereochemistry down_stereo_cls = self._get_cls_uri( self._bond_stereo_to_cls_local_part, 'Down') self._g.add((down_stereo_cls, a, owl_class)) self._g.add((down_stereo_cls, rdfs_subcls_of, either_up_or_down_cls)) cls_double_bond = self._get_bond_cls_uri('Double') # dllont:DoubleBondDeriveCisOrTransIsomerismFromXYZCoords derive_iso_cls = self._get_cls_uri( self._bond_stereo_to_cls_local_part, 'Use x-, y-, z-coords from atom block to determine cis or trans') self._g.add((derive_iso_cls, a, owl_class)) self._g.add((derive_iso_cls, rdfs_subcls_of, cls_double_bond)) # dllont:DoubleBondEitherCisOrTransIsomerism cis_or_trans_cls = self._get_cls_uri( self._bond_stereo_to_cls_local_part, 'Either cis or trans double bond') self._g.add((cis_or_trans_cls, a, owl_class)) self._g.add((cis_or_trans_cls, rdfs_subcls_of, cls_double_bond)) # -------------------------- topology classes ------------------------- # dllont:BondTopology topology_cls = URIRef(self._ont_uri_prefix + 'BondTopology') self._g.add((topology_cls, a, owl_class)) # dllont:EitherRingOrChainTopology either_topo_cls = self._get_cls_uri( self._bond_topology_to_cls_local_part, 'Either') self._g.add((either_topo_cls, a, owl_class)) self._g.add((either_topo_cls, rdfs_subcls_of, topology_cls)) # dllont:RingTopology ring_topo_cls = self._get_cls_uri( self._bond_topology_to_cls_local_part, 'Ring') self._g.add((ring_topo_cls, a, owl_class)) self._g.add((ring_topo_cls, rdfs_subcls_of, either_topo_cls)) # dllont:ChainTopology chain_topo_cls = self._get_cls_uri( self._bond_topology_to_cls_local_part, 'Chain') self._g.add((chain_topo_cls, a, owl_class)) self._g.add((chain_topo_cls, rdfs_subcls_of, either_topo_cls)) # --------------- reacting center status class hierarchy -------------- # dllont:ReactingCenterStatus react_center_status_cls = URIRef( self._ont_uri_prefix + 'ReactingCenterStatus') self._g.add((react_center_status_cls, a, owl_class)) # dllont:Unmarked react_unmarked_cls = self._get_cls_uri( self._reacting_center_status_to_cls_local_part, 'unmarked') self._g.add((react_unmarked_cls, a, owl_class)) self._g.add( (react_unmarked_cls, rdfs_subcls_of, react_center_status_cls)) # dllont:ACenter react_a_center_cls = self._get_cls_uri( self._reacting_center_status_to_cls_local_part, 'a center') self._g.add((react_a_center_cls, a, owl_class)) self._g.add( (react_a_center_cls, rdfs_subcls_of, react_center_status_cls)) # dllont:NotACenter react_not_a_center_cls = self._get_cls_uri( self._reacting_center_status_to_cls_local_part, 'not a center') self._g.add((react_not_a_center_cls, a, owl_class)) self._g.add( (react_not_a_center_cls, rdfs_subcls_of, react_center_status_cls)) self._g.add(( react_a_center_cls, OWL.term('disjointWith'), react_not_a_center_cls )) # dllont:NoChange react_no_change_cls = self._get_cls_uri( self._reacting_center_status_to_cls_local_part, 'no change') self._g.add((react_no_change_cls, a, owl_class)) self._g.add( (react_no_change_cls, rdfs_subcls_of, react_center_status_cls)) # FIXME: add class intersections # dllont:BondMadeOrBroken react_bond_made_or_broken_cls = self._get_cls_uri( self._reacting_center_status_to_cls_local_part, 'bond made/broken') self._g.add((react_bond_made_or_broken_cls, a, owl_class)) self._g.add(( react_bond_made_or_broken_cls, rdfs_subcls_of, react_center_status_cls )) # dllont:BondOrderChanges react_bond_order_change_cls = self._get_cls_uri( self._reacting_center_status_to_cls_local_part, 'bond order changes') self._g.add((react_bond_order_change_cls, a, owl_class)) self._g.add(( react_bond_order_change_cls, rdfs_subcls_of, react_center_status_cls )) # dllont:BondMadeOrBrokenAndBondOrderChanges react_bmob_and_boc_cls = self._get_cls_uri( self._reacting_center_status_to_cls_local_part, 'bond made/broken + bond order changes') self._g.add((react_bmob_and_boc_cls, a, owl_class)) self._g.add(( react_bmob_and_boc_cls, rdfs_subcls_of, react_bond_made_or_broken_cls )) self._g.add(( react_bmob_and_boc_cls, rdfs_subcls_of, react_bond_order_change_cls )) # dllont:BondMadeOrBrokenAndACenter react_bmob_and_a_center_cls = self._get_cls_uri( self._reacting_center_status_to_cls_local_part, 'bond made/broken + a center') self._g.add((react_bmob_and_a_center_cls, a, owl_class)) self._g.add(( react_bmob_and_a_center_cls, rdfs_subcls_of, react_bond_made_or_broken_cls )) self._g.add(( react_bmob_and_a_center_cls, rdfs_subcls_of, react_a_center_cls )) # dllont:BondMadeOrBrokenAndBondOrderChangesAndACenter react_bmob_and_boc_and_a_center_cls = self._get_cls_uri( self._reacting_center_status_to_cls_local_part, 'bond made/broken + bond order changes + a center') self._g.add((react_bmob_and_boc_and_a_center_cls, a, owl_class)) self._g.add(( react_bmob_and_boc_and_a_center_cls, rdfs_subcls_of, react_bmob_and_boc_cls )) self._g.add(( react_bmob_and_boc_and_a_center_cls, rdfs_subcls_of, react_bmob_and_a_center_cls )) self._g.add(( react_bmob_and_boc_and_a_center_cls, rdfs_subcls_of, react_a_center_cls )) # ------------------------ property definitions ----------------------- # dllont:number_of_atoms self.prop_num_atoms = \ URIRef(self._ont_uri_prefix + 'number_of_atoms') self._g.add((self.prop_num_atoms, a, owl_dtype_prop)) self._g.add((self.prop_num_atoms, rdfs_dom, self.cls_molecule)) self._g.add((self.prop_num_atoms, rdfs_rnge, self.xsd_nnint)) # dllont:number_of_bounds self.prop_num_bounds = \ URIRef(self._ont_uri_prefix + 'number_of_bounds') self._g.add((self.prop_num_bounds, a, owl_dtype_prop)) self._g.add((self.prop_num_bounds, rdfs_dom, self.cls_molecule)) self._g.add((self.prop_num_bounds, rdfs_rnge, self.xsd_nnint)) # dllont:number_of_atom_lists self.prop_num_atom_lists = URIRef( self._ont_uri_prefix + 'number_of_atom_lists') self._g.add((self.prop_num_atom_lists, a, owl_dtype_prop)) self._g.add((self.prop_num_atom_lists, rdfs_dom, self.cls_molecule)) self._g.add((self.prop_num_atom_lists, rdfs_rnge, self.xsd_nnint)) # dllont:molecule_is_chiral self.prop_molec_is_chiral = URIRef( self._ont_uri_prefix + 'molecule_is_chiral') self._g.add((self.prop_molec_is_chiral, a, owl_dtype_prop)) self._g.add((self.prop_molec_is_chiral, rdfs_dom, self.cls_molecule)) self._g.add((self.prop_molec_is_chiral, rdfs_rnge, self.xsd_bool)) # dllont:atom self.prop_atom = URIRef(self._ont_uri_prefix + 'atom') self._g.add((self.prop_atom, a, owl_obj_prop)) self._g.add((self.prop_atom, rdfs_dom, self.cls_molecule)) self._g.add((self.prop_atom, rdfs_rnge, self.cls_atom)) # dllont:atom_number self.prop_atom_number = URIRef(self._ont_uri_prefix + 'atom_number') self._g.add((self.prop_atom_number, a, owl_dtype_prop)) self._g.add((self.prop_atom_number, rdfs_dom, self.cls_atom)) self._g.add((self.prop_atom_number, rdfs_rnge, self.xsd_nnint)) # dllont:atom_coordinate_x self.prop_coord_x = URIRef(self._ont_uri_prefix + 'atom_coordinate_x') self._g.add((self.prop_coord_x, a, owl_dtype_prop)) self._g.add((self.prop_coord_x, rdfs_dom, self.cls_atom)) self._g.add((self.prop_coord_x, rdfs_rnge, self.xsd_double)) # dllont:atom_coordinate_y self.prop_coord_y = URIRef(self._ont_uri_prefix + 'atom_coordinate_y') self._g.add((self.prop_coord_y, a, owl_dtype_prop)) self._g.add((self.prop_coord_y, rdfs_dom, self.cls_atom)) self._g.add((self.prop_coord_y, rdfs_rnge, self.xsd_double)) # dllont:atom_coordinate_z self.prop_coord_z = URIRef(self._ont_uri_prefix + 'atom_coordinate_z') self._g.add((self.prop_coord_z, a, owl_dtype_prop)) self._g.add((self.prop_coord_z, rdfs_dom, self.cls_atom)) self._g.add((self.prop_coord_z, rdfs_rnge, self.xsd_double)) # dllont:atom_symbol self.prop_atom_symbol = URIRef(self._ont_uri_prefix + 'atom_symbol') self._g.add((self.prop_atom_symbol, a, owl_obj_prop)) self._g.add((self.prop_atom_symbol, rdfs_dom, self.cls_atom)) self._g.add((self.prop_atom_symbol, rdfs_rnge, self.cls_atom_symbol)) # dllont:mass_difference self.prop_mass_difference = URIRef( self._ont_uri_prefix + 'mass_difference') self._g.add((self.prop_mass_difference, a, owl_dtype_prop)) self._g.add((self.prop_mass_difference, rdfs_dom, self.cls_atom)) self._g.add((self.prop_mass_difference, rdfs_rnge, self.xsd_double)) # dllont:charge self.prop_charge = URIRef(self._ont_uri_prefix + 'charge') self._g.add((self.prop_charge, a, owl_dtype_prop)) self._g.add((self.prop_charge, rdfs_dom, self.cls_atom)) self._g.add((self.prop_charge, rdfs_rnge, self.xsd_int)) # dllont:hydrogen_count self.prop_hydrogen_count = URIRef( self._ont_uri_prefix + 'hydrogen_count') self._g.add((self.prop_hydrogen_count, a, owl_obj_prop)) self._g.add((self.prop_hydrogen_count, rdfs_dom, self.cls_atom)) self._g.add( (self.prop_hydrogen_count, rdfs_rnge, self.cls_hydrogen_count)) # dllont:valence self.prop_valence = URIRef(self._ont_uri_prefix + 'valence') self._g.add((self.prop_valence, a, owl_dtype_prop)) self._g.add((self.prop_valence, rdfs_dom, self.cls_atom)) self._g.add((self.prop_valence, rdfs_rnge, self.xsd_nnint)) # dllont:h_atoms_allowed self.prop_h_atoms_allowed = URIRef( self._ont_uri_prefix + 'h_atoms_allowed') self._g.add((self.prop_h_atoms_allowed, a, owl_dtype_prop)) self._g.add((self.prop_h_atoms_allowed, rdfs_dom, self.cls_atom)) self._g.add((self.prop_h_atoms_allowed, rdfs_rnge, self.xsd_bool)) # dllont:atom-atom_mapping_number self.prop_atom_atom_mapping_nr = URIRef( self._ont_uri_prefix + 'atom-atom_mapping_number') self._g.add((self.prop_atom_atom_mapping_nr, a, owl_dtype_prop)) self._g.add((self.prop_atom_atom_mapping_nr, rdfs_dom, self.cls_atom)) self._g.add( (self.prop_atom_atom_mapping_nr, rdfs_rnge, self.xsd_nnint)) # dllont:has_binding_with self.prop_has_binding_with = URIRef( self._ont_uri_prefix + 'has_binding_with') self._g.add(( self.prop_has_binding_with, a, URIRef(OWL.term('SymmetricProperty')) )) self._g.add((self.prop_has_binding_with, rdfs_dom, self.cls_atom)) self._g.add((self.prop_has_binding_with, rdfs_rnge, self.cls_atom)) # dllont:first_bound_atom self.prop_first_bound_atom = URIRef( self._ont_uri_prefix + 'first_bound_atom') self._g.add((self.prop_first_bound_atom, a, owl_obj_prop)) self._g.add((self.prop_first_bound_atom, rdfs_dom, self.cls_bond)) self._g.add((self.prop_first_bound_atom, rdfs_rnge, self.cls_atom)) # dllont:second_bound_atom self.prop_second_bound_atom = URIRef( self._ont_uri_prefix + 'second_bound_atom') self._g.add((self.prop_second_bound_atom, a, owl_obj_prop)) self._g.add((self.prop_second_bound_atom, rdfs_dom, self.cls_bond)) self._g.add((self.prop_second_bound_atom, rdfs_rnge, self.cls_atom)) # dllont:has_topology self.prop_has_topology = URIRef(self._ont_uri_prefix + 'has_topology') self._g.add((self.prop_has_topology, a, owl_obj_prop)) self._g.add((self.prop_has_topology, rdfs_dom, self.cls_bond)) self._g.add((self.prop_has_topology, rdfs_rnge, topology_cls)) # dllont:has_reacting_center_status self.prop_has_rc_status = URIRef( self._ont_uri_prefix + 'has_reacting_center_status') self._g.add((self.prop_has_rc_status, a, owl_obj_prop)) self._g.add((self.prop_has_rc_status, rdfs_dom, self.cls_bond)) self._g.add( (self.prop_has_rc_status, rdfs_rnge, react_center_status_cls))