Package org.semanticweb.owlapi.model
Class IRI
java.lang.Object
org.semanticweb.owlapi.model.IRI
- All Implemented Interfaces:
Serializable
,CharSequence
,Comparable<OWLObject>
,org.apache.commons.rdf.api.BlankNodeOrIRI
,org.apache.commons.rdf.api.IRI
,org.apache.commons.rdf.api.RDFTerm
,HasAnnotationPropertiesInSignature
,HasAnnotationValue
,HasAnonymousIndividuals
,HasClassesInSignature
,HasComponents
,HasContainsEntityInSignature
,HasDataPropertiesInSignature
,HasDatatypesInSignature
,HasHashIndex
,HasIndex
,HasIndividualsInSignature
,HasObjectPropertiesInSignature
,HasShortForm
,HasSignature
,IsAnonymous
,OWLAnnotationObject
,OWLAnnotationSubject
,OWLAnnotationValue
,OWLObject
,OWLPrimitive
,SWRLPredicate
public class IRI
extends Object
implements OWLAnnotationSubject, OWLAnnotationValue, SWRLPredicate, CharSequence, OWLPrimitive, HasShortForm, org.apache.commons.rdf.api.IRI
Represents International Resource Identifiers.
- Since:
- 3.0.0
- Author:
- Matthew Horridge, The University of Manchester, Information Management Group
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(OWLAnnotationSubjectVisitor visitor) <E> E
accept
(OWLAnnotationSubjectVisitorEx<E> visitor) void
accept
(OWLAnnotationValueVisitor visitor) <O> O
accept
(OWLAnnotationValueVisitorEx<O> visitor) void
accept
(OWLObjectVisitor visitor) Accepts a visitor<O> O
accept
(OWLObjectVisitorEx<O> visitor) Accepts a visitorasIRI()
char
charAt
(int index) int
Stream<?>
static IRI
static IRI
Creates an IRI from the specified String.static IRI
Creates an IRI by concatenating two strings.static IRI
static IRI
boolean
static IRI
Gets an auto-generated ontology document IRI.Gets the last part of the IRI that is a valid NCName; note that for some IRIs this can be empty.static IRI
getNextDocumentIRI
(String prefix) Gets the short form.int
hashCode()
int
int
boolean
Determines if this IRI is absolute.boolean
Built in annotation properties do not need declarations.boolean
isIRI()
boolean
Determines if this IRI is equal to the IRI thatowl:Nothing
is named with.boolean
Determines if this IRI is equal to the IRI that is namedrdf:PlainLiteral
.boolean
Determines if this IRI is in the reserved vocabulary.boolean
isThing()
Determines if this IRI is equal to the IRI thatowl:Thing
is named with.int
length()
prefixedBy
(String prefix) subSequence
(int start, int end) Obtained this IRI surrounded by angled brackets.toString()
toURI()
Obtains this IRI as a URI.int
Methods inherited from interface java.lang.CharSequence
chars, codePoints, isEmpty
Methods inherited from interface org.semanticweb.owlapi.model.HasAnnotationPropertiesInSignature
annotationPropertiesInSignature, getAnnotationPropertiesInSignature
Methods inherited from interface org.semanticweb.owlapi.model.HasAnnotationValue
anonymousIndividualValue, ifAnonymousIndividual, ifAnonymousIndividualOrElse, ifIri, ifIriOrElse, ifLiteral, ifLiteralOrElse, ifValue, iriValue, literalValue, map, map, mapAnonymousIndividual, mapAnonymousIndividualOrElse, mapAnonymousIndividualOrElseGet, mapIri, mapIriOrElse, mapIriOrElseGet, mapLiteral, mapLiteralOrElse, mapLiteralOrElseGet, mapValue, when
Methods inherited from interface org.semanticweb.owlapi.model.HasAnonymousIndividuals
anonymousIndividuals, getAnonymousIndividuals
Methods inherited from interface org.semanticweb.owlapi.model.HasClassesInSignature
classesInSignature, getClassesInSignature
Methods inherited from interface org.semanticweb.owlapi.model.HasComponents
componentsAnnotationsFirst, componentsWithoutAnnotations
Methods inherited from interface org.semanticweb.owlapi.model.HasContainsEntityInSignature
containsEntityInSignature
Methods inherited from interface org.semanticweb.owlapi.model.HasDataPropertiesInSignature
dataPropertiesInSignature, getDataPropertiesInSignature
Methods inherited from interface org.semanticweb.owlapi.model.HasDatatypesInSignature
datatypesInSignature, getDatatypesInSignature
Methods inherited from interface org.semanticweb.owlapi.model.HasIndividualsInSignature
getIndividualsInSignature, individualsInSignature
Methods inherited from interface org.semanticweb.owlapi.model.HasObjectPropertiesInSignature
getObjectPropertiesInSignature, objectPropertiesInSignature
Methods inherited from interface org.semanticweb.owlapi.model.HasSignature
getSignature, signature, unsortedSignature
Methods inherited from interface org.semanticweb.owlapi.model.IsAnonymous
isAnonymous, isNamed
Methods inherited from interface org.semanticweb.owlapi.model.OWLAnnotationObject
asAnonymousIndividual
Methods inherited from interface org.semanticweb.owlapi.model.OWLAnnotationValue
annotationValue, asLiteral, isLiteral
Methods inherited from interface org.semanticweb.owlapi.model.OWLObject
getNestedClassExpressions, hasSharedStructure, isAnonymousExpression, isAxiom, isBottomEntity, isIndividual, isOntology, isTopEntity, nestedClassExpressions
-
Method Details
-
create
Creates an IRI from the specified String.- Parameters:
str
- The String that specifies the IRI- Returns:
- The IRI that has the specified string representation.
-
create
Creates an IRI by concatenating two strings. The full IRI is an IRI that contains the characters in prefix + suffix.- Parameters:
prefix
- The first stringsuffix
- The second string- Returns:
- An IRI whose characters consist of prefix + suffix.
- Since:
- 3.3
-
create
- Parameters:
file
- the file to create the IRI from- Returns:
- file.toURI() IRI
-
create
- Parameters:
uri
- the URI to create the IRI from- Returns:
- the IRI wrapping the URI
-
create
- Parameters:
url
- the URL to create the IRI from- Returns:
- an IRI wrapping url.toURI()
- Throws:
OWLRuntimeException
- if the URL is ill formed
-
generateDocumentIRI
Gets an auto-generated ontology document IRI.- Returns:
- An auto-generated ontology document IRI. The IRI has the form
owlapi:ontologyNNNNNNNNNNN
-
getNextDocumentIRI
- Parameters:
prefix
- prefix for result- Returns:
- a fresh IRI
-
typeIndex
public int typeIndex() -
isIRI
public boolean isIRI() -
toURI
Obtains this IRI as a URI. Note that Java URIs handle unicode characters, so there is no loss during this translation.- Returns:
- The URI
-
isAbsolute
public boolean isAbsolute()Determines if this IRI is absolute.- Returns:
true
if this IRI is absolute orfalse
if this IRI is not absolute
-
getScheme
- Returns:
- the IRI scheme, e.g.,
http
,urn
-
getNamespace
- Returns:
- the prefix
-
resolve
- Parameters:
s
- the IRI string to be resolved- Returns:
- s resolved against this IRI (with the URI::resolve() method, unless this IRI is opaque)
-
isReservedVocabulary
public boolean isReservedVocabulary()Determines if this IRI is in the reserved vocabulary. An IRI is in the reserved vocabulary if it starts with <http://www.w3.org/1999/02/22-rdf-syntax-ns#> or <http://www.w3.org/2000/01/rdf-schema#> or <http://www.w3.org/2001/XMLSchema#> or <http://www.w3.org/2002/07/owl#>- Returns:
true
if the IRI is in the reserved vocabulary, otherwisefalse
.
-
isBuiltinAnnotationProperty
public boolean isBuiltinAnnotationProperty()Built in annotation properties do not need declarations. Adding this method to IRIs so during parsing any undeclared properties can easily be disambiguated between builtin annotation properties and properties that are guessed to be annotation properties because of missing declarations.- Returns:
- true if this IRI equals one of the vocabulary annotation properties
-
isThing
public boolean isThing()Determines if this IRI is equal to the IRI thatowl:Thing
is named with.- Returns:
true
if this IRI is equal to <http://www.w3.org/2002/07/owl#Thing> and otherwisefalse
-
isNothing
public boolean isNothing()Determines if this IRI is equal to the IRI thatowl:Nothing
is named with.- Returns:
true
if this IRI is equal to <http://www.w3.org/2002/07/owl#Nothing> and otherwisefalse
-
isPlainLiteral
public boolean isPlainLiteral()Determines if this IRI is equal to the IRI that is namedrdf:PlainLiteral
.- Returns:
true
if this IRI is equal to <http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral>, otherwisefalse
-
getFragment
Gets the last part of the IRI that is a valid NCName; note that for some IRIs this can be empty.- Returns:
- The IRI fragment, or empty string if the IRI does not have a fragment
-
getRemainder
- Returns:
- the remainder (coincident with NCName usually) for this IRI.
-
toQuotedString
Obtained this IRI surrounded by angled brackets.- Returns:
- This IRI surrounded by < and >
-
length
public int length()- Specified by:
length
in interfaceCharSequence
-
charAt
public char charAt(int index) - Specified by:
charAt
in interfaceCharSequence
-
subSequence
- Specified by:
subSequence
in interfaceCharSequence
-
prefixedBy
- Parameters:
prefix
- prefix to use for replacing the IRI namespace- Returns:
- prefix plus IRI ncname
-
getShortForm
Description copied from interface:HasShortForm
Gets the short form.- Specified by:
getShortForm
in interfaceHasShortForm
- Returns:
- A string that represents the short form.
-
accept
Description copied from interface:OWLObject
Accepts a visitor -
accept
Description copied from interface:OWLObject
Accepts a visitor -
accept
- Specified by:
accept
in interfaceOWLAnnotationSubject
- Parameters:
visitor
- visitor to accept
-
accept
- Specified by:
accept
in interfaceOWLAnnotationSubject
- Type Parameters:
E
- visitor return type- Parameters:
visitor
- visitor to accept- Returns:
- visitor value
-
compareTo
- Specified by:
compareTo
in interfaceComparable<OWLObject>
-
toString
- Specified by:
toString
in interfaceCharSequence
- Overrides:
toString
in classObject
-
hashCode
public int hashCode() -
initHashCode
public int initHashCode()- Specified by:
initHashCode
in interfaceOWLObject
- Returns:
- hash code for the object; called on first use, cached by OWLObjectImpl in the default implementation.
-
accept
- Specified by:
accept
in interfaceOWLAnnotationValue
- Parameters:
visitor
- visitor to accept
-
accept
- Specified by:
accept
in interfaceOWLAnnotationValue
- Type Parameters:
O
- visitor return type- Parameters:
visitor
- visitor to accept- Returns:
- visitor value
-
asIRI
- Specified by:
asIRI
in interfaceOWLAnnotationObject
- Returns:
- if the value is an IRI, return an optional containing it. Return Optional.absent otherwise.
-
equals
-
ntriplesString
- Specified by:
ntriplesString
in interfaceorg.apache.commons.rdf.api.RDFTerm
-
getIRIString
- Specified by:
getIRIString
in interfaceorg.apache.commons.rdf.api.IRI
-
components
- Specified by:
components
in interfaceHasComponents
- Returns:
- components as a stream. The stream is ordered (by visit order) but not sorted. Implementations that override components() must ensure the order is compatible with equals() and hashCode().
-
hashIndex
public int hashIndex()- Specified by:
hashIndex
in interfaceHasHashIndex
- Returns:
- index for this type. This is not a hashcode for instances, rather a hashcode for the types.
-