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


Java OWLIndividual类代码示例

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


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

示例1: getSummaries

import org.semanticweb.owlapi.model.OWLIndividual; //导入依赖的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

示例2: getMostSpecificType

import org.semanticweb.owlapi.model.OWLIndividual; //导入依赖的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

示例3: train

import org.semanticweb.owlapi.model.OWLIndividual; //导入依赖的package包/类
/**
 * Train on resources of a given class.
 * 
 * @param filename
 * @param strategy
 * @param classname
 * @return
 */
public static R2VModel train(String filename,
		TfidfFEXStrategy strategy, String classname) {
	
	OWLOntology o = getOntology(filename);
	R2VModel model = new R2VModel(o, strategy);
	
	for(OWLIndividual ind : getIndividuals(classname, o)) {
		model.add(ind.asOWLNamedIndividual());
	}
	
	model.stringFeatures();
	model.normalize();
	
	return model;
}
 
开发者ID:AKSW,项目名称:Resource2Vec,代码行数:24,代码来源:R2VManager.java

示例4: getIndividuals

import org.semanticweb.owlapi.model.OWLIndividual; //导入依赖的package包/类
/**
 * @param superclass
 * @param o
 * @return
 */
private static Set<OWLIndividual> getIndividuals(String superclass,
		OWLOntology o) {
	
	OWLReasoner reasoner = PelletReasonerFactory.getInstance()
			.createReasoner(o);
	Set<OWLNamedIndividual> instances = reasoner.getInstances(
			OWL.Class(IRI.create(superclass)), false).getFlattened();
	
	// filter out all owl:sameAs instances...
	Set<OWLIndividual> ind = new TreeSet<>();
	for (OWLNamedIndividual i : instances) {
		ind.add(i);
	}
	logger.info("|I| = " + ind.size());
	logger.debug("I = " + ind);

	return ind;

}
 
开发者ID:AKSW,项目名称:Resource2Vec,代码行数:25,代码来源:R2VManager.java

示例5: findProcesses

import org.semanticweb.owlapi.model.OWLIndividual; //导入依赖的package包/类
private Map<OWLClass, Pair<OWLNamedIndividual, Set<OWLAnnotation>>> findProcesses(OWLNamedIndividual mf) {
	Map<OWLClass, Pair<OWLNamedIndividual, Set<OWLAnnotation>>> result = new HashMap<OWLClass, Pair<OWLNamedIndividual,Set<OWLAnnotation>>>();
	Set<OWLObjectPropertyAssertionAxiom> axioms = model.getObjectPropertyAssertionAxioms(mf);
	for (OWLObjectPropertyAssertionAxiom axiom : axioms) {
		if (partOf.equals(axiom.getProperty()) && mf.equals(axiom.getSubject())) {
			// relevant axiom
			OWLIndividual bpCandidate = axiom.getObject();
			if (bpCandidate.isNamed()) {
				final OWLNamedIndividual named = bpCandidate.asOWLNamedIndividual();
				Set<OWLClass> bpTypes = getTypes(named);
				for (OWLClass bpType : bpTypes) {
					if (bpSet.contains(bpType) == false) {
						continue;
					}
					result.put(bpType, Pair.of(named, getAnnotations(axiom, named)));
				}
			}
		}
	}
	return result;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:22,代码来源:ModelAnnotationSolrDocumentLoader.java

示例6: extractService

import org.semanticweb.owlapi.model.OWLIndividual; //导入依赖的package包/类
/**
 * Extracts data manipulation service information from the ontology.
 * 
 * @param service
 *            service individual found in ontology.
 * @param ontology
 *            searched ontology.
 * @return extracted data manipulation service.
 * @throws EntryCreationException
 *             should any problems with extraction of data manipulation service information occur.
 */
private DataManipulationService extractService(OWLIndividual service, OWLOntology ontology)
        throws EntryCreationException {
    DataManipulationService dataManipulationService = new DataManipulationService();
    Set<OWLIndividual> profiles = service.getObjectPropertyValues(ontologyManager.getOWLDataFactory()
            .getOWLObjectProperty(PRESENTS_PROPERTY_IRI), ontology);
    for (OWLIndividual profile : profiles) {
        String profilePath = profile.asOWLNamedIndividual().getIRI().getStart();
        profilePath = profilePath.substring(0, profilePath.length() - 1);
        OWLOntology profileOntology = ontologyManager.getOntology(IRI.create(profilePath));
        dataManipulationService.setIri(extractServiceIri(service));
        dataManipulationService.setName(extractServiceName(profile, profileOntology));
        dataManipulationService.setDescription(extractServiceDescription(profile, profileOntology));
        dataManipulationService.setType(extractServiceType(profile, profileOntology));
    }
    return dataManipulationService;
}
 
开发者ID:psnc-dl,项目名称:darceo,代码行数:28,代码来源:ServicesConstructorBean.java

示例7: visit

import org.semanticweb.owlapi.model.OWLIndividual; //导入依赖的package包/类
public Boolean visit(OWLDatatypeDefinitionAxiom axiom) {
    reasoner.throwInconsistentOntologyExceptionIfNecessary();
    if (!reasoner.isConsistent())
        return true;
    if (reasoner.m_dlOntology.hasDatatypes()) {
        OWLDataFactory factory=reasoner.getDataFactory();
        OWLIndividual freshIndividual=factory.getOWLAnonymousIndividual("fresh-individual");
        OWLDataProperty freshDataProperty=factory.getOWLDataProperty(IRI.create("fresh-data-property"));
        OWLDataRange dataRange=axiom.getDataRange();
        OWLDatatype dt=axiom.getDatatype();
        OWLDataIntersectionOf dr1=factory.getOWLDataIntersectionOf(factory.getOWLDataComplementOf(dataRange),dt);
        OWLDataIntersectionOf dr2=factory.getOWLDataIntersectionOf(factory.getOWLDataComplementOf(dt),dataRange);
        OWLDataUnionOf union=factory.getOWLDataUnionOf(dr1,dr2);
        OWLClassExpression c=factory.getOWLDataSomeValuesFrom(freshDataProperty,union);
        OWLClassAssertionAxiom ax=factory.getOWLClassAssertionAxiom(c,freshIndividual);
        Tableau tableau=reasoner.getTableau(ax);
        return !tableau.isSatisfiable(true,true,null,null,null,null,null,ReasoningTaskDescription.isAxiomEntailed(axiom));
    }
    else
        return false;
}
 
开发者ID:evalincius,项目名称:Hermit_1.3.8_android,代码行数:22,代码来源:EntailmentChecker.java

示例8: extractServiceType

import org.semanticweb.owlapi.model.OWLIndividual; //导入依赖的package包/类
/**
 * Extracts service type of described service.
 * 
 * @param profile
 *            profile individual found in ontology.
 * @param profileOntology
 *            profile ontology.
 * @return type of service.
 * @throws EntryCreationException
 *             should specified service type be incompatible.
 */
private ServiceType extractServiceType(OWLIndividual profile, OWLOntology profileOntology)
        throws EntryCreationException {
    Set<OWLClassExpression> types = profile.getTypes(profileOntology);
    for (OWLClassExpression type : types) {
        String fragment = type.asOWLClass().getIRI().getFragment();
        if (ADV_DELIVERY.equals(fragment)) {
            return ServiceType.ADVANCED_DATA_DELIVERY;
        } else if (MIGRATION.equals(fragment)) {
            return ServiceType.DATA_MIGRATION;
        } else if (CONVERSION.equals(fragment)) {
            return ServiceType.DATA_CONVERSION;
        } else {
            throw new EntryCreationException("Unrecognized service type, malformed semantic descriptor.");
        }
    }
    throw new RuntimeException("Unrecognized service type.");
}
 
开发者ID:psnc-dl,项目名称:darceo,代码行数:29,代码来源:ServicesConstructorBean.java

示例9: getServiceUrlFromWsdl

import org.semanticweb.owlapi.model.OWLIndividual; //导入依赖的package包/类
/**
 * Finds the service address in the given WSDL using the information contained in semantic descriptor.
 * 
 * @param ontology
 *            currently browsed ontology.
 * @param technicalDesc
 *            individual from the ontology representing technical descriptor.
 * @param techDescriptorUrl
 *            location of technical descriptor.
 * @return URL specifying the service address (location).
 * @throws EntryCreationException
 *             should any problems with parsing WSDL document occur.
 */
private String getServiceUrlFromWsdl(OWLOntology ontology, OWLIndividual technicalDesc, String techDescriptorUrl)
        throws EntryCreationException {
    Set<OWLIndividual> operationRefs = technicalDesc.getObjectPropertyValues(ontologyManager.getOWLDataFactory()
            .getOWLObjectProperty(IRI.create(WSDL_GROUNDING_PREFIX + "wsdlOperation")), ontology);
    for (OWLIndividual operationRef : operationRefs) {
        Set<OWLLiteral> operations = operationRef.getDataPropertyValues(ontologyManager.getOWLDataFactory()
                .getOWLDataProperty(IRI.create(WSDL_GROUNDING_PREFIX + "operation")), ontology);
        for (OWLLiteral operation : operations) {
            String[] split = operation.getLiteral().split("#");
            String id = split[split.length - 1].trim();
            String xpath = "//" + TechnicalNamespaceContext.WSDL_PREFIX + ":service/"
                    + TechnicalNamespaceContext.WSDL_PREFIX + ":port/" + TechnicalNamespaceContext.WSDL_SOAP_PREFIX
                    + ":address";
            NodeList nodes = getNode(techDescriptorUrl, xpath);
            String path = findOperationUrl(techDescriptorUrl, nodes, id);
            return path;
        }
    }
    throw new EntryCreationException("Could not find location of the service specified in grounding.");
}
 
开发者ID:psnc-dl,项目名称:darceo,代码行数:34,代码来源:TechnicalDescriptorConstructorBean.java

示例10: getServiceUrlFromWadl

import org.semanticweb.owlapi.model.OWLIndividual; //导入依赖的package包/类
/**
 * Finds the service address in the given WADL using the information contained in semantic descriptor.
 * 
 * @param ontology
 *            currently browsed ontology.
 * @param technicalDesc
 *            individual from the ontology representing technical descriptor.
 * @param techDescriptorUrl
 *            location of technical descriptor.
 * @return URL specifying the service address (location).
 * @throws EntryCreationException
 *             should any problems with parsing WADL document occur.
 */
private String getServiceUrlFromWadl(OWLOntology ontology, OWLIndividual technicalDesc, String techDescriptorUrl)
        throws EntryCreationException {
    Set<OWLIndividual> resourceMethods = technicalDesc.getObjectPropertyValues(ontologyManager.getOWLDataFactory()
            .getOWLObjectProperty(IRI.create(WADL_GROUNDING_PREFIX + "wadlResourceMethod")), ontology);
    for (OWLIndividual resourceMethod : resourceMethods) {
        Set<OWLLiteral> resources = resourceMethod.getDataPropertyValues(ontologyManager.getOWLDataFactory()
                .getOWLDataProperty(IRI.create(WADL_GROUNDING_PREFIX + "resource")), ontology);
        for (OWLLiteral resource : resources) {
            String[] split = resource.getLiteral().split("#");
            String id = split[split.length - 1].trim();
            String xpath = "//" + TechnicalNamespaceContext.WADL_PREFIX + ":resource[@id='" + id + "']";
            NodeList nodes = getNode(techDescriptorUrl, xpath);
            String path = constructUrl(nodes.item(0));
            return path;
        }
    }
    throw new EntryCreationException("Could not find location of the service specified in grounding.");
}
 
开发者ID:psnc-dl,项目名称:darceo,代码行数:32,代码来源:TechnicalDescriptorConstructorBean.java

示例11: visit

import org.semanticweb.owlapi.model.OWLIndividual; //导入依赖的package包/类
public void visit(OWLClassAssertionAxiom classAssertion) {
	OWLIndividual individual = classAssertion.getIndividual();
	OWLClassExpression classExpression = classAssertion.getClassExpression();
	
	if (!classExpression.isAnonymous()) {
		OWLClass namedClass = classExpression.asOWLClass();
		
		writer.print(namedClass.getIRI().getFragment());
		writer.print("(");
		writer.print(IRI.create(individual.toStringID()).getFragment());
		writer.print(").\n");
	}
	else {
		
	}
}
 
开发者ID:wolpertinger-reasoner,项目名称:Wolpertinger,代码行数:17,代码来源:NiceAxiomPrinter.java

示例12: randomizeClassAssertions

import org.semanticweb.owlapi.model.OWLIndividual; //导入依赖的package包/类
public static void randomizeClassAssertions(OWLOntology ont, int num) {
	Set<OWLClassAssertionAxiom> caas = new HashSet<OWLClassAssertionAxiom>();
	Set<OWLClassAssertionAxiom> caasNew = new HashSet<OWLClassAssertionAxiom>();
		Set<OWLNamedIndividual> inds = ont.getIndividualsInSignature(Imports.INCLUDED);
	OWLNamedIndividual[] indArr = (OWLNamedIndividual[]) inds.toArray();
	for (OWLNamedIndividual ind : inds) {
		caas.addAll( ont.getClassAssertionAxioms(ind) );
	}
	for (OWLClassAssertionAxiom caa : caas) {
		OWLIndividual randomIndividual = null;
		caasNew.add(ont.getOWLOntologyManager().getOWLDataFactory().getOWLClassAssertionAxiom(caa.getClassExpression(), 
				randomIndividual));
	}
	ont.getOWLOntologyManager().removeAxioms(ont, caas);
	ont.getOWLOntologyManager().addAxioms(ont, caasNew);
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:17,代码来源:ABoxUtils.java

示例13: getConceptSchemeComboBox

import org.semanticweb.owlapi.model.OWLIndividual; //导入依赖的package包/类
public static JComboBox getConceptSchemeComboBox(OWLEditorKit owlEditorKit) {

        final Comparator<OWLObject> comp = owlEditorKit.getModelManager().getOWLObjectComparator();

        List<OWLIndividual> sorted;
        Collections.sort(sorted = new ArrayList<OWLIndividual>(getConceptSchemes(owlEditorKit)), new OWLObjectComparatorAdapter<OWLIndividual>(comp) {

            public int compare(OWLIndividual o1, OWLIndividual o2) {
                return super.compare(o1,o2);
            }
        });

        JComboBox schemaBox = new JComboBox(sorted.toArray());
        schemaBox.setRenderer(new OWLCellRendererSimple(owlEditorKit));
        if(!getConceptSchemes(owlEditorKit).isEmpty()) {
            schemaBox.setSelectedIndex(0);
        }

        return schemaBox;

    }
 
开发者ID:simonjupp,项目名称:skoseditor,代码行数:22,代码来源:ConceptSchemeComboBox.java

示例14: visit

import org.semanticweb.owlapi.model.OWLIndividual; //导入依赖的package包/类
public void visit(OWLObjectSomeValuesFrom object) {
    OWLClassExpression filler=object.getFiller();
    if (filler instanceof OWLObjectOneOf) {
        for (OWLIndividual individual : ((OWLObjectOneOf)filler).getIndividuals()) {
            Variable z=nextZ();
            m_bodyAtoms.add(Atom.create(getConceptForNominal(individual),z));
            m_headAtoms.add(getRoleAtom(object.getProperty(),X,z));
        }
    }
    else {
        LiteralConcept toConcept=getLiteralConcept(filler);
        Role onRole=getRole(object.getProperty());
        AtLeastConcept atLeastConcept=AtLeastConcept.create(1,onRole,toConcept);
        if (!atLeastConcept.isAlwaysFalse())
            m_headAtoms.add(Atom.create(atLeastConcept,X));
    }
}
 
开发者ID:evalincius,项目名称:Hermit_1.3.8_android,代码行数:18,代码来源:OWLClausification.java

示例15: isSatisfiable

import org.semanticweb.owlapi.model.OWLIndividual; //导入依赖的package包/类
public boolean isSatisfiable(OWLClassExpression classExpression) {
	checkPreConditions(classExpression);
	if (!isConsistent())
		return false;
	if (classExpression instanceof OWLClass
			&& m_atomicConceptHierarchy != null) {
		AtomicConcept concept = H((OWLClass) classExpression);
		HierarchyNode<AtomicConcept> node = m_atomicConceptHierarchy
				.getNodeForElement(concept);
		return node != m_atomicConceptHierarchy.getBottomNode();
	} else {
		OWLDataFactory factory = getDataFactory();
		OWLIndividual freshIndividual = factory
				.getOWLAnonymousIndividual("fresh-individual");
		OWLClassAssertionAxiom assertClassExpression = factory
				.getOWLClassAssertionAxiom(classExpression, freshIndividual);
		Tableau tableau = getTableau(assertClassExpression);
		return tableau.isSatisfiable(true, null, null, null, null, null,
				ReasoningTaskDescription
						.isConceptSatisfiable(classExpression));
	}
}
 
开发者ID:robertoyus,项目名称:HermiT-android,代码行数:23,代码来源:Reasoner.java


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