Python rdflib.namespace.RDFS Examples

The following are 2 code examples of rdflib.namespace.RDFS(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module rdflib.namespace , or try the search function .
Example #1
Source File: test_genotype.py    From dipper with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def test_addGenotype(self):
        from rdflib.namespace import RDFS, URIRef
        from rdflib import Literal
        from dipper.utils.CurieUtil import CurieUtil
        cutil = CurieUtil(self.curie_map)
        gid = 'MGI:5515892'
        label = \
            'Pmp22<Tr-2J>/Pmp22<+> [C57BL/6J-Pmp22<Tr-2J>/GrsrJ]'
        self.genotype.addGenotype(gid, label)
        self.assertTrue(
            (URIRef(cutil.get_uri(gid)), RDFS['label'],
             Literal(label)) in self.genotype.graph) 
Example #2
Source File: templating.py    From open-context-py with GNU General Public License v3.0 5 votes vote down vote up
def get_comments(self):
        """ gets comments for the entity (or vocabulary) """
        if isinstance(self.uri, str):
            lequiv = LinkEquivalence()
            subjs = lequiv.get_identifier_list_variants(self.uri)
            lequiv = LinkEquivalence()
            # get all the varients of RDFS:comments
            comment_uris = lequiv.get_identifier_list_variants('rdfs:comment')
            commment_annos = LinkAnnotation.objects\
                                           .filter(subject__in=subjs,
                                                   predicate_uri__in=comment_uris)[:1]
            if len(commment_annos) > 0:
                self.comment = commment_annos[0].obj_extra
                lang = Languages()
                self.default_comment = lang.get_default_value_str(self.comment)