本文整理汇总了Java中com.hp.hpl.jena.ontology.OntClass.getLocalName方法的典型用法代码示例。如果您正苦于以下问题:Java OntClass.getLocalName方法的具体用法?Java OntClass.getLocalName怎么用?Java OntClass.getLocalName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.hp.hpl.jena.ontology.OntClass
的用法示例。
在下文中一共展示了OntClass.getLocalName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getClassLabels
import com.hp.hpl.jena.ontology.OntClass; //导入方法依赖的package包/类
/**
* If class has a label AbraCadabraQualityPerformance --> Abra Cadabra --> abra cadabra : will be returned as a label in the set.
*
* @param ocls
* @return
*/
public Set<String> getClassLabels(OntClass ocls) {
String name = ocls.getLocalName();
ExtendedIterator<RDFNode> iterator = ocls.listLabels(null);
List<String> labels = new ArrayList<String>(3);
while (iterator.hasNext()) {
labels.add(iterator.next().asLiteral().getLexicalForm());
}
// get trimmed name,labels then split camel case.
name = trimName(name);
name = LingUtil.splitCamelCase(name).toLowerCase();
for (int i = 0; i < labels.size(); i++) {
labels.set(i, LingUtil.splitCamelCase(trimName(labels.get(i))).toLowerCase());//trim then split camel case . then make lowercase
}
Set<String> lbls = new HashSet<String>(3);
lbls.add(name);
lbls.addAll(labels);
return lbls;
}
示例2: addChildcategories
import com.hp.hpl.jena.ontology.OntClass; //导入方法依赖的package包/类
private static void addChildcategories(OntClass categoryClass) {
String categoryName = categoryClass.getLocalName();
try {
List<String> childCategoryNames = wiki.getChildCategories(categoryName);
for (String childCategoryName : childCategoryNames) {
childCategoryName = URIref.encode(childCategoryName.replace(' ', '_').replace("+", "_Plus"));
OntClass childCategoryClass = categoryClass.getOntModel().createClass(PREFIX_NS_EXPERTFINDER + childCategoryName);
categoryClass.addSubClass(childCategoryClass);
// recursively call addChildCategories
addChildcategories(childCategoryClass);
}
} catch (MediaWikiAPIException e) {
e.printStackTrace();
}
}
示例3: MeasurementTypeGenerator
import com.hp.hpl.jena.ontology.OntClass; //导入方法依赖的package包/类
public MeasurementTypeGenerator() {
// prep the namespace prefixes
namespaces.put("ecso", ecsoPrefix);
namespaces.put("taxa", taxaPrefix);
namespaces.put("envo", envoPrefix);
namespaces.put("pato", patoPrefix);
namespaces.put("uo", uoPrefix);
namespaces.put("oboe", AnnotationGenerator.oboe);
namespaces.put("oboe-core", AnnotationGenerator.oboe_core);
namespaces.put("oboe-characteristics", AnnotationGenerator.oboe_characteristics);
// retrieve the ECSO ontology
ecsoModel = ModelFactory.createOntologyModel();
ecsoModel.read(ecso);
AnnotationGenerator.initializeCache();
// construct the ontology model for additions
m = ModelFactory.createOntologyModel();
Ontology ont = m.createOntology(ecso);
ont.addImport(m.createResource(AnnotationGenerator.oboe));
m.addSubModel(OntDocumentManager.getInstance().getModel(AnnotationGenerator.oboe));
// properties
rdfsLabel = ecsoModel.getProperty(AnnotationGenerator.rdfs + "label");
measuresCharacteristic = ecsoModel.getObjectProperty(AnnotationGenerator.oboe_core + "measuresCharacteristic");
measuresEntity = ecsoModel.getObjectProperty(AnnotationGenerator.oboe_core + "measuresEntity");
// classes
entityClass = ecsoModel.getOntClass(AnnotationGenerator.oboe_core + "Entity");
characteristicClass = ecsoModel.getOntClass(AnnotationGenerator.oboe_core + "Characteristic");
measurementTypeClass = ecsoModel.getOntClass(AnnotationGenerator.oboe_core + "MeasurementType");
// where do we begin with our counting?
classId = Settings.getConfiguration().getInt("annotator.ontology.classId");
// prep ALL concepts for quick look up
ExtendedIterator<OntClass> classIter = ecsoModel.listNamedClasses();
while (classIter.hasNext()) {
OntClass cls = classIter.next();
String label = cls.getLabel(null);
if (label == null) {
label = cls.getLocalName();
}
log.trace("Initializing class label: " + label);
allConcepts.put(label, cls);
}
}
示例4: createUniqueDefaultValName
import com.hp.hpl.jena.ontology.OntClass; //导入方法依赖的package包/类
private String createUniqueDefaultValName(OntClass restricted,
OntProperty prop) throws PrefixNotFoundException {
String nmBase = restricted.getLocalName() + "_" + prop.getLocalName()
+ "_default";
String nm = nmBase;
int cntr = 0;
while (getJenaModel().getIndividual(getUri(new ConceptName(nm))) != null) {
nm = nmBase + ++cntr;
}
return nm;
}
示例5: createUniqueDefaultValName
import com.hp.hpl.jena.ontology.OntClass; //导入方法依赖的package包/类
private String createUniqueDefaultValName(OntClass restricted, Property prop) throws PrefixNotFoundException {
String nmBase = restricted.getLocalName() + "_" + prop.getLocalName() + "_default";
String nm = getModelNamespace() + nmBase;
int cntr = 0;
while (getTheJenaModel().getIndividual(nm) != null) {
nm = nmBase + ++cntr;
}
return nm;
}