本文整理汇总了Java中org.semanticweb.owlapi.model.OWLRuntimeException类的典型用法代码示例。如果您正苦于以下问题:Java OWLRuntimeException类的具体用法?Java OWLRuntimeException怎么用?Java OWLRuntimeException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OWLRuntimeException类属于org.semanticweb.owlapi.model包,在下文中一共展示了OWLRuntimeException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readIntoBuffer
import org.semanticweb.owlapi.model.OWLRuntimeException; //导入依赖的package包/类
/**
* Reads all the bytes from the specified stream into a temporary buffer,
* which is necessary because we may need to access the input stream more
* than once. In other words, this method caches the input stream.
*
* @param stream
* The stream to be cached
*/
private void readIntoBuffer(InputStream reader)
{
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
final int length = 100000;
byte[] tempBuffer = new byte[length];
int read = 0;
do {
read = reader.read(tempBuffer, 0, length);
if (read > 0) {
bos.write(tempBuffer, 0, read);
}
}
while (read > 0);
mBuffer = bos.toByteArray();
}
catch (IOException e) {
throw new OWLRuntimeException(e);
}
}
示例2: getIRI
import org.semanticweb.owlapi.model.OWLRuntimeException; //导入依赖的package包/类
@Override
public IRI getIRI(String prefixIRI) {
if (prefixIRI.startsWith("<")) {
return IRI.create(prefixIRI.substring(1, prefixIRI.length() - 1));
}
int sep = prefixIRI.indexOf(':');
if (sep == -1) {
if (getDefaultPrefix() != null) {
return IRI.create(getDefaultPrefix() + prefixIRI);
} else {
return IRI.create(prefixIRI);
}
} else {
String prefixName = prefixIRI.substring(0, sep + 1);
if (!containsPrefixMapping(prefixName)) {
throw new OWLRuntimeException("Prefix not registered for prefix name: " + prefixName);
}
String prefix = getPrefix(prefixName);
String localName = prefixIRI.substring(sep + 1);
return IRI.create(prefix, localName);
}
}
示例3: OWLLiteralImpl
import org.semanticweb.owlapi.model.OWLRuntimeException; //导入依赖的package包/类
/**
* @param literal the lexical form
* @param lang the language; can be null or an empty string, in which case datatype can be any
* datatype but not null
* @param datatype the datatype; if lang is null or the empty string, it can be null or it MUST
* be RDFPlainLiteral
*/
public OWLLiteralImpl(@Nonnull String literal, @Nullable String lang,
@Nullable OWLDatatype datatype) {
this.literal = new LiteralWrapper(checkNotNull(literal, "literal cannot be null"));
if (lang == null || lang.isEmpty()) {
language = "";
if (datatype == null) {
this.datatype = RDF_PLAIN_LITERAL;
} else {
this.datatype = datatype;
}
} else {
if (datatype != null && !datatype.isRDFPlainLiteral()) {
// ERROR: attempting to build a literal with a language tag and
// type different from plain literal
throw new OWLRuntimeException("Error: cannot build a literal with type: "
+ datatype.getIRI() + " and language: " + lang);
}
language = lang;
this.datatype = RDF_PLAIN_LITERAL;
}
hashcode = getHashCode(literal);
}
示例4: render
import org.semanticweb.owlapi.model.OWLRuntimeException; //导入依赖的package包/类
@Override
public void render(OWLOntology ontology, PrintWriter writer) throws OWLRendererException {
try {
OWLFuncionalSyntaxRefsetObjectRenderer ren = new OWLFuncionalSyntaxRefsetObjectRenderer(ontology,
writer);
ontology.accept(ren);
writer.flush();
} catch (OWLRuntimeException e) {
throw new OWLRendererIOException(e);
}
}
示例5: convert
import org.semanticweb.owlapi.model.OWLRuntimeException; //导入依赖的package包/类
public OWLRuntimeException convert(ElkException e) {
if (e instanceof ElkFreshEntitiesException)
return convert((ElkFreshEntitiesException) e);
else if (e instanceof ElkInconsistentOntologyException)
return convert((ElkInconsistentOntologyException) e);
else if (e instanceof ElkInterruptedException)
return convert((ElkInterruptedException) e);
else
return new OWLRuntimeException(e);
}
示例6: loadViaOWLAPI
import org.semanticweb.owlapi.model.OWLRuntimeException; //导入依赖的package包/类
private OWLOntology loadViaOWLAPI() throws Owl2ParseException {
try {
return TestOWLManager.createOWLOntologyManager()
.loadOntologyFromOntologyDocument(mOntoSource);
} catch (OWLOntologyCreationException e) {
throw new Owl2ParseException(e);
} catch (OWLRuntimeException re) {
throw new Owl2ParseException(re);
}
}
示例7: getBuiltInDatatype
import org.semanticweb.owlapi.model.OWLRuntimeException; //导入依赖的package包/类
@Override
public OWL2Datatype getBuiltInDatatype() {
if (!builtin) {
throw new OWLRuntimeException(
iri
+ " is not a built in datatype. The getBuiltInDatatype() method should only be called on built in datatypes.");
} else {
return OWL2Datatype.getDatatype(iri);
}
}
示例8: parseBoolean
import org.semanticweb.owlapi.model.OWLRuntimeException; //导入依赖的package包/类
@Override
public boolean parseBoolean() {
throw new OWLRuntimeException(getClass().getName() + " does not have a boolean value");
}
示例9: parseDouble
import org.semanticweb.owlapi.model.OWLRuntimeException; //导入依赖的package包/类
@Override
public double parseDouble() {
throw new OWLRuntimeException(getClass().getName() + " does not have a double value");
}
示例10: parseFloat
import org.semanticweb.owlapi.model.OWLRuntimeException; //导入依赖的package包/类
@Override
public float parseFloat() {
throw new OWLRuntimeException(getClass().getName() + " does not have a float value");
}
示例11: asOWLClass
import org.semanticweb.owlapi.model.OWLRuntimeException; //导入依赖的package包/类
@Override
public OWLClass asOWLClass() {
throw new OWLRuntimeException("Not an OWLClass!");
}
示例12: asOWLDatatype
import org.semanticweb.owlapi.model.OWLRuntimeException; //导入依赖的package包/类
@Override
public OWLDatatype asOWLDatatype() {
throw new OWLRuntimeException("Not an OWLDatatype!");
}
示例13: asOWLNamedIndividual
import org.semanticweb.owlapi.model.OWLRuntimeException; //导入依赖的package包/类
@Override
public OWLNamedIndividual asOWLNamedIndividual() {
throw new OWLRuntimeException("Not an OWLIndividual!");
}
示例14: asOWLObjectProperty
import org.semanticweb.owlapi.model.OWLRuntimeException; //导入依赖的package包/类
@Override
public OWLObjectProperty asOWLObjectProperty() {
throw new OWLRuntimeException("Not an OWLObjectProperty!");
}
示例15: asOWLAnnotationProperty
import org.semanticweb.owlapi.model.OWLRuntimeException; //导入依赖的package包/类
@Override
public OWLAnnotationProperty asOWLAnnotationProperty() {
throw new OWLRuntimeException("Not an annotation property");
}