本文整理汇总了Java中com.hp.hpl.jena.ontology.OntResource类的典型用法代码示例。如果您正苦于以下问题:Java OntResource类的具体用法?Java OntResource怎么用?Java OntResource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OntResource类属于com.hp.hpl.jena.ontology包,在下文中一共展示了OntResource类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: addSinglePropertyFromTypeRemembrance
import com.hp.hpl.jena.ontology.OntResource; //导入依赖的package包/类
private void addSinglePropertyFromTypeRemembrance(Resource r, OntProperty p, String literalString, TypeVO typeremembrance,IFCVO ivo) throws IOException, IfcDataFormatException {
OntResource range = ontModel.getOntResource(getOntNS() + typeremembrance.getName());
if (range.isClass()) {
if (range.asClass().hasSuperClass(expressModel.getOntClass(getExpressns() + "ENUMERATION"))) {
// Check for ENUM
addEnumProperty(r, p, range, literalString,ivo);
} else if (range.asClass().hasSuperClass(expressModel.getOntClass(getExpressns() + "SELECT"))) {
// Check for SELECT
// if (logToFile)
// bw.write("*OK 24*: found subClass of SELECT Class, now doing nothing with it: " + p + " - " + range.getLocalName() + " - " + literalString + "\r\n");
createLiteralProperty(r, p, range, literalString,ivo);
} else if (range.asClass().hasSuperClass(listModel.getOntClass(getListns() + "OWLList"))) {
// Check for LIST
throw IfcDataFormatException.valueOutOfRange("#"+ivo.getLineNum(),literalString,range.getLocalName());
} else {
createLiteralProperty(r, p, range, literalString,ivo);
}
} else {
LOGGER.log(Level.WARNING ,"found other kind of property: " + p + " - " + range.getLocalName() + "\r\n");
}
}
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:24,代码来源:RDFWriter.java
示例2: fillClassInstanceList
import com.hp.hpl.jena.ontology.OntResource; //导入依赖的package包/类
private void fillClassInstanceList(LinkedList<Object> tmpList, OntResource typerange, OntProperty p, Resource r) throws IOException, IfcDataFormatException {
List<Resource> reslist = new ArrayList<Resource>();
List<IFCVO> entlist = new ArrayList<IFCVO>();
// createrequirednumberofresources
for (int i = 0; i < tmpList.size(); i++) {
if (IFCVO.class.isInstance(tmpList.get(i))) {
Resource r1 = getResource(getBaseURI() + createLocalName(typerange.getLocalName() + "_" + IDcounter), typerange);
reslist.add(r1);
IDcounter++;
entlist.add((IFCVO) tmpList.get(i));
if (i == 0) {
getRdfWriter().triple(new Triple(r.asNode(), p.asNode(), r1.asNode()));
}
}
}
// bindtheproperties
String listvaluepropURI = getOntNS() + typerange.getLocalName().substring(0, typerange.getLocalName().length() - 5);
OntResource listrange = ontModel.getOntResource(listvaluepropURI);
addClassInstanceListProperties(reslist, entlist, listrange);
}
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:24,代码来源:RDFWriter.java
示例3: getListContentType
import com.hp.hpl.jena.ontology.OntResource; //导入依赖的package包/类
private OntResource getListContentType(OntClass range) throws IOException {
if (range.asClass().getURI().equalsIgnoreCase(getExpressns() + "STRING_List") || range.asClass().hasSuperClass(expressModel.getOntClass(getExpressns() + "STRING_List")))
return expressModel.getOntResource(getExpressns() + "STRING");
else if (range.asClass().getURI().equalsIgnoreCase(getExpressns() + "REAL_List") || range.asClass().hasSuperClass(expressModel.getOntClass(getExpressns() + "REAL_List")))
return expressModel.getOntResource(getExpressns() + "REAL");
else if (range.asClass().getURI().equalsIgnoreCase(getExpressns() + "INTEGER_List") || range.asClass().hasSuperClass(expressModel.getOntClass(getExpressns() + "INTEGER_List")))
return expressModel.getOntResource(getExpressns() + "INTEGER");
else if (range.asClass().getURI().equalsIgnoreCase(getExpressns() + "BINARY_List") || range.asClass().hasSuperClass(expressModel.getOntClass(getExpressns() + "BINARY_List")))
return expressModel.getOntResource(getExpressns() + "BINARY");
else if (range.asClass().getURI().equalsIgnoreCase(getExpressns() + "BOOLEAN_List") || range.asClass().hasSuperClass(expressModel.getOntClass(getExpressns() + "BOOLEAN_List")))
return expressModel.getOntResource(getExpressns() + "BOOLEAN");
else if (range.asClass().getURI().equalsIgnoreCase(getExpressns() + "LOGICAL_List") || range.asClass().hasSuperClass(expressModel.getOntClass(getExpressns() + "LOGICAL_List")))
return expressModel.getOntResource(getExpressns() + "LOGICAL");
else if (range.asClass().getURI().equalsIgnoreCase(getExpressns() + "NUMBER_List") || range.asClass().hasSuperClass(expressModel.getOntClass(getExpressns() + "NUMBER_List")))
return expressModel.getOntResource(getExpressns() + "NUMBER");
else if (range.asClass().hasSuperClass(listModel.getOntClass(getListns() + "OWLList"))) {
String listvaluepropURI = getOntNS() + range.getLocalName().substring(0, range.getLocalName().length() - 5);
return ontModel.getOntResource(listvaluepropURI);
} else {
LOGGER.log(Level.WARNING,"did not find listcontenttype for : " + range.getLocalName() + "\r\n");
return null;
}
}
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:26,代码来源:RDFWriter.java
示例4: getXSDTypeFromRange
import com.hp.hpl.jena.ontology.OntResource; //导入依赖的package包/类
private String getXSDTypeFromRange(OntResource range) {
if (range.asClass().getURI().equalsIgnoreCase(getExpressns() + "STRING") || range.asClass().hasSuperClass(expressModel.getOntClass(getExpressns() + "STRING")))
return "string";
else if (range.asClass().getURI().equalsIgnoreCase(getExpressns() + "REAL") || range.asClass().hasSuperClass(expressModel.getOntClass(getExpressns() + "REAL")))
return "double";
else if (range.asClass().getURI().equalsIgnoreCase(getExpressns() + "INTEGER") || range.asClass().hasSuperClass(expressModel.getOntClass(getExpressns() + "INTEGER")))
return "integer";
else if (range.asClass().getURI().equalsIgnoreCase(getExpressns() + "BINARY") || range.asClass().hasSuperClass(expressModel.getOntClass(getExpressns() + "BINARY")))
return "hexBinary";
else if (range.asClass().getURI().equalsIgnoreCase(getExpressns() + "BOOLEAN") || range.asClass().hasSuperClass(expressModel.getOntClass(getExpressns() + "BOOLEAN")))
return "boolean";
else if (range.asClass().getURI().equalsIgnoreCase(getExpressns() + "LOGICAL") || range.asClass().hasSuperClass(expressModel.getOntClass(getExpressns() + "LOGICAL")))
return "logical";
else if (range.asClass().getURI().equalsIgnoreCase(getExpressns() + "NUMBER") || range.asClass().hasSuperClass(expressModel.getOntClass(getExpressns() + "NUMBER")))
return "double";
else
return null;
}
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:19,代码来源:RDFWriter.java
示例5: Linkset
import com.hp.hpl.jena.ontology.OntResource; //导入依赖的package包/类
public Linkset(Void voidInstance, Datasets datasets, OntResource linkset,
OntResource sparqlEndPoint, OntResource linkPredicate,
OntResource subjectsDataset, OntResource subjectsTarget,
OntResource subjectsClass, OntResource objectsDataset,
OntResource objectsTarget, OntResource objectsClass) {
super(voidInstance, linkset, sparqlEndPoint);
this.linkPredicate = linkPredicate;
this.subjectsDataset = datasets.getDataset(subjectsDataset);
this.subjectsTarget = subjectsTarget;
this.subjectsClass = subjectsClass;
this.objectsDataset = datasets.getDataset(objectsDataset);
this.objectsTarget = objectsTarget;
this.objectsClass = objectsClass;
loadVocabularies();
}
开发者ID:peterjohnlawrence,项目名称:com.inova8.remediator,代码行数:18,代码来源:Linkset.java
示例6: loadVocabularies
import com.hp.hpl.jena.ontology.OntResource; //导入依赖的package包/类
@Override
public void loadVocabularies() {
QuerySolutionMap binding = new QuerySolutionMap();
binding.add("linkset", this.dataset);
Query query = QueryFactory.create(linksetVocabularyQuery);
QueryExecution qexec = QueryExecutionFactory.create(query, voidInstance.getVoidModel(),
binding);
try {
ResultSet results = qexec.execSelect();
for (; results.hasNext();) {
QuerySolution soln = results.nextSolution();
OntResource vocabulary = soln.getResource("vocabulary").as(
OntResource.class);
vocabularies.add(vocabulary);
}
} catch (Exception e) {
Log.debug(Linkset.class, "Failed linksetVocabularyQuery");
Log.debug(Linkset.class, e.getStackTrace().toString());
} finally {
qexec.close();
}
}
开发者ID:peterjohnlawrence,项目名称:com.inova8.remediator,代码行数:26,代码来源:Linkset.java
示例7: checkObjectPropertyRange
import com.hp.hpl.jena.ontology.OntResource; //导入依赖的package包/类
public boolean checkObjectPropertyRange(OntModel theJenaModel2, OntProperty pred, OntResource obj, boolean isList, EObject expr) throws CircularDependencyException {
if (pred.isObjectProperty()) {
if (checkRangeForMatch(theJenaModel2, pred, obj, isList)) {
return true;
}
ExtendedIterator<? extends OntProperty> propitr = pred.listSuperProperties(false);
while (propitr.hasNext()) {
OntProperty sprop = propitr.next();
if (checkRangeForMatch(theJenaModel2, sprop, obj, isList)) {
propitr.close();
return true;
}
}
return false;
}
return true;
}
开发者ID:crapo,项目名称:sadlos2,代码行数:18,代码来源:JenaBasedSadlModelValidator.java
示例8: addUnittedQuantityAsInstancePropertyValue
import com.hp.hpl.jena.ontology.OntResource; //导入依赖的package包/类
private void addUnittedQuantityAsInstancePropertyValue(Individual inst, OntProperty oprop, OntResource rng,
String literalNumber, String unit) {
Individual unittedVal;
if (rng != null && rng.canAs(OntClass.class)) {
unittedVal = getTheJenaModel().createIndividual(rng.as(OntClass.class));
} else {
unittedVal = getTheJenaModel().createIndividual(
getTheJenaModel().getOntClass(SadlConstants.SADL_IMPLICIT_MODEL_UNITTEDQUANTITY_URI));
}
// TODO this may need to check for property restrictions on a subclass of
// UnittedQuantity
unittedVal.addProperty(getTheJenaModel().getProperty(SadlConstants.SADL_IMPLICIT_MODEL_VALUE_URI),
getTheJenaModel().createTypedLiteral(literalNumber));
unittedVal.addProperty(getTheJenaModel().getProperty(SadlConstants.SADL_IMPLICIT_MODEL_UNIT_URI),
getTheJenaModel().createTypedLiteral(unit));
inst.addProperty(oprop, unittedVal);
}
开发者ID:crapo,项目名称:sadlos2,代码行数:18,代码来源:JenaBasedSadlModelProcessor.java
示例9: loadPropertyPartitionStatistics
import com.hp.hpl.jena.ontology.OntResource; //导入依赖的package包/类
public void loadPropertyPartitionStatistics(OntModel voidModel) {
Query query = QueryFactory.create(propertyPartitionStatisticsQuery);
QueryExecution qexec = QueryExecutionFactory.create(query, voidModel);
try {
ResultSet results = qexec.execSelect();
for (; results.hasNext();) {
QuerySolution soln = results.nextSolution();
OntResource dataset = soln.getResource("Dataset").as(
OntResource.class);
OntResource property = soln.getResource("Property").as(
OntResource.class);
Integer triples = (soln.getLiteral("Triples") != null) ? soln
.getLiteral("Triples").getInt() : null;
Dataset ds = this.getDataset(dataset);
if (ds!=null)ds.getPartitions().addPropertyPartition(property, triples);
}
} catch (Exception e) {
Log.debug(
this,
"Unable to execute propertyPartitionStatisticsQuery " + query);
} finally {
qexec.close();
}
}
开发者ID:peterjohnlawrence,项目名称:com.inova8.remediator,代码行数:26,代码来源:Datasets.java
示例10: loadVocabularies
import com.hp.hpl.jena.ontology.OntResource; //导入依赖的package包/类
public void loadVocabularies() {
QuerySolutionMap binding = new QuerySolutionMap();
binding.add("dataset", dataset);
Query query = QueryFactory.create(datasetVocabularyQuery);
QueryExecution qexec = QueryExecutionFactory.create(query, voidInstance.getVoidModel(),
binding);
try {
ResultSet results = qexec.execSelect();
for (; results.hasNext();) {
QuerySolution soln = results.nextSolution();
OntResource vocabulary = soln.getResource("vocabulary").as(
OntResource.class);
vocabularies.add(vocabulary);
}
} catch (Exception e) {
Log.debug(Dataset.class, "Failed datasetVocabularyQuery");
Log.debug(Dataset.class, e.getStackTrace().toString());
} finally {
qexec.close();
}
}
开发者ID:peterjohnlawrence,项目名称:com.inova8.remediator,代码行数:25,代码来源:Dataset.java
示例11: updatePartitions
import com.hp.hpl.jena.ontology.OntResource; //导入依赖的package包/类
public void updatePartitions() {
//Use OntModelSpec.OWL_MEM_RDFS_INF to ensure all default classes and properties are also discovered.
OntModelSpec partitionModelSpec = new OntModelSpec(OntModelSpec.OWL_MEM_RDFS_INF);
partitionModelSpec.setDocumentManager(voidInstance.getVoidModel().getDocumentManager());
partitionModelSpec.getDocumentManager().setProcessImports(true);
OntModel partitionModel = ModelFactory
.createOntologyModel(partitionModelSpec);
for (OntResource vocabulary : this.getVocabularies()) {
try {
partitionModel.read(vocabulary.getURI());
} catch (Exception e) {
Log.debug(Void.class, "Failed to locate dataset vocabulary: "
+ vocabulary + " " + e.getMessage());
}
}
updateClassPartition(partitionModel);
updatePropertyPartition(partitionModel);
}
开发者ID:peterjohnlawrence,项目名称:com.inova8.remediator,代码行数:21,代码来源:Dataset.java
示例12: 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();
}
}
开发者ID:peterjohnlawrence,项目名称:com.inova8.remediator,代码行数:20,代码来源:Dataset.java
示例13: queryClassPartitionStatistics
import com.hp.hpl.jena.ontology.OntResource; //导入依赖的package包/类
private void queryClassPartitionStatistics() {
Query query = QueryFactory.create(classPartitionStatisticsQuery);
QueryExecution qexec = QueryExecutionFactory.sparqlService(
this.sparqlEndPoint.toString(), query);
try {
ResultSet results = qexec.execSelect();
for (; results.hasNext();) {
QuerySolution soln = results.nextSolution();
OntResource clazz = soln.getResource("class").as(
OntResource.class);
Integer entities = (soln.getLiteral("count") != null) ? soln
.getLiteral("count").getInt() : null;
partitions.addClassPartition(clazz, entities);
}
} catch (Exception e) {
Log.debug(
Dataset.class,
"Unable to connect to SPARQLEndpoint to execute classPartitionStatisticsQuery: "
+ this.sparqlEndPoint.toString());
} finally {
qexec.close();
}
}
开发者ID:peterjohnlawrence,项目名称:com.inova8.remediator,代码行数:25,代码来源:Dataset.java
示例14: updatePropertyPartition
import com.hp.hpl.jena.ontology.OntResource; //导入依赖的package包/类
protected void updatePropertyPartition(OntModel partitionModel) {
Query query = QueryFactory.create(propertyPartitionQuery);
QueryExecution qexec = QueryExecutionFactory.create(query,
partitionModel);
try {
ResultSet results = qexec.execSelect();
for (; results.hasNext();) {
QuerySolution soln = results.nextSolution();
OntResource property = soln.getResource("property").as(
OntResource.class);
partitions.addPropertyPartition(property, null);
}
} catch (Exception e) {
Log.debug(Dataset.class,
"Failed to execute to execute propertyPartitionQuery");
} finally {
qexec.close();
}
}
开发者ID:peterjohnlawrence,项目名称:com.inova8.remediator,代码行数:21,代码来源:Dataset.java
示例15: checkPreviousClassList
import com.hp.hpl.jena.ontology.OntResource; //导入依赖的package包/类
private static List<OntResource> checkPreviousClassList(List<OntResource> previousClasses, OntClass cls) throws CircularDependencyException {
if (previousClasses.contains(cls)) {
StringBuilder msg = new StringBuilder("Cycle encountered while checking subclasses of ");
msg.append(previousClasses.get(0).toString());
int loopstart = previousClasses.indexOf(cls);
msg.append(" (loop contains: ");
for (int i = loopstart; i < previousClasses.size(); i++) {
if (i > loopstart) msg.append(", ");
msg.append(previousClasses.get(i).toString());
}
msg.append(")");
throw new CircularDependencyException(msg.toString());
}
previousClasses.add(cls);
return previousClasses;
}
开发者ID:crapo,项目名称:sadlos2,代码行数:17,代码来源:SadlUtils.java
示例16: updateRdfsLabel
import com.hp.hpl.jena.ontology.OntResource; //导入依赖的package包/类
@Override
public boolean updateRdfsLabel(String modelName, String uri, String label, String language) throws IOException, ConfigurationException, InvalidNameException, URISyntaxException {
OntModel ontModel = getOntModelForEditing(modelName);
boolean retval = false;
if (ontModel != null) {
OntResource rsrc = ontModel.getOntResource(uri);
if (rsrc == null) {
throw new InvalidNameException("'" + uri + "' was not found in model '" + modelName + "'");
}
String lbl = rsrc.getLabel(language);
if (lbl != null) {
if (!lbl.equals(label)) {
rsrc.removeLabel(lbl, language);
retval = true;
}
}
rsrc.addLabel(label, language);
}
return retval;
}
开发者ID:crapo,项目名称:sadlos2,代码行数:21,代码来源:SadlServerPEImpl.java
示例17: getImports
import com.hp.hpl.jena.ontology.OntResource; //导入依赖的package包/类
public synchronized Map<String, String> getImports(String publicUri, Scope scope) throws ConfigurationException, IOException {
OntModel theModel = getOntModel(publicUri, scope);
if (theModel != null) {
Ontology onto = theModel.getOntology(publicUri);
if (onto != null) {
ExtendedIterator<OntResource> importsItr = onto.listImports();
if (importsItr.hasNext()) {
Map<String, String> map = new HashMap<String, String>();
while (importsItr.hasNext()) {
OntResource or = importsItr.next();
String importUri = or.toString();
String prefix = theModel.getNsURIPrefix(importUri);
if (prefix == null) {
prefix = getGlobalPrefix(importUri);
}
logger.debug("Ontology of model '" + publicUri + "' has import '" + importUri + "' with prefix '" + prefix + "'");
if (!map.containsKey(importUri)) {
map.put(importUri, prefix);
}
}
return map;
}
}
}
return Collections.emptyMap();
}
开发者ID:crapo,项目名称:sadlos2,代码行数:27,代码来源:ConfigurationManagerForIDE.java
示例18: initializeAllExpandedPropertyClasses
import com.hp.hpl.jena.ontology.OntResource; //导入依赖的package包/类
protected int initializeAllExpandedPropertyClasses() {
int cntr = 0;
allExpandedPropertyClasses = new ArrayList<OntResource>();
StmtIterator sitr = getTheJenaModel().listStatements(null,
getTheJenaModel().getProperty(SadlConstants.SADL_IMPLICIT_MODEL_EXPANDED_PROPERTY_URI), (RDFNode) null);
if (sitr.hasNext()) {
while (sitr.hasNext()) {
com.hp.hpl.jena.rdf.model.Resource subj = sitr.nextStatement().getSubject();
if (subj.canAs(OntResource.class)) {
OntResource or = subj.as(OntResource.class);
if (addExpandedPropertyClass(or)) {
cntr++;
}
}
}
}
return cntr;
}
开发者ID:crapo,项目名称:sadlos2,代码行数:19,代码来源:JenaBasedSadlModelProcessor.java
示例19: getListType
import com.hp.hpl.jena.ontology.OntResource; //导入依赖的package包/类
private ConceptName getListType(TypeCheckInfo tci) throws TranslationException, InvalidTypeException {
Node tct = tci.getTypeCheckType();
if (tct != null) {
if (tct instanceof NamedNode) {
try {
OntResource cls = theJenaModel.getOntResource(((NamedNode)tct).toFullyQualifiedString());
if (tci.getTypeToExprRelationship().equals(RANGE) || tci.getTypeToExprRelationship().equals(RESTRICTED_TO)) {
if (cls.isURIResource()) {
// return new ConceptName(cls.getURI());
return getModelProcessor().namedNodeToConceptName((NamedNode) tct);
}
}
if (cls != null && cls.canAs(OntClass.class)){
ConceptName listcn = getListClassType(cls);
if (listcn != null) {
return listcn;
}
}
} catch (InvalidNameException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
return null;
}
开发者ID:crapo,项目名称:sadlos2,代码行数:27,代码来源:JenaBasedSadlModelValidator.java
示例20: 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;
}
开发者ID:crapo,项目名称:sadlos2,代码行数:18,代码来源:ModelManager.java
注:本文中的com.hp.hpl.jena.ontology.OntResource类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论