当前位置: 首页>>代码示例>>Java>>正文


Java IRI.toString方法代码示例

本文整理汇总了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();
		}
	}
}
 
开发者ID:geneontology,项目名称:minerva,代码行数:24,代码来源:BlazegraphMolecularModelManager.java

示例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;
}
 
开发者ID:geneontology,项目名称:minerva,代码行数:25,代码来源:MappedCurieHandler.java

示例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};
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:18,代码来源:Similarity.java

示例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;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:22,代码来源:AbstractSimPreProcessor.java

示例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;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:22,代码来源:PropertyViewOntologyBuilder.java

示例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();
}
 
开发者ID:WestCoastInformatics,项目名称:UMLS-Terminology-Server,代码行数:20,代码来源:OwlApiClassifier.java

示例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;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:8,代码来源:ImportClosureSlurper.java

示例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;
	}
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:16,代码来源:NCBIConverter.java

示例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() + ">)";
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:10,代码来源:NCBI2OWLTest.java

示例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();
}
 
开发者ID:dratc,项目名称:owl2diagram,代码行数:10,代码来源:OWLDiagramRenderer.java

示例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;
}
 
开发者ID:onprom,项目名称:onprom,代码行数:6,代码来源:OWLUtility.java

示例12: convert

import org.semanticweb.owlapi.model.IRI; //导入方法依赖的package包/类
@SuppressWarnings("static-method")
public ElkIri convert(IRI iri) {
	return new ElkFullIri(iri.toString());
}
 
开发者ID:liveontologies,项目名称:elk-reasoner,代码行数:5,代码来源:OwlConverter.java

示例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+"\'");		
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:45,代码来源:Reporter.java

示例14: OwlSimVarianceEntityReferenceNotFoundException

import org.semanticweb.owlapi.model.IRI; //导入方法依赖的package包/类
public OwlSimVarianceEntityReferenceNotFoundException(IRI referenceEntity) {
	super("Reference entity does not exist: " + referenceEntity.toString());
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:4,代码来源:OwlSimVarianceEntityReferenceNotFoundException.java

示例15: nodeId

import org.semanticweb.owlapi.model.IRI; //导入方法依赖的package包/类
private CharSequence nodeId(IRI iri) {
	String iriString = iri.toString();
	return quote(iriString);
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:5,代码来源:ImportChainDotWriter.java


注:本文中的org.semanticweb.owlapi.model.IRI.toString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。