termorcurie.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:Meiji 作者: GiovanniBalestrieri 项目源码 文件源码
def __init__(self, state, top_level) :
        """
        @param state: the state behind this term mapping
        @type state: L{state.ExecutionContext}
        @param top_level : whether this is the top node of the DOM tree (the only place where initial contexts are handled)
        @type top_level : boolean
        """
        self.state = state

        # This is to store the local terms
        self.terms  = {}
        # This is to store the local Namespaces (a.k.a. prefixes)
        self.ns     = {}
        # Default vocabulary
        self.vocabulary = None

        if state.rdfa_version < "1.1" or top_level == False :
            return

        from .initialcontext    import initial_context    as context_data
        from .host              import initial_contexts   as context_ids
        from .host              import default_vocabulary

        for id in context_ids[state.options.host_language] :
            # This gives the id of a initial context, valid for this media type:
            data = context_data[id]

            # Merge the context data with the overall definition
            if state.options.host_language in default_vocabulary :
                self.vocabulary = default_vocabulary[state.options.host_language]
            elif data.vocabulary != "" :
                self.vocabulary = data.vocabulary

            for key in data.terms :
                self.terms[key] = URIRef(data.terms[key])
            for key in data.ns :
                self.ns[key] = (Namespace(data.ns[key]),False)


##################################################################################################################
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号