def finalize_sdf_items(self):
        # ontological axioms
        for prop, dtype in self._props.items():
            self._g.add((prop, RDF.term('type'), OWL.term('DatatypeProperty')))
            self._g.add((prop, RDFS.term('domain'), self.cls_molecule))
            self._g.add((prop, RDFS.term('range'), dtype))

        # the actual data
        for prop, data in self._props_data.items():
            dtype = self._props[prop]
            for subj, val in data:
                self._g.add((subj, prop, Literal(val, None, dtype)))
 def data_make_address(self, address):
     addressTermsMap = {
         "addr": RDFS.term("label"),
         "city": vcard.locality,
         "country": vcard.term("country-name"),
         "county": vcard.term("country-name"),
         "email": vcard.term("hasEmail"),
         "name": vcard.term("hasFN"),
         "postcode": vcard.term("postal-code"),
         "street": vcard.term("street-address"),
         "tel": vcard.term("hasTelephone"),
     }
     addressObject = BNode()
     # Address has either type Home or Work
     if address.has_key("addr") and address["addr"] is not None:
         self.g.add((addressObject, RDF.type, vcard.term("Work")))
     else:
         self.g.add((addressObject, RDF.type, vcard.term("Home")))
     # Add the address values
     for key, val in address.iteritems():
         if addressTermsMap.has_key(key):
             self.g.add((addressObject, addressTermsMap[key], Literal(val)))
     return (vcard.hasAddress, addressObject)
 def data_make_address(self, address):
     addressTermsMap = {
         "addr": RDFS.term("label"),
         "city": vcard.locality,
         "country": vcard.term("country-name"),
         "county": vcard.term("country-name"),
         "email": vcard.term("hasEmail"),
         "name": vcard.term("hasFN"),
         "postcode": vcard.term("postal-code"),
         "street": vcard.term("street-address"),
         "tel": vcard.term("hasTelephone")
     }
     addressObject = BNode()
     # Address has either type Home or Work
     if address.has_key('addr') and address['addr'] is not None:
         self.g.add((addressObject, RDF.type, vcard.term("Work")))
     else:
         self.g.add((addressObject, RDF.type, vcard.term("Home")))
     # Add the address values
     for key, val in address.iteritems():
         if addressTermsMap.has_key(key):
             self.g.add((addressObject, addressTermsMap[key], Literal(val)))
     return (vcard.hasAddress, addressObject)
Exemplo n.º 4
0
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
Exemplo n.º 5
0
class ClosedConstraintComponent(ConstraintComponent):
    """
    The RDF data model offers a huge amount of flexibility. Any node can in principle have values for any property. However, in some cases it makes sense to specify conditions on which properties can be applied to nodes. The SHACL Core language includes a property called sh:closed that can be used to specify the condition that each value node has values only for those properties that have been explicitly enumerated via the property shapes specified for the shape via sh:property.
    Link:
    https://www.w3.org/TR/shacl/#InConstraintComponent
    Textual Definition:
    If $closed is true then there is a validation result for each triple that has a value node as its subject and a predicate that is not explicitly enumerated as a value of sh:path in any of the property shapes declared via sh:property at the current shape. If $ignoredProperties has a value then the properties enumerated as members of this SHACL list are also permitted for the value node. The validation result MUST have the predicate of the triple as its sh:resultPath, and the object of the triple as its sh:value.
    """
    ALWAYS_IGNORE = {(RDF_type, RDFS.term('Resource'))}

    def __init__(self, shape):
        super(ClosedConstraintComponent, self).__init__(shape)
        sg = self.shape.sg.graph
        closed_vals = list(self.shape.objects(SH_closed))
        if len(closed_vals) < 1:
            raise ConstraintLoadError(
                "ClosedConstraintComponent must have at least one sh:closed predicate.",
                "https://www.w3.org/TR/shacl/#ClosedConstraintComponent")
        elif len(closed_vals) > 1:
            raise ConstraintLoadError(
                "ClosedConstraintComponent must have at most one sh:closed predicate.",
                "https://www.w3.org/TR/shacl/#ClosedConstraintComponent")
        assert isinstance(
            closed_vals[0],
            rdflib.Literal), "sh:closed must take a xsd:boolean literal."
        self.is_closed = bool(closed_vals[0].value)
        ignored_vals = list(self.shape.objects(SH_ignoredProperties))
        self.ignored_props = set()
        for i in ignored_vals:
            try:
                items = set(sg.items(i))
                for list_item in items:
                    self.ignored_props.add(list_item)
            except ValueError:
                continue
        self.property_shapes = list(self.shape.objects(SH_property))

    @classmethod
    def constraint_parameters(cls):
        return [SH_closed, SH_ignoredProperties]

    @classmethod
    def constraint_name(cls):
        return "ClosedConstraintComponent"

    @classmethod
    def shacl_constraint_class(cls):
        return SH_ClosedConstraintComponent

    def evaluate(self, target_graph, focus_value_nodes):
        """

        :type focus_value_nodes: dict
        :type target_graph: rdflib.Graph
        """
        reports = []
        non_conformant = False
        if not self.is_closed:
            return True, []

        working_shapes = set()
        for p_shape in self.property_shapes:
            property_shape = self.shape.get_other_shape(p_shape)
            if not property_shape or not property_shape.is_property_shape:
                raise ReportableRuntimeError(
                    "The shape pointed to by sh:property does "
                    "not exist, or is not a well defined SHACL PropertyShape.")
            working_shapes.add(property_shape)
        working_paths = set()
        for w in working_shapes:
            p = w.path()
            if p:
                working_paths.add(p)

        for f, value_nodes in focus_value_nodes.items():
            for v in value_nodes:
                pred_obs = target_graph.predicate_objects(v)
                for p, o in pred_obs:
                    if (p, o) in self.ALWAYS_IGNORE:
                        continue
                    elif p in self.ignored_props:
                        continue
                    elif p in working_paths:
                        continue
                    non_conformant = True
                    rept = self.make_v_result(target_graph,
                                              f,
                                              value_node=o,
                                              result_path=p)
                    reports.append(rept)
        return (not non_conformant), reports
Exemplo n.º 6
0
def main():

    # Parse Swift book to retrieve concepts and related resources
    start = "https://docs.swift.org/swift-book/"
    nextURL = start
    urls = [nextURL]

    concepts = {}

    while nextURL:
        url = nextURL
        page = urlopen(url)
        soup = BeautifulSoup(page, 'html.parser')

        #title = soup.find('title').string

        article = soup.select_one('article.page')
        headings = article.find_all(re.compile('^h[1-6]$'))

        for heading in headings:
            heading_text = str(heading.contents[0]).lower()
            permalink = url + heading.contents[1].get('href')

            doc = nlp(heading_text)

            noun_phrases = [chunk for chunk in doc.noun_chunks]

            if len(noun_phrases) > 0:
                new_concepts = [lemmatize(lstrip_stopwords(chunk)).strip() for chunk in noun_phrases]
            else:
                # if no noun-phrases, take as verbatim (e.g. break, continue)
                new_concepts = [heading_text]

            for c in new_concepts:
                if c not in concepts:
                    concepts[c] = []
                if permalink not in concepts[c]:
                    # optionally: don't add if permalink (apart from fragment) is already contained (to avoid reindexing the same page multiple times, as a concept like "Function" might appear many times on its dedicated page in different headers)
                    if not page_included(permalink, concepts[c]):
                        concepts[c].append(permalink)

        # continue to next page (if any)
        nextLink = soup.select_one("p.next a")

        if nextLink:
            parts = urlsplit(nextURL)
            base_path, _ = split(parts.path)
            base_url = urlunsplit((parts.scheme, parts.netloc, join(base_path, ""), parts.query, parts.fragment))
            nextURL = urljoin(base_url, nextLink.get('href'))
            urls.append(nextURL)
        else:
            nextURL = None

    # RDF Graph creation
    g = Graph()

    # Namespace bindings
    NS = Namespace(ALMA_NS + SCHEME_NAME + "#")
    DBPEDIA = Namespace('http://dbpedia.org/page/')
    g.namespace_manager.bind('owl', OWL)
    g.namespace_manager.bind('skos', SKOS)
    g.namespace_manager.bind('dct', DCTERMS)
    g.namespace_manager.bind('foaf', FOAF)
    g.namespace_manager.bind('dbr', DBPEDIA)
    g.namespace_manager.bind(SCHEME_NAME, NS)

    # Ontology Metadata
    ontology = URIRef(ALMA_NS + SCHEME_NAME)
    g.add((ontology, RDF.type, OWL.term("Ontology")))
    g.add((ontology, DCTERMS.term("title"), Literal("{} Ontology".format(SCHEME_NAME.title()))))
    g.add((ontology, DCTERMS.term("description"), Literal("This is an SKOS-based lightweight ontology about the Swift programming language.")))
    g.add((ontology, DCTERMS.term("subject"), URIRef(quote("http://dbpedia.org/page/Swift_(programming_language)"))))
    g.add((ontology, DCTERMS.term("license"), URIRef("https://creativecommons.org/licenses/by-sa/4.0/")))
    g.add((ontology, DCTERMS.term("created"), Literal(DATE_CREATED)))
    g.add((ontology, DCTERMS.term("modified"), Literal(DATE_MODIFIED)))
    g.add((ontology, RDFS.term("seeAlso"), URIRef("https://coast.uni.lu/alma/")))
    g.add((ontology, OWL.term("versionIRI"), URIRef("http://purl.org/lu/uni/alma/{}/{}".format(SCHEME_NAME, LANGUAGE_VERSION))))
    g.add((ontology, OWL.term("versionInfo"), Literal("{}/{}".format(LANGUAGE_VERSION, ONTOLOGY_VERSION))))
    g.add((ontology, OWL.term("imports"), URIRef("http://www.w3.org/2004/02/skos/core")))
    creator = BNode()
    g.add((ontology, DCTERMS.term("creator"), creator))
    g.add((creator, RDF.type, FOAF.term("Person")))
    g.add((creator, FOAF.term("name"), Literal(AUTHOR_NAME)))
    g.add((creator, FOAF.term("mbox"), URIRef(AUTHOR_EMAIL)))

    # Concept Scheme
    schemeURI = NS.term("Scheme")
    g.add((schemeURI, RDF.type, SKOS.term("ConceptScheme")))
    g.add((schemeURI, DCTERMS.term("title"), Literal(SCHEME_NAME.title())))

    # Concepts
    for (concept, urls) in concepts.items():
        conceptURI = NS.term(cleanse(concept))
        prefLabel = concept.title()
        g.add((conceptURI, RDF.type, SKOS.term("Concept")))
        g.add((conceptURI, RDF.type, OWL.term("NamedIndividual")))
        g.add((conceptURI, SKOS.term("inScheme"), schemeURI))
        g.add((conceptURI, SKOS.term("prefLabel"), Literal(prefLabel, lang='en')))

        # Resources from Swift book
        for url in urls:
            g.add((conceptURI, SKOS.term("definition"), URIRef(url)))

    # Serialization
    for (format, file_extension) in SERIALIZATION_FORMATS.items():
        file_name = "{}_{}_{}.{}".format(SCHEME_NAME, LANGUAGE_VERSION, ONTOLOGY_VERSION, file_extension)
        g.serialize(format=format, destination=file_name)
        print("Saved under {}".format(file_name))

    print("# triples:", len(g))
    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))