本文整理汇总了Java中org.semanticweb.owlapi.reasoner.impl.OWLNamedIndividualNodeSet类的典型用法代码示例。如果您正苦于以下问题:Java OWLNamedIndividualNodeSet类的具体用法?Java OWLNamedIndividualNodeSet怎么用?Java OWLNamedIndividualNodeSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OWLNamedIndividualNodeSet类属于org.semanticweb.owlapi.reasoner.impl包,在下文中一共展示了OWLNamedIndividualNodeSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPropertiesWithInferenceGetsInferredProperties
import org.semanticweb.owlapi.reasoner.impl.OWLNamedIndividualNodeSet; //导入依赖的package包/类
@Test
public void getPropertiesWithInferenceGetsInferredProperties() throws Exception {
final OWLNamedIndividual individual = dataFactory.getOWLNamedIndividual(IRI.create(PK));
initEmptyOntology(individual);
when(ontologyMock.dataPropertiesInSignature())
.thenReturn(Stream.of(dataFactory.getOWLDataProperty(IRI.create(DP_ONE)),
dataFactory.getOWLDataProperty(IRI.create(DP_TWO))));
when(ontologyMock.objectPropertiesInSignature())
.thenReturn(Stream.of(dataFactory.getOWLObjectProperty(IRI.create(OP_ONE))));
when(reasonerMock.getDataPropertyValues(eq(individual), any(OWLDataProperty.class)))
.thenReturn(Collections.emptySet());
when(reasonerMock.getObjectPropertyValues(eq(individual),
any(OWLObjectProperty.class))).thenReturn(new OWLNamedIndividualNodeSet());
final Collection<Axiom<?>> axioms = propertiesHandler.getProperties(INDIVIDUAL, true);
assertNotNull(axioms);
verify(reasonerMock, atLeastOnce()).getDataPropertyValues(eq(individual), any(OWLDataProperty.class));
verify(reasonerMock, atLeastOnce()).getObjectPropertyValues(eq(individual), any(OWLObjectProperty.class));
}
示例2: initReasoner
import org.semanticweb.owlapi.reasoner.impl.OWLNamedIndividualNodeSet; //导入依赖的package包/类
private void initReasoner(List<URI> items) {
final OWLObjectProperty hasList = dataFactory.getOWLObjectProperty(IRI.create(HAS_LIST.getIdentifier()));
final OWLObjectProperty hasNext = dataFactory.getOWLObjectProperty(IRI.create(HAS_NEXT.getIdentifier()));
when(reasonerMock
.getObjectPropertyValues(dataFactory.getOWLNamedIndividual(IRI.create(SUBJECT.getIdentifier())),
hasList))
.thenReturn(new OWLNamedIndividualNodeSet(dataFactory.getOWLNamedIndividual(IRI.create(items.get(0)))));
for (int i = 1; i < items.size(); i++) {
when(reasonerMock
.getObjectPropertyValues(dataFactory.getOWLNamedIndividual(IRI.create(items.get(i - 1))), hasNext))
.thenReturn(
new OWLNamedIndividualNodeSet(dataFactory.getOWLNamedIndividual(IRI.create(items.get(i)))));
}
when(reasonerMock
.getObjectPropertyValues(dataFactory.getOWLNamedIndividual(IRI.create(items.get(items.size() - 1))),
hasNext)).thenReturn(new OWLNamedIndividualNodeSet());
}
示例3: skipsExplicitAssertionValueIfThereIsTheSameAssertionAlsoWithInference
import org.semanticweb.owlapi.reasoner.impl.OWLNamedIndividualNodeSet; //导入依赖的package包/类
@Test
public void skipsExplicitAssertionValueIfThereIsTheSameAssertionAlsoWithInference() {
final URI opUri = URI.create("http://krizik.felk.cvut.cz/PropertyOne");
final Assertion opAsserted = Assertion.createObjectPropertyAssertion(opUri, false);
final Assertion opInferred = Assertion.createObjectPropertyAssertion(opUri, true);
final OWLObjectProperty owlOp = dataFactory.getOWLObjectProperty(IRI.create(opUri));
final Set<Node<OWLNamedIndividual>> indSet = new HashSet<>();
final OWLNamedIndividual commonInd = dataFactory.getOWLNamedIndividual(
IRI.create("http://krizik.felk.cvut.cz/IndividialOne"));
indSet.add(NodeFactory.getOWLNamedIndividualNode(commonInd));
indSet.add(NodeFactory.getOWLNamedIndividualNode(
dataFactory.getOWLNamedIndividual(IRI.create("http://krizik.felk.cvut.cz/IndividialTwo"))));
final NodeSet<OWLNamedIndividual> individuals = new OWLNamedIndividualNodeSet(indSet);
when(reasonerMock.getObjectPropertyValues(individual, owlOp)).thenReturn(individuals);
final Stream<OWLObjectPropertyAssertionAxiom> axioms = Stream.of(dataFactory.getOWLObjectPropertyAssertionAxiom(
dataFactory.getOWLObjectProperty(IRI.create(opUri)), individual, commonInd));
when(ontologyMock.objectPropertyAssertionAxioms(individual)).thenReturn(axioms);
when(ontologyMock.dataPropertyAssertionAxioms(any())).thenReturn(Stream.empty());
when(ontologyMock.annotationAssertionAxioms(any())).thenReturn(Stream.empty());
final Collection<Axiom<?>> result = axiomLoader.findAxioms(descriptor(opAsserted, opInferred));
assertEquals(indSet.size(), result.size());
for (Axiom ax : result) {
assertEquals(opInferred, ax.getAssertion());
}
}
示例4: getDifferentIndividuals
import org.semanticweb.owlapi.reasoner.impl.OWLNamedIndividualNodeSet; //导入依赖的package包/类
public NodeSet<OWLNamedIndividual> getDifferentIndividuals(
OWLNamedIndividual namedIndividual) {
checkPreConditions(namedIndividual);
if (!m_isConsistent) {
Node<OWLNamedIndividual> node = new OWLNamedIndividualNode(
getAllNamedIndividuals());
return new OWLNamedIndividualNodeSet(Collections.singleton(node));
}
Individual individual = H(namedIndividual);
Tableau tableau = getTableau();
Set<Individual> result = new HashSet<Individual>();
for (Individual potentiallyDifferentIndividual : m_dlOntology
.getAllIndividuals())
if (isResultRelevantIndividual(potentiallyDifferentIndividual)
&& !individual.equals(potentiallyDifferentIndividual))
if (!tableau.isSatisfiable(true, true, Collections
.singleton(Atom.create(Equality.INSTANCE, individual,
potentiallyDifferentIndividual)), null, null,
null, null, new ReasoningTaskDescription(true,
"is {0} different from {1}", individual,
potentiallyDifferentIndividual)))
result.add(potentiallyDifferentIndividual);
return sortBySameAsIfNecessary(result);
}
示例5: getObjectPropertyValues
import org.semanticweb.owlapi.reasoner.impl.OWLNamedIndividualNodeSet; //导入依赖的package包/类
public NodeSet<OWLNamedIndividual> getObjectPropertyValues(
OWLNamedIndividual namedIndividual,
OWLObjectPropertyExpression propertyExpression) {
checkPreConditions(namedIndividual, propertyExpression);
if (!m_isConsistent) {
Node<OWLNamedIndividual> node = new OWLNamedIndividualNode(
getAllNamedIndividuals());
return new OWLNamedIndividualNodeSet(Collections.singleton(node));
}
AtomicRole role = H(propertyExpression.getNamedProperty());
if (!m_dlOntology.containsObjectRole(role))
return new OWLNamedIndividualNodeSet();
initialisePropertiesInstanceManager();
Individual individual = H(namedIndividual);
Set<Individual> result;
if (propertyExpression.getSimplified().isAnonymous()) {
// inverse role
result = m_instanceManager.getObjectPropertySubjects(role,
individual);
} else {
// named role
result = m_instanceManager
.getObjectPropertyValues(role, individual);
}
return sortBySameAsIfNecessary(result);
}
示例6: getInstances
import org.semanticweb.owlapi.reasoner.impl.OWLNamedIndividualNodeSet; //导入依赖的package包/类
public NodeSet<OWLNamedIndividual> getInstances(OWLClassExpression ce,
boolean direct) throws InconsistentOntologyException,
ClassExpressionNotInProfileException, FreshEntitiesException,
ReasonerInterruptedException, TimeOutException {
DefaultNodeSet<OWLNamedIndividual> result = new OWLNamedIndividualNodeSet();
Set<OWLObject> subs = gw.queryDescendants(ce, true, true);
for (OWLObject s : subs) {
if (s instanceof OWLNamedIndividual) {
result.addEntity((OWLNamedIndividual) s);
}
else {
}
}
return result;
}
示例7: getInstances
import org.semanticweb.owlapi.reasoner.impl.OWLNamedIndividualNodeSet; //导入依赖的package包/类
public NodeSet<OWLNamedIndividual> getInstances(OWLClassExpression ce, boolean direct) throws InconsistentOntologyException, ClassExpressionNotInProfileException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException {
ensurePrepared();
DefaultNodeSet<OWLNamedIndividual> result = new OWLNamedIndividualNodeSet();
if (!ce.isAnonymous()) {
OWLClass cls = ce.asOWLClass();
Set<OWLClass> clses = new HashSet<OWLClass>();
clses.add(cls);
if (!direct) {
clses.addAll(getSubClasses(cls, false).getFlattened());
}
for (OWLOntology ontology : getRootOntology().getImportsClosure()) {
for (OWLClass curCls : clses) {
for (OWLClassAssertionAxiom axiom : ontology.getClassAssertionAxioms(curCls)) {
OWLIndividual individual = axiom.getIndividual();
if (!individual.isAnonymous()) {
if (getIndividualNodeSetPolicy().equals(IndividualNodeSetPolicy.BY_SAME_AS)) {
result.addNode(getSameIndividuals(individual.asOWLNamedIndividual()));
}
else {
result.addNode(new OWLNamedIndividualNode(individual.asOWLNamedIndividual()));
}
}
}
}
}
}
return result;
}
示例8: getObjectPropertyValues
import org.semanticweb.owlapi.reasoner.impl.OWLNamedIndividualNodeSet; //导入依赖的package包/类
public NodeSet<OWLNamedIndividual> getObjectPropertyValues(OWLNamedIndividual ind, OWLObjectPropertyExpression pe) throws InconsistentOntologyException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException {
ensurePrepared();
OWLNamedIndividualNodeSet result = new OWLNamedIndividualNodeSet();
Node<OWLObjectPropertyExpression> inverses = getInverseObjectProperties(pe);
for (OWLOntology ontology : getRootOntology().getImportsClosure()) {
for (OWLObjectPropertyAssertionAxiom axiom : ontology.getObjectPropertyAssertionAxioms(ind)) {
if (!axiom.getObject().isAnonymous()) {
if (axiom.getProperty().getSimplified().equals(pe.getSimplified())) {
if (getIndividualNodeSetPolicy().equals(IndividualNodeSetPolicy.BY_SAME_AS)) {
result.addNode(getSameIndividuals(axiom.getObject().asOWLNamedIndividual()));
}
else {
result.addNode(new OWLNamedIndividualNode(axiom.getObject().asOWLNamedIndividual()));
}
}
}
// Inverse of pe
if (axiom.getObject().equals(ind) && !axiom.getSubject().isAnonymous()) {
OWLObjectPropertyExpression invPe = axiom.getProperty().getInverseProperty().getSimplified();
if (!invPe.isAnonymous() && inverses.contains(invPe.asOWLObjectProperty())) {
if (getIndividualNodeSetPolicy().equals(IndividualNodeSetPolicy.BY_SAME_AS)) {
result.addNode(getSameIndividuals(axiom.getObject().asOWLNamedIndividual()));
}
else {
result.addNode(new OWLNamedIndividualNode(axiom.getObject().asOWLNamedIndividual()));
}
}
}
}
}
// Could do other stuff like inspecting owl:hasValue restrictions
return result;
}
示例9: initReasoner
import org.semanticweb.owlapi.reasoner.impl.OWLNamedIndividualNodeSet; //导入依赖的package包/类
private void initReasoner() {
final OWLNamedIndividual node = dataFactory.getOWLNamedIndividual(
IRI.create(SUBJECT.toString() + ReferencedListTestHelper.SEQUENCE_NODE_SUFFIX + "0"));
final OWLNamedIndividual owner = dataFactory.getOWLNamedIndividual(IRI.create(SUBJECT.getIdentifier()));
final NodeSet<OWLNamedIndividual> nodeSet = new OWLNamedIndividualNodeSet(node);
when(reasonerMock.getObjectPropertyValues(owner, hasListProperty)).thenReturn(nodeSet);
final OWLNamedIndividual content = dataFactory.getOWLNamedIndividual(IRI.create(LIST_ITEMS.get(0)));
final NodeSet<OWLNamedIndividual> valueSet = new OWLNamedIndividualNodeSet(content);
when(reasonerMock.getObjectPropertyValues(node, hasContentProperty)).thenReturn(valueSet);
when(reasonerMock.getObjectPropertyValues(node, hasNextProperty)).thenReturn(new OWLNamedIndividualNodeSet());
}
示例10: loadsInferredObjectPropertyValues
import org.semanticweb.owlapi.reasoner.impl.OWLNamedIndividualNodeSet; //导入依赖的package包/类
@Test
public void loadsInferredObjectPropertyValues() {
final URI opUri = URI.create("http://krizik.felk.cvut.cz/PropertyOne");
final Assertion op = Assertion.createObjectPropertyAssertion(opUri, true);
final OWLObjectProperty owlOp = dataFactory.getOWLObjectProperty(IRI.create(opUri));
final NodeSet<OWLNamedIndividual> individuals = new OWLNamedIndividualNodeSet(
dataFactory.getOWLNamedIndividual(IRI.create("http://krizik.felk.cvut.cz/IndividialOne")));
when(reasonerMock.getObjectPropertyValues(individual, owlOp)).thenReturn(individuals);
final Collection<Axiom<?>> result = axiomLoader.findAxioms(descriptor(op));
for (Axiom<?> ax : result) {
assertEquals(op, ax.getAssertion());
}
}
示例11: convertIndividualNodes
import org.semanticweb.owlapi.reasoner.impl.OWLNamedIndividualNodeSet; //导入依赖的package包/类
public OWLNamedIndividualNodeSet convertIndividualNodes(
Iterable<? extends Node<ElkNamedIndividual>> nodes) {
Set<org.semanticweb.owlapi.reasoner.Node<OWLNamedIndividual>> owlNodes = new HashSet<org.semanticweb.owlapi.reasoner.Node<OWLNamedIndividual>>();
for (Node<ElkNamedIndividual> node : nodes) {
owlNodes.add(convertIndividualNode(node));
}
return new OWLNamedIndividualNodeSet(owlNodes);
}
示例12: getInstances
import org.semanticweb.owlapi.reasoner.impl.OWLNamedIndividualNodeSet; //导入依赖的package包/类
public NodeSet<OWLNamedIndividual> getInstances(OWLClassExpression classExpression,
boolean arg1) {
//TODO Indirect and Arbitrary Class Expr
Set<OWLNamedIndividual> individuals = rootOntology.getIndividualsInSignature(Imports.INCLUDED);
OWLNamedIndividualNodeSet result = new OWLNamedIndividualNodeSet ();
for (OWLNamedIndividual individual : individuals) {
OWLClassAssertionAxiom impl = new OWLClassAssertionAxiomImpl (individual, classExpression, new HashSet<OWLAnnotation> ());
if(isEntailed(impl)) {
result.addEntity(individual);
}
}
return result;
}
示例13: translateSSI
import org.semanticweb.owlapi.reasoner.impl.OWLNamedIndividualNodeSet; //导入依赖的package包/类
public NodeSet<OWLNamedIndividual> translateSSI(Set<Set<IntegerNamedIndividual>> integerObject) {
Objects.requireNonNull(integerObject);
Set<Node<OWLNamedIndividual>> setOfNodes = new HashSet<>();
integerObject.forEach(intSet -> {
setOfNodes.add(translateSI(intSet));
});
return new OWLNamedIndividualNodeSet(setOfNodes);
}
示例14: getDifferentIndividuals
import org.semanticweb.owlapi.reasoner.impl.OWLNamedIndividualNodeSet; //导入依赖的package包/类
@SuppressWarnings("unused")
public NodeSet<OWLNamedIndividual> getDifferentIndividuals(OWLNamedIndividual ind) throws InconsistentOntologyException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException {
return new OWLNamedIndividualNodeSet();
}
示例15: getObjectPropertyValues
import org.semanticweb.owlapi.reasoner.impl.OWLNamedIndividualNodeSet; //导入依赖的package包/类
public NodeSet<OWLNamedIndividual> getObjectPropertyValues(
OWLNamedIndividual arg0, OWLObjectPropertyExpression arg1) {
// TODO Auto-generated method stub
return new OWLNamedIndividualNodeSet();
}