本文整理汇总了Java中org.semanticweb.owlapi.model.IRI.toString方法的典型用法代码示例。如果您正苦于以下问题:Java IRI.toString方法的具体用法?Java IRI.toString怎么用?Java IRI.toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.semanticweb.owlapi.model.IRI
的用法示例。
在下文中一共展示了IRI.toString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeModelToDatabase
import org.semanticweb.owlapi.model.IRI; //导入方法依赖的package包/类
private void writeModelToDatabase(OWLOntology model, IRI modelId) throws RepositoryException, IOException {
// Only one thread at a time can use the unisolated connection.
synchronized(repo) {
final BigdataSailRepositoryConnection connection = repo.getUnisolatedConnection();
try {
connection.begin();
try {
URI graph = new URIImpl(modelId.toString());
connection.clear(graph);
StatementCollector collector = new StatementCollector();
RioRenderer renderer = new RioRenderer(model, collector, null);
renderer.render();
connection.add(collector.getStatements(), graph);
connection.commit();
} catch (Exception e) {
connection.rollback();
throw e;
}
} finally {
connection.close();
}
}
}
示例2: getCuri
import org.semanticweb.owlapi.model.IRI; //导入方法依赖的package包/类
@Override
public String getCuri(IRI iri) {
String iriString = iri.toString();
String curi = iriString;
String longPrefix = null;
String shortPrefix = null;
// iterate over inverted map, find longest prefix match
for (Entry<String, String> e : curieMap.inverse().entrySet()) {
String currentLongPrefix = e.getKey();
int currentLongprefixLength = currentLongPrefix.length();
if (iriString.startsWith(currentLongPrefix) &&
iriString.length() > currentLongprefixLength) {
if (longPrefix == null || currentLongprefixLength > longPrefix.length()) {
longPrefix = currentLongPrefix;
shortPrefix = e.getValue();
}
}
}
if (longPrefix != null) {
return shortPrefix + ":" + iriString.substring(longPrefix.length());
}
return curi;
}
示例3: splitIRI
import org.semanticweb.owlapi.model.IRI; //导入方法依赖的package包/类
protected String[] splitIRI(IRI x) {
String s = x.toString();
String id = null;
if (s.startsWith(Obo2OWLConstants.DEFAULT_IRI_PREFIX)) {
id = s.replaceAll(Obo2OWLConstants.DEFAULT_IRI_PREFIX, "");
return new String[]{Obo2OWLConstants.DEFAULT_IRI_PREFIX,id};
}
for (String del : new String[]{"#","/",":"}) {
if (s.contains(del)) {
String[] r = s.split(del,2);
r[0] = r[0]+del;
return r;
}
}
return new String[]{"",s};
}
示例4: makeViewClassIRI
import org.semanticweb.owlapi.model.IRI; //导入方法依赖的package包/类
public IRI makeViewClassIRI(IRI vcIRI, IRI vpIRI, String sep, boolean isUseOriginalClassIRIs, boolean isAssumeOBOStyleIRIs) {
if (!isUseOriginalClassIRIs) {
String vcIRIstr = vcIRI.toString();
if (isAssumeOBOStyleIRIs) {
String baseId = Owl2Obo.getIdentifier(vcIRI);
String relId = Owl2Obo.getIdentifier(vpIRI);
vcIRIstr = Obo2OWLConstants.DEFAULT_IRI_PREFIX
+ baseId.replace(":", "_") + sep
+ relId.replace("_", "-").replace(":", "-");
}
else {
String frag = vpIRI.getFragment();
if (frag == null || frag.equals("")) {
frag = vpIRI.toString().replaceAll(".*\\/", "view");
}
vcIRIstr = vcIRIstr + sep + frag;
}
vcIRI = IRI.create(vcIRIstr);
}
return vcIRI;
}
示例5: makeViewClassIRI
import org.semanticweb.owlapi.model.IRI; //导入方法依赖的package包/类
public IRI makeViewClassIRI(IRI vcIRI, IRI vpIRI, String sep) {
if (!isUseOriginalClassIRIs) {
String vcIRIstr = vcIRI.toString();
if (isAssumeOBOStyleIRIs) {
String baseId = Owl2Obo.getIdentifier(vcIRI);
String relId = Owl2Obo.getIdentifier(vpIRI);
vcIRIstr = Obo2OWLConstants.DEFAULT_IRI_PREFIX
+ baseId.replace(":", "_") + sep
+ relId.replace("_", "-").replace(":", "-");
}
else {
String frag = vpIRI.getFragment();
if (frag == null || frag.equals("")) {
frag = vpIRI.toString().replaceAll(".*\\/", "view");
}
vcIRIstr = vcIRIstr + sep + frag;
}
vcIRI = IRI.create(vcIRIstr);
}
return vcIRI;
}
示例6: getTerminologyId
import org.semanticweb.owlapi.model.IRI; //导入方法依赖的package包/类
/**
* Returns the terminology id.
*
* @param iri the iri
* @return the terminology id
*/
@SuppressWarnings("static-method")
private String getTerminologyId(IRI iri) {
if (iri.toString().contains("#")) {
// everything after the last #
return iri.toString().substring(iri.toString().lastIndexOf("#") + 1);
} else if (iri.toString().contains("/")) {
// everything after the last slash
return iri.toString().substring(iri.toString().lastIndexOf("/") + 1);
}
// otherwise, just return the iri
return iri.toString();
}
示例7: createLocalFileName
import org.semanticweb.owlapi.model.IRI; //导入方法依赖的package包/类
static String createLocalFileName(IRI iri) {
String iriString = iri.toString();
iriString = iriString.replaceFirst("http://", "").replaceFirst("https://", "");
iriString = iriString.replace(':', '_');
iriString = iriString.replace('\\', '_');
return iriString;
}
示例8: getTaxonID
import org.semanticweb.owlapi.model.IRI; //导入方法依赖的package包/类
/**
* Get the NCBI Taxonomy ID of an OWL Class.
*
* @param taxon the class
* @return null or the NCBI Taxonomy ID as a string
*/
public static String getTaxonID(OWLClass taxon) {
IRI iri = taxon.getIRI();
String iriString = iri.toString();
if (iriString.startsWith(NCBI)) {
return iriString.replaceFirst("^" + NCBI, "");
} else {
return null;
}
}
示例9: expandAnnotation
import org.semanticweb.owlapi.model.IRI; //导入方法依赖的package包/类
private String expandAnnotation(String subject, String property,
IRI value) {
RDFXMLDocumentFormat format = OWLConverter.format;
// TODO: Why is "Annotation" always doubled?
return "AnnotationAssertion(<" +
format.getIRI(property) + "> <" +
format.getIRI(subject) + "> <" +
value.toString() + ">)";
}
示例10: shorten
import org.semanticweb.owlapi.model.IRI; //导入方法依赖的package包/类
public String shorten(IRI i) {
String iri = i.toString();
for(String prefix : iriPrefixMap.keySet()) {
if(iri.startsWith(prefix)) {
return iriPrefixMap.get(prefix) + ":" + i.getShortForm();
}
}
return i.getShortForm();
}
示例11: getDocumentIRI
import org.semanticweb.owlapi.model.IRI; //导入方法依赖的package包/类
public static String getDocumentIRI(OWLOntology ontology) {
final IRI iri = ontology.getOntologyID().getOntologyIRI().orNull();
if (iri != null) return iri.toString();
return null;
}
示例12: convert
import org.semanticweb.owlapi.model.IRI; //导入方法依赖的package包/类
@SuppressWarnings("static-method")
public ElkIri convert(IRI iri) {
return new ElkFullIri(iri.toString());
}
示例13: printOWLObject
import org.semanticweb.owlapi.model.IRI; //导入方法依赖的package包/类
private void printOWLObject(OWLObject obj, String del) {
String id;
if (obj instanceof OWLNamedObject) {
IRI iri = ((OWLNamedObject)obj).getIRI();
if (iri.getFragment() != null) {
id = iri.getFragment();
}
else {
id = iri.toString();
id = id.replaceAll(".*/", "");
}
}
else {
/*
if (obj instanceof OWLObjectIntersectionOf) {
s.print("and");
for (OWLClassExpression sx : ((OWLObjectIntersectionOf)x).getOperands()) {
printX(s, sx, depth+1);
}
}
else if (x instanceof OWLObjectUnionOf) {
s.print("or");
for (OWLClassExpression sx : ((OWLObjectUnionOf)x).getOperands()) {
printX(s, sx, depth+1);
}
}
else if (x instanceof OWLQuantifiedRestriction) {
OWLQuantifiedRestriction qr = (OWLQuantifiedRestriction)x;
s.print(qr.getProperty().toString()+" "+qr.getClassExpressionType());
printX(s, qr.getFiller(), depth+1);
}
*/
// todo - show class expressions
id = obj.toString();
}
printStream.print(id);
String label = graph.getLabel(obj);
if (label == null) {
label = "";
}
printStream.print(del);
printStream.print("\'"+label+"\'");
}
示例14: OwlSimVarianceEntityReferenceNotFoundException
import org.semanticweb.owlapi.model.IRI; //导入方法依赖的package包/类
public OwlSimVarianceEntityReferenceNotFoundException(IRI referenceEntity) {
super("Reference entity does not exist: " + referenceEntity.toString());
}
示例15: nodeId
import org.semanticweb.owlapi.model.IRI; //导入方法依赖的package包/类
private CharSequence nodeId(IRI iri) {
String iriString = iri.toString();
return quote(iriString);
}