本文整理汇总了Java中com.hp.hpl.jena.ontology.OntProperty.listDomain方法的典型用法代码示例。如果您正苦于以下问题:Java OntProperty.listDomain方法的具体用法?Java OntProperty.listDomain怎么用?Java OntProperty.listDomain使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.hp.hpl.jena.ontology.OntProperty
的用法示例。
在下文中一共展示了OntProperty.listDomain方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generatePropertyNeighborhood
import com.hp.hpl.jena.ontology.OntProperty; //导入方法依赖的package包/类
public ResultSet generatePropertyNeighborhood(int size) throws ConfigurationException {
OntProperty ontprop = mmgr.getOntResourceInExistingModel(anchor).as(OntProperty.class);
List<GraphSegment> data = new ArrayList<GraphSegment>();
ExtendedIterator<? extends OntResource> eitr = ontprop.listDomain();
while (eitr.hasNext()) {
OntResource dmn = eitr.next();
if (dmn.canAs(OntClass.class)){
data = generatePropertyRange(dmn.as(OntClass.class), ontprop, data);
}
data = generateClassPropertiesWithRange(dmn.as(OntClass.class), data);
}
// ExtendedIterator<? extends OntResource> eitr2 = ontprop.listRange();
// while (eitr2.hasNext()) {
// OntResource rng = eitr2.next();
// if (ontprop.as(OntProperty.class).isObjectProperty()) {
// data = generateClassPropertiesWithDomain(rng.as(OntClass.class), data);
// }
// }
return convertDataToResultSet(data);
}
示例2: generateClassPropertiesWithRange
import com.hp.hpl.jena.ontology.OntProperty; //导入方法依赖的package包/类
private List<GraphSegment> generateClassPropertiesWithRange(OntClass cls,
List<GraphSegment> data) {
StmtIterator sitr = model.listStatements(null, RDFS.range, cls);
while (sitr.hasNext()) {
Statement stmt = sitr.nextStatement();
Resource prop = stmt.getSubject();
if (prop.canAs(OntProperty.class)) {
OntProperty ontprop = prop.as(OntProperty.class);
ExtendedIterator<? extends OntResource> eitr = ontprop.listDomain();
while (eitr.hasNext()) {
OntResource dmn = eitr.next();
GraphSegment sg = new GraphSegment(dmn, prop, cls);
if (!data.contains(sg)) {
data.add(sg);
data = generateClassPropertiesWithRange(dmn.as(OntClass.class), data);
}
}
}
}
return data;
}
示例3: generatePropertyNeighborhood
import com.hp.hpl.jena.ontology.OntProperty; //导入方法依赖的package包/类
public ResultSet generatePropertyNeighborhood(int size) throws ConfigurationException, InvalidNameException {
OntProperty ontprop = getTheJenaModelWithImports().getOntProperty(getAnchor().toFQString());
List<GraphSegment> data = new ArrayList<GraphSegment>();
ExtendedIterator<? extends OntResource> eitr = ontprop.listDomain();
while (eitr.hasNext()) {
isCanceled();
OntResource dmn = eitr.next();
if (dmn.canAs(OntClass.class)){
data = generatePropertyRange(dmn.as(OntClass.class), -1, ontprop, size, true, data);
}
data = generateClassPropertiesWithRange(dmn.as(OntClass.class), size - 1, data);
}
// ExtendedIterator<? extends OntResource> eitr2 = ontprop.listRange();
// while (eitr2.hasNext()) {
// OntResource rng = eitr2.next();
// if (ontprop.as(OntProperty.class).isObjectProperty()) {
// data = generateClassPropertiesWithDomain(rng.as(OntClass.class), data);
// }
// }
return convertDataToResultSet(data, uriStrategy, modelUri);
}
示例4: exploreProperty
import com.hp.hpl.jena.ontology.OntProperty; //导入方法依赖的package包/类
private void exploreProperty(OntProperty prop) {
logger.debug("Exploring property '" + prop.getURI() + "':");
ExtendedIterator<? extends OntResource> eitr = prop.listDomain();
logger.debug(" Domain:");
while (eitr.hasNext()) {
OntResource dr = eitr.next();
logger.debug(" " + classToString(dr));
}
eitr = prop.listRange();
logger.debug(" Range:");
while (eitr.hasNext()) {
OntResource rr = eitr.next();
logger.debug(" " + classToString(rr));
}
}
示例5: generateClassPropertiesWithRange
import com.hp.hpl.jena.ontology.OntProperty; //导入方法依赖的package包/类
private List<GraphSegment> generateClassPropertiesWithRange(OntClass cls, int graphRadius,
List<GraphSegment> data) {
if (graphRadius <= 0) return data;
StmtIterator sitr = getTheJenaModelWithImports().listStatements(null, RDFS.range, cls);
while (sitr.hasNext()) {
Statement stmt = sitr.nextStatement();
Resource prop = stmt.getSubject();
if (prop.canAs(OntProperty.class)) {
OntProperty ontprop = prop.as(OntProperty.class);
ExtendedIterator<? extends OntResource> eitr = ontprop.listDomain();
while (eitr.hasNext()) {
OntResource dmn = eitr.next();
GraphSegment sg = new GraphSegment(getModelUri(), dmn, prop, cls, configMgr);
if (dmn.isClass()) {
annotateHeadAsClass(sg);
}
else if (dmn.isIndividual()) {
annotateHeadAsIndividual(sg);
}
annotateEdge(sg, PROPERTY_GREEN, null, null);
annotateTailAsClass(sg);
if (!data.contains(sg)) {
data.add(sg);
data = generateClassPropertiesWithRange(dmn.as(OntClass.class), graphRadius - 1, data);
}
}
}
}
return data;
}
示例6: domainToString
import com.hp.hpl.jena.ontology.OntProperty; //导入方法依赖的package包/类
private String domainToString(OntProperty prop) throws IOException {
ExtendedIterator<? extends OntResource> ditr = prop.listDomain();
while (ditr.hasNext()) {
OntResource dmnNode = ditr.next();
if (dmnNode.canAs(OntClass.class)) {
return ontClassToString(dmnNode.as(OntClass.class), null);
}
else {
throw new IOException("Domain of property '" + prop.toString() + "' is not an OntClass!");
}
}
return null;
}
示例7: propertyToSadl
import com.hp.hpl.jena.ontology.OntProperty; //导入方法依赖的package包/类
private void propertyToSadl(StringBuilder sb, ModelConcepts concepts,
OntResource prop) {
OntProperty ontprop = prop.asProperty();
ExtendedIterator<? extends OntResource> deitr = ontprop.listDomain();
OntProperty sprprop = null;
try {
sprprop = ontprop.getSuperProperty();
}
catch(Exception e) {
concepts.addErrorMessage(e.getMessage());
}
if (sprprop != null) {
sb.append(" is a type of ");
sb.append(uriToSadlString(concepts, sprprop));
}
if (deitr.hasNext()) {
sb.append(" describes ");
boolean unionDomain = false;
int domainctr = 0;
while (deitr.hasNext()) {
OntResource dr = deitr.next();
if (deitr.hasNext() && domainctr == 0) {
unionDomain = true;
sb.append("{");
}
if (domainctr++ > 0) {
sb.append(" or ");
}
sb.append(uriToSadlString(concepts, dr));
}
if (unionDomain) {
sb.append("}");
}
}
else if (sprprop == null) {
sb.append(" is a property");
}
ExtendedIterator<? extends OntResource> reitr = ontprop.listRange();
List<OntResource> rngList = new ArrayList<OntResource>();
while (reitr.hasNext()) {
OntResource rr = reitr.next();
if (!rr.equals(RDFS.Resource)) {
rngList.add(rr);
}
}
int rngcnt = rngList.size();
if (rngcnt > 0) {
sb.append(" with values of type ");
if (rngcnt == 1) {
sb.append(uriToSadlString(concepts, rngList.get(0)));
}
else {
sb.append("{");
for (int i = 0; i < rngcnt; i++) {
if (i > 0) {
sb.append(" or ");
}
sb.append(uriToSadlString(concepts, rngList.get(i)));
}
sb.append("}");
}
}
}