Class QuotedEntityChecker

  • All Implemented Interfaces:
    org.semanticweb.owlapi.expression.OWLEntityChecker

    public class QuotedEntityChecker
    extends Object
    implements org.semanticweb.owlapi.expression.OWLEntityChecker
    A custom OWLEntityChecker that also resolves names inside single and double quotation marks.
    Author:
    James A. Overton
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(org.semanticweb.owlapi.model.OWLEntity entity)
      Use annotation properties and the short form provider to add mappings for a single entity.
      void add​(org.semanticweb.owlapi.model.OWLEntity entity, String name)
      Add a specific mapping to the given entity.
      void add​(org.semanticweb.owlapi.model.OWLOntology parentOntology, org.semanticweb.owlapi.model.OWLEntity entity)
      Use annotation properties and the short form provider to add mappings for a single entity.
      void addAll​(org.semanticweb.owlapi.model.OWLOntology ontology)
      Use annotation properties and the short form provider to add mappings for all entities in the given ontology.
      void addProperty​(org.semanticweb.owlapi.model.OWLAnnotationProperty property)
      Add an annotation property for finding names.
      void addProvider​(org.semanticweb.owlapi.util.ShortFormProvider provider)
      Add a short form providers for finding names.
      static String escape​(String content)
      Escape single quotations marks inside a string.
      IOHelper getIOHelper()
      Get the configured IOHelper.
      org.semanticweb.owlapi.model.IRI getIRI​(String name, boolean create)
      Get the IRI for the given name, or create a new IRI from the name.
      String getLabel​(org.semanticweb.owlapi.model.IRI iri)
      Get the label for the given IRI.
      org.semanticweb.owlapi.model.OWLAnnotationProperty getOWLAnnotationProperty​(String name)
      Find an annotation property with the given name, or create one.
      org.semanticweb.owlapi.model.OWLAnnotationProperty getOWLAnnotationProperty​(String name, boolean create)
      Find an annotation property with the given name, or create one.
      org.semanticweb.owlapi.model.OWLClass getOWLClass​(String name)
      Find a class with the given name, or create one.
      org.semanticweb.owlapi.model.OWLClass getOWLClass​(String name, boolean create)
      Find a class with the given name, or create one.
      org.semanticweb.owlapi.model.OWLDataProperty getOWLDataProperty​(String name)
      Find a data property with the given name.
      org.semanticweb.owlapi.model.OWLDatatype getOWLDatatype​(String name)
      Find a datatype with the given name, or create one.
      org.semanticweb.owlapi.model.OWLDatatype getOWLDatatype​(String name, boolean create)
      Find a datatype with the given name, or create one.
      org.semanticweb.owlapi.model.OWLEntity getOWLEntity​(String name)
      Find any entity with the given name.
      org.semanticweb.owlapi.model.OWLNamedIndividual getOWLIndividual​(String name)
      Find a named individual with the given name.
      org.semanticweb.owlapi.model.OWLObjectProperty getOWLObjectProperty​(String name)
      Find an object property with the given name.
      void setIOHelper​(IOHelper ioHelper)
      Add an IOHelper for resolving names to IRIs.
      static String wrap​(String content)
      Given a string that may be a name or a class expression, if it starts with quotation mark or parenthesis then return it, if it contains no spaces then return it, otherwise return it wrapped in single quotes.
    • Constructor Detail

      • QuotedEntityChecker

        public QuotedEntityChecker()
    • Method Detail

      • setIOHelper

        public void setIOHelper​(IOHelper ioHelper)
        Add an IOHelper for resolving names to IRIs.
        Parameters:
        ioHelper - the IOHelper to use
      • getIOHelper

        public IOHelper getIOHelper()
        Get the configured IOHelper.
        Returns:
        the IOHelper, or null if none has been set
      • addProvider

        public void addProvider​(org.semanticweb.owlapi.util.ShortFormProvider provider)
        Add a short form providers for finding names.
        Parameters:
        provider - the short form provider to add
      • addProperty

        public void addProperty​(org.semanticweb.owlapi.model.OWLAnnotationProperty property)
        Add an annotation property for finding names.
        Parameters:
        property - the property to add
      • escape

        public static String escape​(String content)
        Escape single quotations marks inside a string.
        Parameters:
        content - the string to escape
        Returns:
        the escaped string
      • wrap

        public static String wrap​(String content)
        Given a string that may be a name or a class expression, if it starts with quotation mark or parenthesis then return it, if it contains no spaces then return it, otherwise return it wrapped in single quotes.
        Parameters:
        content - the string to wrap
        Returns:
        the wrapped string
      • addAll

        public void addAll​(org.semanticweb.owlapi.model.OWLOntology ontology)
        Use annotation properties and the short form provider to add mappings for all entities in the given ontology.
        Parameters:
        ontology - the ontology to add mappings for
      • add

        public void add​(org.semanticweb.owlapi.model.OWLEntity entity)
        Use annotation properties and the short form provider to add mappings for a single entity.
        Parameters:
        entity - the entity to add mappings for
      • add

        public void add​(org.semanticweb.owlapi.model.OWLOntology parentOntology,
                        org.semanticweb.owlapi.model.OWLEntity entity)
        Use annotation properties and the short form provider to add mappings for a single entity.
        Parameters:
        parentOntology - an ontology with annotations for the entity
        entity - the entity to add mappings for
      • add

        public void add​(org.semanticweb.owlapi.model.OWLEntity entity,
                        String name)
        Add a specific mapping to the given entity.
        Parameters:
        entity - the entity to add mappings for
        name - the name to map to this entity
      • getIRI

        public org.semanticweb.owlapi.model.IRI getIRI​(String name,
                                                       boolean create)
        Get the IRI for the given name, or create a new IRI from the name.
        Parameters:
        name - entity to get IRI of, or to create
        create - if true, create a new IRI
        Returns:
        the IRI of the entity, or null
      • getLabel

        public String getLabel​(org.semanticweb.owlapi.model.IRI iri)
        Get the label for the given IRI. Quotation marks will be removed if necessary.
        Parameters:
        iri - IRI to get label of
        Returns:
        the label of the entity, or null if none is found
      • getOWLAnnotationProperty

        public org.semanticweb.owlapi.model.OWLAnnotationProperty getOWLAnnotationProperty​(@Nonnull
                                                                                           String name)
        Find an annotation property with the given name, or create one. Quotation marks will be removed if necessary.
        Specified by:
        getOWLAnnotationProperty in interface org.semanticweb.owlapi.expression.OWLEntityChecker
        Parameters:
        name - the name of the entity to find
        Returns:
        an annotation property, or null
      • getOWLAnnotationProperty

        public org.semanticweb.owlapi.model.OWLAnnotationProperty getOWLAnnotationProperty​(@Nonnull
                                                                                           String name,
                                                                                           boolean create)
        Find an annotation property with the given name, or create one. Quotation marks will be removed if necessary.
        Parameters:
        name - the name of the entity to find
        create - if false, do not create a new annotation property
        Returns:
        an annotation property, or null
      • getOWLClass

        public org.semanticweb.owlapi.model.OWLClass getOWLClass​(@Nonnull
                                                                 String name)
        Find a class with the given name, or create one. Quotation marks will be removed if necessary.
        Specified by:
        getOWLClass in interface org.semanticweb.owlapi.expression.OWLEntityChecker
        Parameters:
        name - the name of the entity to find
        Returns:
        a class, or null
      • getOWLClass

        public org.semanticweb.owlapi.model.OWLClass getOWLClass​(@Nonnull
                                                                 String name,
                                                                 boolean create)
        Find a class with the given name, or create one. Quotation marks will be removed if necessary.
        Parameters:
        name - the name of the entity to find
        create - if false, do not create a new class
        Returns:
        a class, or null
      • getOWLDataProperty

        public org.semanticweb.owlapi.model.OWLDataProperty getOWLDataProperty​(@Nonnull
                                                                               String name)
        Find a data property with the given name. Quotation marks will be removed if necessary.
        Specified by:
        getOWLDataProperty in interface org.semanticweb.owlapi.expression.OWLEntityChecker
        Parameters:
        name - the name of the entity to find
        Returns:
        a data property, or null
      • getOWLDatatype

        public org.semanticweb.owlapi.model.OWLDatatype getOWLDatatype​(@Nonnull
                                                                       String name)
        Find a datatype with the given name, or create one. Quotation marks will be removed if necessary.
        Specified by:
        getOWLDatatype in interface org.semanticweb.owlapi.expression.OWLEntityChecker
        Parameters:
        name - the name of the entity to find
        Returns:
        a datatype, or null
      • getOWLDatatype

        public org.semanticweb.owlapi.model.OWLDatatype getOWLDatatype​(@Nonnull
                                                                       String name,
                                                                       boolean create)
        Find a datatype with the given name, or create one. Quotation marks will be removed if necessary.
        Parameters:
        name - the name of the entity to find
        create - if false, do not create a new datatype
        Returns:
        a datatype, or null
      • getOWLIndividual

        public org.semanticweb.owlapi.model.OWLNamedIndividual getOWLIndividual​(@Nonnull
                                                                                String name)
        Find a named individual with the given name. Quotation marks will be removed if necessary.
        Specified by:
        getOWLIndividual in interface org.semanticweb.owlapi.expression.OWLEntityChecker
        Parameters:
        name - the name of the entity to find
        Returns:
        a named individual, or null
      • getOWLObjectProperty

        public org.semanticweb.owlapi.model.OWLObjectProperty getOWLObjectProperty​(@Nonnull
                                                                                   String name)
        Find an object property with the given name. Quotation marks will be removed if necessary.
        Specified by:
        getOWLObjectProperty in interface org.semanticweb.owlapi.expression.OWLEntityChecker
        Parameters:
        name - the name of the entity to find
        Returns:
        an object property, or null
      • getOWLEntity

        public org.semanticweb.owlapi.model.OWLEntity getOWLEntity​(String name)
        Find any entity with the given name. Quotation marks will be removed if necessary.
        Parameters:
        name - the name of the entity to find
        Returns:
        an entity, or null