All Downloads are FREE. Search and download functionalities are using the official Maven repository.

it.unibz.inf.ontop.cli.OntopMappingOntologyRelatedCommand Maven / Gradle / Ivy

package it.unibz.inf.ontop.cli;


import com.github.rvesse.airline.annotations.Option;
import com.github.rvesse.airline.annotations.OptionType;
import com.github.rvesse.airline.annotations.help.bash.BashCompletion;
import com.github.rvesse.airline.annotations.restrictions.AllowedEnumValues;
import com.github.rvesse.airline.annotations.restrictions.Required;
import com.github.rvesse.airline.help.cli.bash.CompletionBehaviour;
import it.unibz.inf.ontop.cli.utils.Env;

abstract class OntopMappingOntologyRelatedCommand extends AbstractOntopCommand implements OntopCommand {

    @Option(type = OptionType.COMMAND, name = {"-t", "--ontology"}, title = "ontology file",
            description = "OWL ontology file")
    @Env(value = {"ONTOP_ONTOLOGY_FILE", "ONTOLOGY_FILE"}, deprecated = "ONTOLOGY_FILE")
    @BashCompletion(behaviour = CompletionBehaviour.FILENAMES)
    String owlFile;

    @Option(type = OptionType.COMMAND, name = {"-a", "--facts"}, title = "fact file",
            description = "RDF fact file")
    @Env("ONTOP_FACTS_FILE")
    @BashCompletion(behaviour = CompletionBehaviour.FILENAMES)
    String factFile;

    @Option(type = OptionType.COMMAND, name = {"--facts-format"}, title = "format of facts file",
            description = "The format of the 'facts' input file.")
    @Env("ONTOP_FACTS_FORMAT")
    @AllowedEnumValues(RDFFormatTypes.class)
    RDFFormatTypes factFormat;

    @Option(type = OptionType.COMMAND, name = {"--facts-base-iri"}, title = "base IRI of facts in fact file",
            description = "The base IRI of facts in the fact file to resolve relative IRIs. If not provided, a random IRI is generated.")
    @Env("ONTOP_FACTS_BASE_IRI")
    String factsBaseIRI;

    @Option(type = OptionType.COMMAND, name = {"-m", "--mapping"}, title = "mapping file",
            description = "Mapping file in R2RML (.ttl) or in Ontop native format (.obda)")
    @Env(value = {"ONTOP_MAPPING_FILE", "MAPPING_FILE"}, deprecated = "MAPPING_FILE")
    @Required
    @BashCompletion(behaviour = CompletionBehaviour.FILENAMES)
    String mappingFile;

    @Option(type = OptionType.COMMAND, name = {"-c", "--constraint"}, title = "constraint file",
            description = "User-supplied DB constraint file")
    @Env("ONTOP_CONSTRAINT_FILE")
    @BashCompletion(behaviour = CompletionBehaviour.FILENAMES)
    String constraintFile;

    @Option(type = OptionType.COMMAND, name = {"-d", "--db-metadata"}, title = "db-metadata file",
            description = "User-supplied db-metadata file")
    @Env("ONTOP_DB_METADATA_FILE")
    @BashCompletion(behaviour = CompletionBehaviour.FILENAMES)
    String dbMetadataFile;

    @Option(type = OptionType.COMMAND, name = {"-l", "--lenses", "-v", "--ontop-views"}, title = "Lenses file",
            description = "User-supplied lenses file. Lenses were formerly named Ontop views.")
    @Env(value = {"ONTOP_LENSES_FILE", "ONTOP_VIEW_FILE"}, deprecated = "ONTOP_VIEW_FILE")
    @BashCompletion(behaviour = CompletionBehaviour.FILENAMES)
    String ontopLensesFile;

    @Option(type = OptionType.COMMAND, name = {"--sparql-rules"}, title = "SPARQL rules file",
            description = "User-supplied SPARQL rules file")
    @Env("ONTOP_SPARQL_RULES_FILE")
    @BashCompletion(behaviour = CompletionBehaviour.FILENAMES)
    String sparqlRulesFile;

    @Option(type = OptionType.COMMAND, name = {"-x", "--xml-catalog"}, title = "xml catalog file",
            description = "XML Catalog file (e.g. catalog-v001.xml generated by Protege) for redirecting ontologies imported by owl:imports")
    @Env("ONTOP_XML_CATALOG_FILE")
    @BashCompletion(behaviour = CompletionBehaviour.FILENAMES)
    String xmlCatalogFile;

    @Option(type = OptionType.COMMAND, name = {"--enable-annotations"},
            description = "enable annotation properties defined in the ontology. Default: false")
    @Env("ONTOP_ENABLE_ANNOTATIONS")
    public boolean enableAnnotations = false;

    protected boolean isR2rmlFile(String mappingFile) {
        return !mappingFile.endsWith(".obda");
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy