コード例 #1
0
 @Override
 public void removeSubDataProperty(String subDataPropertyName, String dataPropertyName) {
   OWLDataFactory factory = manager.getOWLDataFactory();
   OWLDataProperty dataProperty =
       factory.getOWLDataProperty(IRI.create(prefix + dataPropertyName));
   OWLDataProperty subDataProperty =
       factory.getOWLDataProperty(IRI.create(prefix + subDataPropertyName));
   OWLAxiom axiom = factory.getOWLSubDataPropertyOfAxiom(subDataProperty, dataProperty);
   axiom = changeManager.getAnnotatedAxiom(axiom);
   RemoveAxiom removeAxiom = new RemoveAxiom(localContext, axiom);
   try {
     synchronized (this) {
       changeManager.validateRemovalChange(axiom);
       manager.applyChange(removeAxiom);
     }
   } catch (RemovalException ex) {
     logger.severe(
         ex.getMessage()
             + " Change ( removeSubDataProperty "
             + subDataPropertyName
             + " of "
             + dataPropertyName
             + ") will not be applied.");
   }
 }
コード例 #2
0
 @Override
 public void removeDataProperty(String dataPropertyName) {
   OWLDataFactory factory = manager.getOWLDataFactory();
   OWLDataProperty dataProperty =
       factory.getOWLDataProperty(IRI.create(prefix + dataPropertyName));
   OWLAxiom axiom = factory.getOWLDeclarationAxiom(dataProperty);
   axiom = changeManager.getAnnotatedAxiom(axiom);
   List<OWLOntologyChange> changes = new ArrayList<OWLOntologyChange>();
   for (OWLAxiom ax : localContext.getReferencingAxioms(dataProperty)) {
     ax = ax.getAxiomWithoutAnnotations();
     ax = changeManager.getAnnotatedAxiom(ax);
     changes.add(new RemoveAxiom(localContext, ax));
   }
   try {
     synchronized (this) {
       changeManager.validateRemovalChange(axiom);
       manager.applyChanges(changes);
     }
   } catch (RemovalException ex) {
     logger.severe(
         ex.getMessage()
             + "Data property not defined in Ontology or not defined by "
             + "this application. Change ( removeDataProperty"
             + dataPropertyName
             + ") will not be applied. ");
   }
 }
コード例 #3
0
 @Override
 public void removeDataPropertyBooleanRange(String dataPropertyName) {
   OWLDataFactory factory = manager.getOWLDataFactory();
   OWLDataProperty dataProperty =
       factory.getOWLDataProperty(IRI.create(prefix + dataPropertyName));
   OWLDatatype booleanDatatype = factory.getBooleanOWLDatatype();
   OWLAxiom axiom = factory.getOWLDataPropertyRangeAxiom(dataProperty, booleanDatatype);
   axiom = changeManager.getAnnotatedAxiom(axiom);
   RemoveAxiom removeAxiom = new RemoveAxiom(localContext, axiom);
   try {
     synchronized (this) {
       changeManager.validateRemovalChange(axiom);
       manager.applyChange(removeAxiom);
     }
   } catch (RemovalException ex) {
     logger.severe(
         ex.getMessage()
             + " Change ( removeDataPropertyBooleanRange"
             + dataPropertyName
             + ") will not be applied.");
   }
 }