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


Java OWLClass类代码示例

本文整理汇总了Java中org.semanticweb.owlapi.model.OWLClass的典型用法代码示例。如果您正苦于以下问题:Java OWLClass类的具体用法?Java OWLClass怎么用?Java OWLClass使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


OWLClass类属于org.semanticweb.owlapi.model包,在下文中一共展示了OWLClass类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildTreeModel

import org.semanticweb.owlapi.model.OWLClass; //导入依赖的package包/类
private void buildTreeModel() {
  // first get all classes of the ontology
  Collection<OWLClass> classes = this.ontology.getClassesInSignature();
  // get the root of the tree model (the "Thing" OWL Class)
  DefaultMutableTreeNode root = null;
  for (OWLClass owlClass : classes) {
    if (owlClass.getIRI().getFragment().equals(rootConcept)) {
      root = new DefaultMutableTreeNode(owlClass);
      break;
    }
  }
  if (root == null) {
    return;
  }
  classes.remove(root.getUserObject());

  // now, add all remaining classes to the root by specialisation
  this.addSubClasses(root);
}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:20,代码来源:OntologyBrowser.java

示例2: findEquivalentClasses

import org.semanticweb.owlapi.model.OWLClass; //导入依赖的package包/类
public LinkedList<String> findEquivalentClasses(){
    
    LinkedList<String> equivalentClasses = new LinkedList<>();
            
    //Get all equivalent classes and set LinkedList equivalentClasses
    Set<OWLClass> classes = classifier.getEquivalentClasses(owlClass).getEntities();
    
    //For each equivalent class
    Iterator it = classes.iterator();
    while(it.hasNext()){
        OWLClass oClass = (OWLClass)it.next();
        //Add to LinkedList equivalentClasses
        if(!oClass.isOWLThing())
            equivalentClasses.add(oClass.getIRI().toString());
    }
    
    return equivalentClasses;
}
 
开发者ID:usplssb,项目名称:SemanticSCo,代码行数:19,代码来源:SemanticReasoner.java

示例3: findIndirectSubclasses

import org.semanticweb.owlapi.model.OWLClass; //导入依赖的package包/类
public LinkedList<String> findIndirectSubclasses(){
    
    LinkedList<String> indirectSubclasses = new LinkedList<>();
    
    //Get all subclasses and add them to LinkedList "indirectSubclasses"
    Set<OWLClass> subClasses = classifier.getSubClasses(owlClass,false).getFlattened();
    Iterator it = subClasses.iterator();
    while(it.hasNext()){
        OWLClass oClass = (OWLClass)it.next();
        //If is not the element owl:Nothing, add to LinkedList indirectSubclasses
        if(!oClass.isOWLNothing())
            indirectSubclasses.add(oClass.getIRI().toString());
    }
    
    //Remove direct subclasses from LinkedList "indirectSubclasses"
    indirectSubclasses.removeAll(findDirectSubclasses());
    
    return indirectSubclasses;
}
 
开发者ID:usplssb,项目名称:SemanticSCo,代码行数:20,代码来源:SemanticReasoner.java

示例4: getMostSpecificType

import org.semanticweb.owlapi.model.OWLClass; //导入依赖的package包/类
/**
 * Returns the most specific type of a given individual.
 * 
 * @param ind
 * @return
 */
private OWLClass getMostSpecificType(OWLIndividual ind) {
	logger.debug("Getting the most specific type of " + ind);
	String query = String.format("PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n"
			+ "select distinct ?type where {" + " <%s> a ?type ." + "?type rdfs:label []."
			// + "?type a owl:Class ." // too strict, thus currently omitted
			+ "filter not exists {?subtype ^a <%s> ; rdfs:subClassOf ?type .filter(?subtype != ?type)}}",
			ind.toStringID(), ind.toStringID());
	SortedSet<OWLClass> types = new TreeSet<OWLClass>();

	QueryExecution qe = qef.createQueryExecution(query);
	ResultSet rs = qe.execSelect();
	while (rs.hasNext()) {
		QuerySolution qs = rs.next();
		if (qs.get("type").isURIResource()) {
			types.add(new OWLClassImpl(IRI.create(qs.getResource("type").getURI())));
		}
	}
	qe.close();

	// of more than one type exists, we have to choose one
	// TODO

	return types.first();
}
 
开发者ID:dice-group,项目名称:BENGAL,代码行数:31,代码来源:Verbalizer.java

示例5: initialize

import org.semanticweb.owlapi.model.OWLClass; //导入依赖的package包/类
@Override
public void initialize(UimaContext context) throws ResourceInitializationException {
	super.initialize(context);
	try {
		ontUtil = new OntologyUtil(ontologyFile);

		/*
		 * check that the term to remove is in the ontology -- if it is not,
		 * it could be a format issue
		 */
		OWLClass cls = ontUtil.getOWLClassFromId(termIdToRemove);
		if (cls == null) {
			String errorMessage = "Ontology term ID selected for removal is not in the given ontology. "
					+ "This could be a formatting issue. Term selected for removal: " + termIdToRemove
					+ " Example term ID from the ontology: " + ontUtil.getClassIterator().next().toStringID();
			throw new ResourceInitializationException(new IllegalArgumentException(errorMessage));
		}

	} catch (OWLOntologyCreationException e) {
		throw new ResourceInitializationException(e);
	}
	annotationDataExtractor = (AnnotationDataExtractor) ConstructorUtil
			.invokeConstructor(annotationDataExtractorClassName);
}
 
开发者ID:UCDenver-ccp,项目名称:ccp-nlp,代码行数:25,代码来源:OntologyClassRemovalFilter_AE.java

示例6: addToOntology

import org.semanticweb.owlapi.model.OWLClass; //导入依赖的package包/类
@Override
public void addToOntology() {
  OWLObjectProperty property = featurePool.getExclusiveProperty(":propertyWithInfos");
  OWLClass range = featurePool.getExclusiveClass(":ClassWithInfos");
  OWLAnnotationProperty label = factory.getRDFSLabel();

  OWLAnnotation enAnnotation = factory.getOWLAnnotation(label, factory.getOWLLiteral("Label of a property", Locale.ENGLISH.getLanguage()));
  OWLAnnotation deAnnotation = factory.getOWLAnnotation(label, factory.getOWLLiteral("Bezeichnung einer Property", Locale.GERMAN.getLanguage()));
  OWLAnnotation jpAnnotation = factory.getOWLAnnotation(label, factory.getOWLLiteral("プロパティの指定", Locale.JAPANESE.getLanguage()));

  addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(property.getIRI(), deAnnotation));
  addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(property.getIRI(), enAnnotation));
  addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(property.getIRI(), jpAnnotation));

  OWLAnnotation enClassAnnotation = factory.getOWLAnnotation(label, factory.getOWLLiteral("Label of a class", Locale.ENGLISH.getLanguage()));
  OWLAnnotation deClassAnnotation = factory.getOWLAnnotation(label, factory.getOWLLiteral("Bezeichnung einer Klasse", Locale.GERMAN.getLanguage()));
  OWLAnnotation jpClassAnnotation = factory.getOWLAnnotation(label, factory.getOWLLiteral("どうもありがとうミスターロボット", Locale.JAPANESE.getLanguage()));

  addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(range.getIRI(), enClassAnnotation));
  addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(range.getIRI(), deClassAnnotation));
  addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(range.getIRI(), jpClassAnnotation));


  addToGenericDomainAndNewRange(property, range);
}
 
开发者ID:VisualDataWeb,项目名称:OntoBench,代码行数:26,代码来源:RdfsLabelMultiLanguageFeature.java

示例7: addToOntology

import org.semanticweb.owlapi.model.OWLClass; //导入依赖的package包/类
@Override
public void addToOntology() {
  OWLObjectProperty property = featurePool.getExclusiveProperty(":propertyWithInfos");
  OWLClass range = featurePool.getExclusiveClass(":ClassWithInfos");
  OWLAnnotationProperty comment = factory.getRDFSComment();

  OWLAnnotation enAnnotation = factory.getOWLAnnotation(comment, factory.getOWLLiteral("Comment of a property", Locale.ENGLISH.getLanguage()));
  OWLAnnotation deAnnotation = factory.getOWLAnnotation(comment, factory.getOWLLiteral("Kommentar einer Property", Locale.GERMAN.getLanguage()));
  OWLAnnotation jpAnnotation = factory.getOWLAnnotation(comment, factory.getOWLLiteral("プロパティのコメント", Locale.JAPANESE.getLanguage()));

  addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(property.getIRI(), deAnnotation));
  addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(property.getIRI(), enAnnotation));
  addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(property.getIRI(), jpAnnotation));


  OWLAnnotation enClassAnnotation = factory.getOWLAnnotation(comment, factory.getOWLLiteral("Comment of a class", Locale.ENGLISH.getLanguage()));
  OWLAnnotation deClassAnnotation = factory.getOWLAnnotation(comment, factory.getOWLLiteral("Kommentar einer Klasse", Locale.GERMAN.getLanguage()));
  OWLAnnotation jpClassAnnotation = factory.getOWLAnnotation(comment, factory.getOWLLiteral("どうもありがとうミスターロボット", Locale.JAPANESE.getLanguage()));

  addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(range.getIRI(), enClassAnnotation));
  addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(range.getIRI(), deClassAnnotation));
  addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(range.getIRI(), jpClassAnnotation));

  addToGenericDomainAndNewRange(property, range);
}
 
开发者ID:VisualDataWeb,项目名称:OntoBench,代码行数:26,代码来源:RdfsCommentMultiLanguageFeature.java

示例8: findIndirectSuperclasses

import org.semanticweb.owlapi.model.OWLClass; //导入依赖的package包/类
public LinkedList<String> findIndirectSuperclasses(){
    
    LinkedList<String> indirectSuperclasses = new LinkedList<>();
    
    //Get all superclasses and add them to LinkedList "indirectSuperclasses"
    Set<OWLClass> superClasses = classifier.getSuperClasses(owlClass,false).getFlattened();
    Iterator it = superClasses.iterator();
    while(it.hasNext()){
        OWLClass oClass = (OWLClass)it.next();
        //If is not the element owl:Thing, add to LinkedList indirectSuperclasses
        if(!oClass.isOWLThing())
            indirectSuperclasses.add(oClass.getIRI().toString());
    }
    
    //Remove direct superclasses from LinkedList "indirectSuperclasses"
    indirectSuperclasses.removeAll(findDirectSuperclasses());
    
    return indirectSuperclasses;
}
 
开发者ID:usplssb,项目名称:SemanticSCo,代码行数:20,代码来源:SemanticReasoner.java

示例9: addToOntology

import org.semanticweb.owlapi.model.OWLClass; //导入依赖的package包/类
@Override
public void addToOntology() {
  OWLClass start = featurePool.getReusableClass();
  OWLClass middle = featurePool.getExclusiveClass(":PropertyChainMiddle");
  OWLClass end = featurePool.getExclusiveClass(":PropertyChainEnd");

  OWLObjectProperty singleStep = featurePool.getExclusiveProperty(":propertyChainProperty_SingleStep");
  OWLObjectProperty doubleStep = featurePool.getExclusiveProperty(":propertyChainProperty_DoubleStep");

  List<OWLObjectProperty> propertyChain = Arrays.asList(singleStep, singleStep);
  addAxiomToOntology(factory.getOWLSubPropertyChainOfAxiom(propertyChain, doubleStep));

  addProperty(end, singleStep, middle);
  addProperty(middle, singleStep, start);
  addProperty(end, doubleStep, start);
}
 
开发者ID:VisualDataWeb,项目名称:OntoBench,代码行数:17,代码来源:OwlPropertyChainAxiomFeature.java

示例10: getSummaries

import org.semanticweb.owlapi.model.OWLClass; //导入依赖的package包/类
/**
 * Returns a textual summary of the given entity.
 *
 * @return
 */
public Map<OWLIndividual, String> getSummaries(Set<OWLIndividual> individuals, OWLClass nc, String namespace,
		double threshold, Cooccurrence cooccurrence, HardeningType hType) {
	Map<OWLIndividual, String> entity2Summaries = new HashMap<OWLIndividual, String>();

	Map<OWLIndividual, List<NLGElement>> verbalize = verbalize(individuals, nc, namespace, threshold, cooccurrence,
			hType);
	for (Entry<OWLIndividual, List<NLGElement>> entry : verbalize.entrySet()) {
		OWLIndividual individual = entry.getKey();
		List<NLGElement> elements = entry.getValue();
		String summary = realize(elements);
		summary = summary.replaceAll("\\s?\\((.*?)\\)", "");
		summary = summary.replace(" , among others,", ", among others,");
		entity2Summaries.put(individual, summary);
	}

	return entity2Summaries;
}
 
开发者ID:dice-group,项目名称:BENGAL,代码行数:23,代码来源:Verbalizer.java

示例11: generateSubjects

import org.semanticweb.owlapi.model.OWLClass; //导入依赖的package包/类
/**
 * Returns a list of synonymous expressions as subject for the given
 * resource.
 * 
 * @param resource
 *            the resource
 * @param resourceType
 *            the type of the resource
 * @param resourceGender
 *            the gender of the resource
 * @return list of synonymous expressions
 */
public List<NPPhraseSpec> generateSubjects(Resource resource, OWLClass resourceType, Gender resourceGender) {
	List<NPPhraseSpec> result = new ArrayList<NPPhraseSpec>();
	// the textual representation of the resource itself
	result.add(nlg.getNPPhrase(resource.getURI(), false, false));
	// the class, e.g. 'this book'
	NPPhraseSpec np = nlg.getNPPhrase(resourceType.toStringID(), false);
	np.addPreModifier("This");
	result.add(np);
	// the pronoun depending on the gender of the resource
	if (resourceGender.equals(Gender.MALE)) {
		result.add(nlg.nlgFactory.createNounPhrase("he"));
	} else if (resourceGender.equals(Gender.FEMALE)) {
		result.add(nlg.nlgFactory.createNounPhrase("she"));
	} else {
		result.add(nlg.nlgFactory.createNounPhrase("it"));
	}
	return result;
}
 
开发者ID:dice-group,项目名称:BENGAL,代码行数:31,代码来源:Verbalizer.java

示例12: findDirectSuperclasses

import org.semanticweb.owlapi.model.OWLClass; //导入依赖的package包/类
public LinkedList<String> findDirectSuperclasses(){
    
    LinkedList<String> directSuperclasses = new LinkedList<>();
    
    //Get all direct superclasses and set LinkedList directSuperclasses
    Set<OWLClass> superClasses = classifier.getSuperClasses(owlClass,true).getFlattened();
    
    //For each direct superclass
    Iterator it = superClasses.iterator();
    while(it.hasNext()){
        OWLClass oClass = (OWLClass)it.next();
        //If is not the element owl:Thing, add to LinkedList directSuperclasses
        if(!oClass.isOWLThing())
            directSuperclasses.add(oClass.getIRI().toString());
    }
    
    return directSuperclasses;
}
 
开发者ID:usplssb,项目名称:SemanticSCo,代码行数:19,代码来源:SemanticReasoner.java

示例13: getParents

import org.semanticweb.owlapi.model.OWLClass; //导入依赖的package包/类
@Override
public Set<OWLEntity> getParents(OWLEntity cpt) {
	if(!cpt.isOWLClass()) return new HashSet<OWLEntity>();

	Set<OWLEntity> entities = new HashSet<OWLEntity>();
	Set<OWLEntity> result = new HashSet<OWLEntity>();
	OWLClass localRootClass = cpt.asOWLClass();
	entities.addAll(reasoner.getSuperClasses(localRootClass, true).getFlattened());
	for(OWLEntity parentClass : entities) {
		// Only Class
		if(!parentClass.isOWLClass())
		{
			continue;
		}
		// Not Nothing
		if(parentClass.isOWLClass() && parentClass.asOWLClass().isOWLNothing())
		{
			continue;
		}
		result.add(parentClass);
	}
	return result;
}
 
开发者ID:lmazuel,项目名称:onagui,代码行数:24,代码来源:OWLAPIContainer.java

示例14: sendEvent

import org.semanticweb.owlapi.model.OWLClass; //导入依赖的package包/类
@Override
public void sendEvent(SemanticEvent se) {
    Set<String> triggeredFilters = new HashSet<String>();
    // add event to ontology
    manager.addAxioms(ontology, se.getAxioms());
    // extract types event
    reasoner.flush();

    NodeSet<OWLClass> inferedClasses = reasoner.getTypes(se.getMessage(), false);
    for (OWLClass owlclss : inferedClasses.getFlattened()) {
        String clss = owlclss.getIRI().toString();
        if (eventDefinitions.contains(clss)) {
            triggeredFilters.add(clss);
        }
    }
    se.setTriggeredFilterIRIs(triggeredFilters);

    //send event back to engie
    obep.sendEvent(se);
}
 
开发者ID:IBCNServices,项目名称:OBEP,代码行数:21,代码来源:AbstracterImpl.java

示例15: addToOntology

import org.semanticweb.owlapi.model.OWLClass; //导入依赖的package包/类
@Override
public void addToOntology() {
  OWLClass domain = featurePool.getExclusiveClass(":DatatypeMapsDomain");
  OWLDatatype range = factory.getOWLDatatype(datatype);

  String namespace = datatype.getPrefixedName().split(":")[0];
  String name = datatype.getShortForm();
  String propertyIri = ":" + namespace + WordUtils.capitalize(name) + "Property";
  OWLDataProperty property = factory.getOWLDataProperty(propertyIri, pm);

  addProperty(domain, property, range);
}
 
开发者ID:VisualDataWeb,项目名称:OntoBench,代码行数:13,代码来源:AbstractDatatypeMapFeature.java


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