本文整理汇总了Java中org.semanticweb.owlapi.model.OWLObjectPropertyAssertionAxiom类的典型用法代码示例。如果您正苦于以下问题:Java OWLObjectPropertyAssertionAxiom类的具体用法?Java OWLObjectPropertyAssertionAxiom怎么用?Java OWLObjectPropertyAssertionAxiom使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OWLObjectPropertyAssertionAxiom类属于org.semanticweb.owlapi.model包,在下文中一共展示了OWLObjectPropertyAssertionAxiom类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getExpressions
import org.semanticweb.owlapi.model.OWLObjectPropertyAssertionAxiom; //导入依赖的package包/类
private Set<OWLObjectSomeValuesFrom> getExpressions(OWLNamedIndividual i, OWLOntology model) {
Set<OWLObjectSomeValuesFrom> result = new HashSet<OWLObjectSomeValuesFrom>();
Set<OWLObjectPropertyAssertionAxiom> axioms = model.getObjectPropertyAssertionAxioms(i);
for (OWLObjectPropertyAssertionAxiom ax : axioms) {
if (enabledBy.equals(ax.getProperty())) {
continue;
}
OWLIndividual object = ax.getObject();
if (object.isNamed()) {
Set<OWLClass> types = getTypes(object.asOWLNamedIndividual(), model);
for (OWLClass cls : types) {
result.add(createSvf(ax.getProperty(), cls));
}
}
}
return result;
}
示例2: renderObject
import org.semanticweb.owlapi.model.OWLObjectPropertyAssertionAxiom; //导入依赖的package包/类
/**
* @param opa
* @return Map to be passed to Gson
*/
public JsonOwlFact renderObject(OWLObjectPropertyAssertionAxiom opa) {
OWLNamedIndividual subject;
OWLObjectProperty property;
OWLNamedIndividual object;
JsonOwlFact fact = null;
if (opa.getSubject().isNamed() && opa.getObject().isNamed() && opa.getProperty().isAnonymous() == false) {
subject = opa.getSubject().asOWLNamedIndividual();
property = opa.getProperty().asOWLObjectProperty();
object = opa.getObject().asOWLNamedIndividual();
fact = new JsonOwlFact();
fact.subject = curieHandler.getCuri(subject);
fact.property = curieHandler.getCuri(property);
fact.propertyLabel = graph.getLabel(property);
fact.object = curieHandler.getCuri(object);
JsonAnnotation[] anObjs = renderAnnotations(opa.getAnnotations(), curieHandler);
if (anObjs != null && anObjs.length > 0) {
fact.annotations = anObjs;
}
}
return fact;
}
示例3: removeFact
import org.semanticweb.owlapi.model.OWLObjectPropertyAssertionAxiom; //导入依赖的package包/类
public Set<IRI> removeFact(ModelContainer model, OWLObjectPropertyExpression p,
OWLIndividual i, OWLIndividual j, METADATA metadata) {
OWLDataFactory f = model.getOWLDataFactory();
OWLOntology ont = model.getAboxOntology();
OWLAxiom toRemove = null;
Set<IRI> iriSet = new HashSet<IRI>();
Set<OWLObjectPropertyAssertionAxiom> candidates = ont.getObjectPropertyAssertionAxioms(i);
for (OWLObjectPropertyAssertionAxiom axiom : candidates) {
if (p.equals(axiom.getProperty()) && j.equals(axiom.getObject())) {
toRemove = axiom;
extractEvidenceIRIValues(axiom.getAnnotations(), iriSet);
break;
}
}
if (toRemove == null) {
// fall back solution
toRemove = f.getOWLObjectPropertyAssertionAxiom(p, i, j);
}
removeAxiom(model, toRemove, metadata);
return iriSet;
}
示例4: updateAnnotation
import org.semanticweb.owlapi.model.OWLObjectPropertyAssertionAxiom; //导入依赖的package包/类
OWLObjectPropertyAssertionAxiom updateAnnotation(ModelContainer model,
OWLObjectPropertyAssertionAxiom toModify, OWLAnnotation update,
METADATA metadata) {
OWLObjectPropertyAssertionAxiom newAxiom = null;
if (toModify != null) {
Set<OWLAnnotation> combindedAnnotations = new HashSet<OWLAnnotation>();
OWLAnnotationProperty target = update.getProperty();
for(OWLAnnotation existing : toModify.getAnnotations()) {
if (target.equals(existing.getProperty()) == false) {
combindedAnnotations.add(existing);
}
}
combindedAnnotations.add(update);
newAxiom = modifyAnnotations(toModify, combindedAnnotations, model, metadata);
}
return newAxiom;
}
示例5: removeAnnotations
import org.semanticweb.owlapi.model.OWLObjectPropertyAssertionAxiom; //导入依赖的package包/类
public OWLObjectPropertyAssertionAxiom removeAnnotations(ModelContainer model, OWLObjectPropertyExpression p,
OWLNamedIndividual i, OWLNamedIndividual j, Set<OWLAnnotation> annotations, METADATA metadata) {
OWLOntology ont = model.getAboxOntology();
Set<OWLObjectPropertyAssertionAxiom> axioms = ont.getObjectPropertyAssertionAxioms(i);
OWLObjectPropertyAssertionAxiom toModify = null;
for (OWLObjectPropertyAssertionAxiom axiom : axioms) {
if (p.equals(axiom.getProperty()) && j.equals(axiom.getObject())) {
toModify = axiom;
break;
}
}
OWLObjectPropertyAssertionAxiom newAxiom = null;
if (toModify != null) {
Set<OWLAnnotation> combindedAnnotations = new HashSet<OWLAnnotation>(toModify.getAnnotations());
combindedAnnotations.removeAll(annotations);
newAxiom = modifyAnnotations(toModify, combindedAnnotations, model, metadata);
}
return newAxiom;
}
示例6: deleteFactCommand
import org.semanticweb.owlapi.model.OWLObjectPropertyAssertionAxiom; //导入依赖的package包/类
@Deprecated
public void deleteFactCommand() throws IOException, OWLOntologyCreationException, OWLOntologyStorageException, UnknownOWLClassException {
if (isHelp()) {
info("generates ClassAssertion");
return;
}
OWLOntology ont = resolveOntology(Param.ontology);
OWLIndividual i = resolveIndividual(Param.individualId);
OWLIndividual j = resolveIndividual(Param.fillerId);
OWLObjectProperty p = resolveObjectProperty(Param.propertyId);
for (OWLObjectPropertyAssertionAxiom ax : ont.getAxioms(AxiomType.OBJECT_PROPERTY_ASSERTION)) {
if (ax.getSubject().equals(i)) {
if (p == null || ax.getProperty().equals(p)) {
if (j == null || ax.getObject().equals(j)) {
removeAxiom(ont, graph.getDataFactory().getOWLObjectPropertyAssertionAxiom(p, i, j));
}
}
}
}
String jsonStr = "";
response.getWriter().write(jsonStr);
}
示例7: findProcesses
import org.semanticweb.owlapi.model.OWLObjectPropertyAssertionAxiom; //导入依赖的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;
}
示例8: findLocations
import org.semanticweb.owlapi.model.OWLObjectPropertyAssertionAxiom; //导入依赖的package包/类
private Map<OWLClass, Pair<OWLNamedIndividual, Set<OWLAnnotation>>> findLocations(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 (occursIn.equals(axiom.getProperty()) && mf.equals(axiom.getSubject())) {
// relevant axiom
OWLIndividual locationCandidate = axiom.getObject();
if (locationCandidate.isNamed()) {
OWLNamedIndividual named = locationCandidate.asOWLNamedIndividual();
Set<OWLClass> locationTypes = getTypes(named);
for (OWLClass locationType : locationTypes) {
result.put(locationType, Pair.of(named, getAnnotations(axiom, named)));
}
}
}
}
return result;
}
示例9: trEdge
import org.semanticweb.owlapi.model.OWLObjectPropertyAssertionAxiom; //导入依赖的package包/类
/**
* @param i - source
* @param supc - target expression (e.g. R some B)
* @return OWLObjectPropertyAssertionAxiom or null
*/
private OWLObjectPropertyAssertionAxiom trEdge(OWLIndividual i, OWLClassExpression supc) {
if (supc instanceof OWLObjectSomeValuesFrom) {
OWLObjectSomeValuesFrom svf = (OWLObjectSomeValuesFrom)supc;
OWLObjectPropertyExpression p = trTypeLevel(svf.getProperty());
OWLIndividual j;
if (svf.getFiller().isAnonymous()) {
j = anonClassToIndividual(svf.getFiller());
add(trEdge(j, svf.getFiller()));
}
else {
j = classToIndividual((OWLClass)svf.getFiller());
}
OWLObjectPropertyAssertionAxiom e = getOWLDataFactory().getOWLObjectPropertyAssertionAxiom(p, i, j);
return e;
}
return null;
}
示例10: visit
import org.semanticweb.owlapi.model.OWLObjectPropertyAssertionAxiom; //导入依赖的package包/类
public void visit(OWLObjectPropertyAssertionAxiom objPropertyAssertion) {
OWLObjectProperty property = objPropertyAssertion.getProperty().asOWLObjectProperty();
OWLNamedIndividual subject = objPropertyAssertion.getSubject().asOWLNamedIndividual();
OWLNamedIndividual object = objPropertyAssertion.getObject().asOWLNamedIndividual();
String propertyName = mapper.getPredicateName(property);
String subjectName = mapper.getConstantName(subject);
String objectName = mapper.getConstantName(object);
writer.print(propertyName);
writer.print(ASP2CoreSymbols.BRACKET_OPEN);
writer.print(subjectName);
writer.print(ASP2CoreSymbols.ARG_SEPERATOR);
writer.print(objectName);
writer.print(ASP2CoreSymbols.BRACKET_CLOSE);
writer.print(ASP2CoreSymbols.EOR);
}
示例11: converterPpiOWL
import org.semanticweb.owlapi.model.OWLObjectPropertyAssertionAxiom; //导入依赖的package包/类
/**
* Genera los axiomas correspondientes a un PPI
*
* @param element Objeto del modelo del PPI
* @param bpmn20ModelHandler Manejador del modelo BPMN correspondiente al mismo proceso del PPI
* @return Objeto OWL de la medida
* @throws Exception
*/
void converterPpiOWL(PPI element, Bpmn20ModelHandlerInterface bpmn20ModelHandler) throws Exception {
String ppiId = element.getId();
MeasureDefinition measuredBy = element.getMeasuredBy();
String measureId = measuredBy.getId();
// adiciona el axioma que indica la clase del PPI
OWLNamedIndividual ppiIndividual = factory.getOWLNamedIndividual( IRI.create(ppinotGeneratedOntologyURI+"#"+ppiId) );
OWLClass ppiClass = factory.getOWLClass( IRI.create(Vocabulary.PPI_URI));
OWLClassAssertionAxiom ppiClassAxiom = factory.getOWLClassAssertionAxiom(ppiClass, ppiIndividual);
manager.addAxiom(ontology, ppiClassAxiom);
// adiciona el axioma con la relacion entre el PPI y la medida
OWLObjectPropertyExpression definition = factory.getOWLObjectProperty(IRI.create(Vocabulary.DEFINITION_URI));
OWLNamedIndividual measureIndividual = factory.getOWLNamedIndividual( IRI.create(ppinotGeneratedOntologyURI+"#"+measureId) );
OWLObjectPropertyAssertionAxiom definitionAxiom = factory.getOWLObjectPropertyAssertionAxiom(definition, ppiIndividual, measureIndividual);
manager.addAxiom(ontology, definitionAxiom);
}
示例12: generateDependentOWLIndividual
import org.semanticweb.owlapi.model.OWLObjectPropertyAssertionAxiom; //导入依赖的package包/类
private OWLObject generateDependentOWLIndividual(Owlbuilder builder,
PropertyTerm childProperty,
OWLIndividual headInd,
OWLObject childObject,
Map<String,OWLObject> names) throws Exception{
final OWLDataFactory factory = builder.getDataFactory();
OWLObjectProperty elementProperty = (OWLObjectProperty)childProperty.generateOWL(builder,names);
log.info("Generated Individual reference: " + headInd);
if (childObject != null){
if (childObject instanceof OWLIndividual){
OWLIndividual childIndividual = (OWLIndividual)childObject;
OWLObjectPropertyAssertionAxiom assertion =
factory.getOWLObjectPropertyAssertionAxiom(elementProperty, headInd, childIndividual);
// Finally, add the axiom to our ontology and save
AddAxiom addAxiomChange = new AddAxiom(builder.getTarget(), assertion);
builder.getOntologyManager().applyChange(addAxiomChange);
}
else { //child is class expression?
log.info("class child of individual");
}
}
return headInd; //TODO finish implementing individual case
}
示例13: updateAnnotationsForDelete
import org.semanticweb.owlapi.model.OWLObjectPropertyAssertionAxiom; //导入依赖的package包/类
private void updateAnnotationsForDelete(DeleteInformation info, ModelContainer model, String userId, Set<String> providerGroups, UndoMetadata token, UndoAwareMolecularModelManager m3) throws UnknownIdentifierException {
final OWLDataFactory f = model.getOWLDataFactory();
final OWLAnnotation annotation = createDateAnnotation(f);
final Set<OWLAnnotation> generated = new HashSet<OWLAnnotation>();
addGeneratedAnnotations(userId, providerGroups, generated, f);
for(IRI subject : info.touched) {
m3.updateAnnotation(model, subject, annotation, token);
m3.addAnnotations(model, subject, generated, token);
}
if (info.updated.isEmpty() == false) {
Set<OWLObjectPropertyAssertionAxiom> newAxioms =
m3.updateAnnotation(model, info.updated, annotation, token);
m3.addAnnotations(model, newAxioms, generated, token);
}
}
示例14: renderModel
import org.semanticweb.owlapi.model.OWLObjectPropertyAssertionAxiom; //导入依赖的package包/类
/**
* @return Map to be passed to Gson
*/
public JsonModel renderModel() {
JsonModel json = new JsonModel();
json.modelId = modelId;
// per-Individual
List<JsonOwlIndividual> iObjs = new ArrayList<JsonOwlIndividual>();
for (OWLNamedIndividual i : ont.getIndividualsInSignature()) {
iObjs.add(renderObject(i));
}
json.individuals = iObjs.toArray(new JsonOwlIndividual[iObjs.size()]);
// per-Assertion
Set<OWLObjectProperty> usedProps = new HashSet<OWLObjectProperty>();
List<JsonOwlFact> aObjs = new ArrayList<JsonOwlFact>();
for (OWLObjectPropertyAssertionAxiom opa : ont.getAxioms(AxiomType.OBJECT_PROPERTY_ASSERTION)) {
JsonOwlFact fact = renderObject(opa);
if (fact != null) {
aObjs.add(fact);
usedProps.addAll(opa.getObjectPropertiesInSignature());
}
}
json.facts = aObjs.toArray(new JsonOwlFact[aObjs.size()]);
JsonAnnotation[] anObjs = renderAnnotations(ont.getAnnotations(), curieHandler);
if (anObjs != null && anObjs.length > 0) {
json.annotations = anObjs;
}
return json;
}
示例15: createFact
import org.semanticweb.owlapi.model.OWLObjectPropertyAssertionAxiom; //导入依赖的package包/类
/**
* @param f
* @param p
* @param i
* @param j
* @param annotations
* @return axiom
*/
public static OWLObjectPropertyAssertionAxiom createFact(OWLDataFactory f,
OWLObjectPropertyExpression p, OWLIndividual i, OWLIndividual j,
Set<OWLAnnotation> annotations) {
final OWLObjectPropertyAssertionAxiom axiom;
if (annotations != null && !annotations.isEmpty()) {
axiom = f.getOWLObjectPropertyAssertionAxiom(p, i, j, annotations);
}
else {
axiom = f.getOWLObjectPropertyAssertionAxiom(p, i, j);
}
return axiom;
}