Exemple #1
0
 def add_class(self, class_uri, parent_uri, context=""):
     req = srvs.WoModifyRequest()
     req.context = context
     req.statements.append(
         utils.makeStatementMsg(class_uri, "rdf:type", "owl:class", True))
     req.statements.append(
         utils.makeStatementMsg(class_uri, "rdfs:subClassOf", parent_uri,
                                True))
     res = self._call(self._ontology_modify, req)
     if res:
         if res.ok:
             return True
     return False
Exemple #2
0
    def add_ontology(self, uri):
        """
        @brief Creates a new ontology

        @param uri the id of the graph
        """
        req = srvs.WoModifyRequest()
        req.context = uri
        req.statements.append(
            utils.makeStatementMsg(uri, "rdf:type", "owl:Ontology", True))
        res = self._call(self._ontology_modify, req)
        if res:
            if res.ok:
                return True
        return False
Exemple #3
0
    def add_ontology(self, uri):
        """
        @brief      Creates a new ontology.

        @param      uri   the id of the ontology, that can be used as a
                          context id in other functions

        @return     True if successfully created, False otherwise
        """
        req = srvs.WoModifyRequest()
        req.context = uri
        req.statements.append(utils.makeStatementMsg(uri, "rdf:type", "owl:Ontology", True))
        res = self._call(self._ontology_modify, req)
        if res:
            if res.ok:
                return True
        return False
Exemple #4
0
    def add_class(self, class_uri, parent_uri, context=""):
        """
        @brief      Creates a new class definition

        @param      class_uri   (string) The class uri
        @param      parent_uri  (string) URI used as parent class

        @return     True if successfully created, False otherwise
        """
        req = srvs.WoModifyRequest()
        req.context = context
        req.statements.append(utils.makeStatementMsg(class_uri, "rdf:type", "owl:class", True))
        req.statements.append(utils.makeStatementMsg(class_uri, "rdfs:subClassOf", parent_uri, True))
        res = self._call(self._ontology_modify, req)
        if res:
            if res.ok:
                return True
        return False