本文整理汇总了Java中com.hp.hpl.jena.ontology.OntResource.isAnon方法的典型用法代码示例。如果您正苦于以下问题:Java OntResource.isAnon方法的具体用法?Java OntResource.isAnon怎么用?Java OntResource.isAnon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.hp.hpl.jena.ontology.OntResource
的用法示例。
在下文中一共展示了OntResource.isAnon方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateClassPartition
import com.hp.hpl.jena.ontology.OntResource; //导入方法依赖的package包/类
private void updateClassPartition(OntModel partitionModel) {
Query query = QueryFactory.create(classPartitionQuery);
QueryExecution qexec = QueryExecutionFactory.create(query,
partitionModel);
try {
ResultSet results = qexec.execSelect();
for (; results.hasNext();) {
QuerySolution soln = results.nextSolution();
OntResource clazz = soln.getResource("class").as(
OntResource.class);
if (!clazz.isAnon()) partitions.addClassPartition(clazz, null);
}
} catch (Exception e) {
Log.debug(Dataset.class, "Failed to execute classPartitionQuery");
} finally {
qexec.close();
}
}
示例2: addValidationWarning
import com.hp.hpl.jena.ontology.OntResource; //导入方法依赖的package包/类
private void addValidationWarning(OntResource instance, OntResource clss,
String msg) {
if (!instance.isAnon()) {
ConceptName valcn = new ConceptName(
((OntResource) instance).getLocalName());
valcn.setNamespace(((OntResource) instance).getNameSpace());
PendingModelError pe = getPendingError(valcn,
ConceptType.INDIVIDUAL);
if (pe != null) {
// add an additional check to the PendingModelError to make sure
// it
AdditionalCheck addChk = pe.new AdditionalCheck(instance, clss,
msg, ErrorType.WARNING);
pe.addAdditionalCheck(addChk);
return;
}
}
addError(new ModelError((instance.isURIResource() ? instance.getLocalName() : "<unnamed>") + " " + msg,
ErrorType.WARNING));
}
示例3: getDomain
import com.hp.hpl.jena.ontology.OntResource; //导入方法依赖的package包/类
public Object getDomain(ConceptName prop) {
OntProperty pr = getOntProperty(prop);
OntResource rr = getDomain(pr);
if (rr != null) {
if (rr.isURIResource()) {
return rr.getURI();
}
else if (rr.isAnon()) {
List<ConceptName> rngClasses = findAllUriResourcesInAnon(rr);
return rngClasses;
}
else {
addError(new ModelError("Unexpected range class: " + rr.toString(), ErrorType.ERROR));
}
}
return null;
}
示例4: getRange
import com.hp.hpl.jena.ontology.OntResource; //导入方法依赖的package包/类
public Object getRange(ConceptName prop) {
OntProperty pr = getOntProperty(prop);
OntResource rr = getRange(pr);
if (rr != null) {
if (rr.isURIResource()) {
return rr.getURI();
}
else if (rr.isAnon()) {
List<ConceptName> rngClasses = findAllUriResourcesInAnon(rr);
return rngClasses;
}
else {
addError(new ModelError("Unexpected range class: " + rr.toString(), ErrorType.ERROR));
}
}
return null;
}
示例5: getObjectPropertyRange
import com.hp.hpl.jena.ontology.OntResource; //导入方法依赖的package包/类
/**
* Method to find a named class in the range of the given property.
*
* @param propName
* @return
* @throws ConfigurationException
*/
public ConceptName getObjectPropertyRange(ConceptName propName) throws ConfigurationException {
Resource pr = getOntResourceInExistingModel(propName);
if (pr != null && pr.canAs(OntProperty.class)) {
OntProperty opr = pr.as(OntProperty.class);
OntResource rr = getRange(opr);
if (rr != null) {
if (rr.isAnon()) {
rr = findUriResourceInAnon(rr);
}
if (rr != null) {
ConceptName rcn = new ConceptName(rr.getLocalName());
rcn.setNamespace(rr.getNameSpace());
rcn.setType(ConceptType.OBJECTPROPERTY);
return rcn;
}
}
}
return null;
}
示例6: rangeToString
import com.hp.hpl.jena.ontology.OntResource; //导入方法依赖的package包/类
private String rangeToString(OntProperty prop) {
ExtendedIterator<? extends OntResource> ritr = prop.listRange();
String rng = "";
int cnt = 0;
while (ritr.hasNext()) {
OntResource rngNode = ritr.next();
if (!rngNode.isAnon() && rngNode.getNameSpace().equals(XSD.getURI())) {
rng += rngNode.getLocalName();
}
else if (rngNode.canAs(OntClass.class)) {
rng += ontClassToString((OntClass)rngNode.as(OntClass.class), null);
}
else {
rng += rngNode.toString();
}
cnt++;
}
if (cnt > 1) {
rng = "{" + rng + "}";
}
return rng;
}
示例7: shouldResourceBeOutput
import com.hp.hpl.jena.ontology.OntResource; //导入方法依赖的package包/类
protected boolean shouldResourceBeOutput(OntResource rsrc, boolean bThisModelOnly, boolean includeProcessed, boolean includeAnon) {
if (rsrc.isAnon() && !includeAnon) {
return false;
}
// if (!includeProcessed && resourcesOutput.contains(rsrc)) {
// return false;
// }
if (! rsrc.isAnon() && ignoreNamespace(rsrc, bThisModelOnly)) {
return false;
}
if (!theModel.getBaseModel().containsResource(rsrc)) {
return false;
}
if (rsrc.getRDFType() == null) {
return false;
}
return true;
}
示例8: extractOntologicalResourceURIs
import com.hp.hpl.jena.ontology.OntResource; //导入方法依赖的package包/类
private List<String> extractOntologicalResourceURIs(final ExtendedIterator<? extends OntResource> iterator) {
try {
final List<String> uris=Lists.newLinkedList();
while(iterator.hasNext()) {
final OntResource resource = iterator.next();
if(!resource.isAnon()) {
uris.add(resource.getURI());
}
}
return uris;
} finally {
iterator.close();
}
}
示例9: getLiteralMatchingDataPropertyRange
import com.hp.hpl.jena.ontology.OntResource; //导入方法依赖的package包/类
/**
* Call this method to convert a value (v) as a Java object to a typed
* Literal matching the range of the property.
*
* @param m
* @param prop
* @param v
* @return
* @throws CircularDependencyException
*/
public static synchronized Literal getLiteralMatchingDataPropertyRange(OntModel m, OntProperty prop, Object v) throws TranslationException {
Literal val = null;
String errMsg = null;
if (prop == null || prop.isAnnotationProperty()) {
return m.createTypedLiteral(v);
}
// SADL only has DoubleLiterals--if this property has range float convert v to Float.
OntResource rng = prop.getRange();
String rnguri = rng != null ? rng.getURI() : null;
if (rng == null) {
errMsg = "Range not given.";
}
else if (rng.isAnon()) {
// this is a complex range--needs work. Try to do something with it....
// If value is a String
if (v instanceof String) {
v = stripQuotes((String)v);
val = m.createTypedLiteral(v);
}
else {
val = m.createTypedLiteral(v);
if (val == null) {
errMsg = "Range is an unsupported complex type, failed to create a Literal value for '" + v.toString() + "'.";
}
}
}
else {
val = getLiteralMatchingDataPropertyRange(m, rnguri, v);
}
if (errMsg != null) {
errMsg += " (Property is '" + prop.getLocalName() + "'.)";
throw new TranslationException(errMsg);
}
return val;
}
示例10: getLiteralMatchingDataPropertyRange
import com.hp.hpl.jena.ontology.OntResource; //导入方法依赖的package包/类
/**
* Call this method to convert a value (v) as a Java object to a typed
* Literal matching the range of the property.
*
* @param m
* @param prop
* @param v
* @return
* @throws Exception
*/
public static synchronized Literal getLiteralMatchingDataPropertyRange(OntModel m, OntProperty prop, Object v) throws Exception {
Literal val = null;
String errMsg = null;
if (prop.isAnnotationProperty()) {
return m.createTypedLiteral(v);
}
// SADL only has DoubleLiterals--if this property has range float convert v to Float.
OntResource rng = prop.getRange();
String rnguri = rng != null ? rng.getURI() : null;
if (rng == null) {
errMsg = "Range not given.";
}
else if (rng.isAnon()) {
// this is a complex range--needs work. Try to do something with it....
// If value is a String
if (v instanceof String) {
v = stripQuotes((String)v);
val = m.createTypedLiteral(v);
}
else {
val = m.createTypedLiteral(v);
if (val == null) {
errMsg = "Range is an unsupported complex type, failed to create a Literal value for '" + v.toString() + "'.";
}
}
}
else {
val = getLiteralMatchingDataPropertyRange(m, rnguri, v);
}
if (errMsg != null) {
errMsg += " (Property is '" + prop.getLocalName() + "'.)";
throw new Exception(errMsg);
}
return val;
}