Ejemplo n.º 1
0
    def is_supported_profile(cls, profile_key):
        is_supported = False
        for k, v in PROFILES.items():
            if profile_key == k or profile_key == v.uri:
                is_supported = True

        return is_supported
Ejemplo n.º 2
0
    def __init__(self,
                 input_data_file=None,
                 input_uri=None,
                 outputformat="html",
                 exclude_css=False,
                 profile="owlp"):
        self.profile_selected = profile

        if outputformat not in ["html", "md"]:
            self.outputformat = "html"
        else:
            self.outputformat = outputformat

        self.exclude_css = exclude_css

        if profile not in PROFILES.keys():
            self.profile_selected = "owlp"
        else:
            self.profile_selected = profile

        # shared variables
        if input_data_file is not None:
            self._parse_input_data_file(input_data_file)
        elif input_uri is not None:
            self._parse_input_uri(input_uri)
        else:
            raise Exception(
                "You must supply either an input file or a URI for your ontology's RDF"
            )
Ejemplo n.º 3
0
    def __init__(self,
                 input_data_file=None,
                 input_uri=None,
                 data=None,
                 outputformat="html",
                 exclude_css=False,
                 get_curies_online=False,
                 profile="owlp"):
        """This class receives all of the variables needed to specify how to make documentation from an input RDF source

        :param input_data_file: An RDF file
        :type input_data_file: path (string)
        :param input_uri: A URI resolving to RDF data
        :type input_uri: A URI (string)
        :param data: RDF data
        :type data: Python varaible (string)
        :param outputformat: The desired output format form the list of supported formats (currently either "html" (default) or "md" for Markdown
        :type outputformat: string (one of "html" or "md")
        :param exclude_css: Whether (True, default) or not (False) to include styling CSS within HTML outputs (as oposed to producing a separate style.css file)
        :type exclude_css: boolean
        :param get_curies_online: Whether (True) or not (False, default) to search prefix.cc online for additional URI prefixes
        :type get_curies_online: boolean
        :param profile: When document profile, from a supported set, to use. Currently supported is "owlp" (profile of OWL) or "skosp" (profile of SKOS). See `list_profiles()` for full list of profiles.
        :type profile: string (one of "owlp" or "skosp")
        """
        self.profile_selected = profile

        if outputformat not in ["html", "md"]:
            self.outputformat = "html"
        else:
            self.outputformat = outputformat

        self.exclude_css = exclude_css
        self.get_curies_online = get_curies_online

        if profile not in PROFILES.keys():
            self.profile_selected = "owlp"
        else:
            self.profile_selected = profile

        # shared variables
        if input_data_file is not None:
            self._parse_input_data_file(input_data_file)
        elif input_uri is not None:
            self._parse_input_uri(input_uri)
        elif data is not None:
            self._parse_data()
        else:
            raise Exception(
                "You must supply either an input file or a URI for your ontology's RDF"
            )
Ejemplo n.º 4
0
    def list_profiles(cls):
        s = ""
        for k, v in PROFILES.items():
            s += "{}: {}\n".format(k, v)

        return s