Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Removed deprecated method calls.
  • Loading branch information
LorenzBuehmann committed Jan 8, 2016
1 parent 8237758 commit 99f2328
Show file tree
Hide file tree
Showing 22 changed files with 57 additions and 56 deletions.
Expand Up @@ -283,10 +283,10 @@ private int addOntology(URI physicalURI, OWLOntology ontology){
insertOntologyPs.setInt(5, tbox.size());
insertOntologyPs.setInt(6, rbox.size());
insertOntologyPs.setInt(7, abox.size());
insertOntologyPs.setInt(8, ontology.getClassesInSignature(true).size());
insertOntologyPs.setInt(9, ontology.getObjectPropertiesInSignature(true).size());
insertOntologyPs.setInt(10, ontology.getDataPropertiesInSignature(true).size());
insertOntologyPs.setInt(11, ontology.getIndividualsInSignature(true).size());
insertOntologyPs.setInt(8, ontology.getClassesInSignature(Imports.INCLUDED).size());
insertOntologyPs.setInt(9, ontology.getObjectPropertiesInSignature(Imports.INCLUDED).size());
insertOntologyPs.setInt(10, ontology.getDataPropertiesInSignature(Imports.INCLUDED).size());
insertOntologyPs.setInt(11, ontology.getIndividualsInSignature(Imports.INCLUDED).size());
insertOntologyPs.execute();
} catch (SQLException e) {
e.printStackTrace();
Expand Down Expand Up @@ -343,7 +343,7 @@ public void start() {
Set<OWLAxiom> logicalAxioms = new HashSet<>();
for (AxiomType<?> type : AxiomType.AXIOM_TYPES) {
if(type.isLogical()){
logicalAxioms.addAll(ontology.getAxioms(type, true));
logicalAxioms.addAll(ontology.getAxioms(type, Imports.INCLUDED));
}
}
System.out.println(" (" + logicalAxioms.size() + " axioms)");
Expand Down
Expand Up @@ -155,7 +155,7 @@ public void visit(OWLObjectUnionOf desc) {
public void visit(OWLDataHasValue desc) {
OWLDataPropertyExpression property = desc.getProperty();
property = rename(property);
OWLLiteral value = desc.getValue();
OWLLiteral value = desc.getFiller();
value = rename(value);
renamedOWLObject = df.getOWLDataHasValue(property, value);
}
Expand Down Expand Up @@ -189,7 +189,7 @@ public void visit(OWLObjectAllValuesFrom desc) {
public void visit(OWLObjectHasValue desc) {
OWLObjectPropertyExpression property = desc.getProperty();
property = rename(property);
OWLIndividual value = desc.getValue();
OWLIndividual value = desc.getFiller();
value = rename(value);
renamedOWLObject = df.getOWLObjectHasValue(property, value);
}
Expand Down
Expand Up @@ -227,7 +227,8 @@ private Set<OWLAxiom> asAnnotatedAxioms(Map<OWLAxiom, Score> axioms2Score){

public static void main(String[] args) throws Exception {
OWLDataFactoryImpl df = new OWLDataFactoryImpl();
PrefixManager pm = new DefaultPrefixManager("http://dllearner.org/pattern#");
PrefixManager pm = new DefaultPrefixManager();
pm.setDefaultPrefix("http://dllearner.org/pattern#");

Model model = ModelFactory.createDefaultModel();
String triples =
Expand Down
Expand Up @@ -13,9 +13,8 @@ public class Filters {
public static List<String> getSkosFilterProperties(){
List<String> filters = new ArrayList<>();

filters.add(SKOSVocabulary.COMMENT.getIRI().toString());
// filters.add(SKOSVocabulary.COMMENT.getIRI().toString());
filters.add(SKOSVocabulary.DEFINITION.getIRI().toString());
filters.add(SKOSVocabulary.COMMENT.getIRI().toString());
filters.add(SKOSVocabulary.PREFLABEL.getIRI().toString());
filters.add(SKOSVocabulary.ALTLABEL.getIRI().toString());

Expand Down
Expand Up @@ -20,6 +20,7 @@

import javax.xml.ws.http.HTTPException;

import com.hp.hpl.jena.graph.NodeFactory;
import org.aksw.jena_sparql_api.cache.core.QueryExecutionFactoryCacheEx;
import org.aksw.jena_sparql_api.cache.extra.CacheBackend;
import org.aksw.jena_sparql_api.cache.extra.CacheFrontend;
Expand Down Expand Up @@ -1303,7 +1304,7 @@ private String getSPARQLQuery(String queryString, int nodeId, String label){
if(current.getObject().toString().equals(label)){
node = current.getObject();
position = ((ElementTriplesBlock) el).getPattern().getList().indexOf(current);
add = Triple.create(current.getSubject(), current.getPredicate(), Node.createVariable("x" + nodeId));
add = Triple.create(current.getSubject(), current.getPredicate(), NodeFactory.createVariable("x" + nodeId));
iter.remove();
}
}
Expand Down
Expand Up @@ -142,7 +142,7 @@ public Set<Triple> getTriples() {
*/
@Override
public String toString() {
return super.toString();
return root + "" + triples;
}
}

Expand Down
Expand Up @@ -317,7 +317,8 @@ public Set<OWLDataRange> visit(OWLDatatypeRestriction dr) {
public static void main(String[] args) throws Exception {
StringRenderer.setRenderer(Rendering.MANCHESTER_SYNTAX);
OWLDataFactoryImpl df = new OWLDataFactoryImpl();
PrefixManager pm = new DefaultPrefixManager(":");
PrefixManager pm = new DefaultPrefixManager();
pm.setDefaultPrefix(":");
OWLClass A = df.getOWLClass("A", pm );
OWLDataProperty s = df.getOWLDataProperty("s", pm);
OWLDataProperty t = df.getOWLDataProperty("t", pm);
Expand Down
Expand Up @@ -472,7 +472,8 @@ public static void main(String[] args) throws Exception {
StringRenderer.setRenderer(Rendering.DL_SYNTAX);
OWLOntologyManager man = OWLManager.createOWLOntologyManager();
OWLDataFactory df = man.getOWLDataFactory();
PrefixManager pm = new DefaultPrefixManager("http://example.org/");
PrefixManager pm = new DefaultPrefixManager();
pm.setDefaultPrefix("http://example.org/");
OWLClassExpression ce = df.getOWLObjectIntersectionOf(
df.getOWLClass("A", pm),
df.getOWLObjectSomeValuesFrom(
Expand Down
Expand Up @@ -14,6 +14,7 @@
import org.semanticweb.owlapi.model.OWLObjectProperty;
import org.semanticweb.owlapi.model.OWLObjectPropertyAssertionAxiom;
import org.semanticweb.owlapi.model.OWLOntology;
import org.semanticweb.owlapi.model.parameters.Imports;
import org.semanticweb.owlapi.reasoner.NodeSet;
import org.semanticweb.owlapi.reasoner.OWLReasoner;
import org.semanticweb.owlapi.reasoner.structural.StructuralReasonerFactory;
Expand All @@ -37,7 +38,7 @@ public static void getEntityDependencyMatrix(OWLOntology ontology) {
OWLReasoner reasoner = new StructuralReasonerFactory().createNonBufferingReasoner(ontology);

// how often are individuals of class A related to individuals of class B
Set<OWLClass> classes = ontology.getClassesInSignature(true);
Set<OWLClass> classes = ontology.getClassesInSignature(Imports.INCLUDED);
for (OWLClass clsA : classes) {
for (OWLClass clsB : classes) {
if(!clsA.equals(clsB)) {
Expand Down
Expand Up @@ -35,9 +35,7 @@
*/
public abstract class AbstractHeuristic extends AbstractComponent implements Heuristic, Comparator<OENode>{

public AbstractHeuristic() {

}
public AbstractHeuristic() {}

@Override
public void init() throws ComponentInitException {
Expand Down
Expand Up @@ -122,7 +122,7 @@ public interface SchemaReasoner {
*
* @return The subsumption hierarchy of this knowledge base.
*/
Hierarchy getClassHierarchy();
Hierarchy<OWLClassExpression> getClassHierarchy();

/**
* Returns direct super classes in the class hierarchy.
Expand Down
Expand Up @@ -19,20 +19,13 @@

package org.dllearner.kb.extraction;

import java.io.File;

import org.apache.log4j.Logger;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.AddAxiom;
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLAxiom;
import org.semanticweb.owlapi.model.OWLDataFactory;
import org.semanticweb.owlapi.model.OWLOntology;
import org.semanticweb.owlapi.model.OWLOntologyChangeException;
import org.semanticweb.owlapi.model.OWLOntologyCreationException;
import org.semanticweb.owlapi.model.OWLOntologyManager;
import org.semanticweb.owlapi.model.*;
import org.semanticweb.owlapi.util.SimpleIRIMapper;

import java.io.File;

public class OWLAPIOntologyCollector {

private static Logger logger = Logger.getLogger(OWLAPIOntologyCollector.class);
Expand All @@ -53,7 +46,7 @@ public OWLAPIOntologyCollector(String ontologyIRI, String physicalIRI){
this.ontologyIRI = IRI.create(ontologyIRI);
this.physicalIRI = IRI.create(new File(physicalIRI));
SimpleIRIMapper mapper = new SimpleIRIMapper(this.ontologyIRI, this.physicalIRI);
this.manager.addIRIMapper(mapper);
this.manager.getIRIMappers().add(mapper);
try{
this.currentOntology = manager.createOntology(this.ontologyIRI);
}catch(OWLOntologyCreationException e){
Expand Down
Expand Up @@ -1186,7 +1186,7 @@ public SortedSet<OWLIndividual> getIndividualsImplFast(OWLClassExpression descri
return returnSet;
} else if (description instanceof OWLObjectHasValue) {
OWLObjectPropertyExpression property = ((OWLObjectHasValue) description).getProperty();
OWLIndividual value = ((OWLObjectHasValue)description).getValue();
OWLIndividual value = ((OWLObjectHasValue)description).getFiller();

if (property.isAnonymous()) {
throw new ReasoningMethodUnsupportedException("Retrieval for OWLClassExpression "
Expand Down Expand Up @@ -1271,7 +1271,7 @@ public SortedSet<OWLIndividual> getIndividualsImplFast(OWLClassExpression descri
}
} else if (description instanceof OWLDataHasValue){
OWLDataPropertyExpression property = ((OWLDataHasValue) description).getProperty();
OWLLiteral value = ((OWLDataHasValue) description).getValue();
OWLLiteral value = ((OWLDataHasValue) description).getFiller();

SortedSet<OWLIndividual> returnSet = new TreeSet<>();

Expand Down
Expand Up @@ -14,6 +14,7 @@

import com.google.common.collect.Sets;

import org.semanticweb.owlapi.model.parameters.Imports;
import uk.ac.manchester.cs.owl.owlapi.OWLObjectPropertyImpl;

/**
Expand Down Expand Up @@ -55,8 +56,8 @@ public static boolean hasPunning(OWLOntology ontology, OWLClass cls){
* @return TRUE if there is at least one entity that is both, class and individual, otherwise FALSE
*/
public static boolean hasPunning(OWLOntology ontology){
Set<OWLClass> classes = ontology.getClassesInSignature(true);
Set<OWLNamedIndividual> individuals = ontology.getIndividualsInSignature(true);
Set<OWLClass> classes = ontology.getClassesInSignature(Imports.INCLUDED);
Set<OWLNamedIndividual> individuals = ontology.getIndividualsInSignature(Imports.INCLUDED);

Set<IRI> classIRIs = new HashSet<>(classes.size());
for (OWLClass cls : classes) {
Expand Down
Expand Up @@ -80,6 +80,7 @@
import org.semanticweb.owlapi.model.OWLOntology;
import org.semanticweb.owlapi.model.OWLSameIndividualAxiom;
import org.semanticweb.owlapi.model.OWLSubClassOfAxiom;
import org.semanticweb.owlapi.model.parameters.AxiomAnnotations;
import org.semanticweb.owlapi.reasoner.AxiomNotInProfileException;
import org.semanticweb.owlapi.reasoner.BufferingMode;
import org.semanticweb.owlapi.reasoner.ClassExpressionNotInProfileException;
Expand Down Expand Up @@ -112,6 +113,8 @@
import org.semanticweb.owlapi.util.OWLObjectPropertyManager;
import org.semanticweb.owlapi.util.Version;

import static org.semanticweb.owlapi.model.parameters.Imports.INCLUDED;

/**
* Author: Matthew Horridge<br>
* The University of Manchester<br>
Expand Down Expand Up @@ -253,7 +256,7 @@ public Node<OWLClass> getUnsatisfiableClasses() throws ReasonerInterruptedExcept

@Override
public boolean isEntailed(OWLAxiom axiom) throws ReasonerInterruptedException, UnsupportedEntailmentTypeException, TimeOutException, AxiomNotInProfileException, FreshEntitiesException, InconsistentOntologyException {
boolean containsAxiom = getRootOntology().containsAxiom(axiom, true);
boolean containsAxiom = getRootOntology().containsAxiom(axiom, INCLUDED, AxiomAnnotations.IGNORE_AXIOM_ANNOTATIONS);

if(containsAxiom){
return true;
Expand All @@ -276,7 +279,7 @@ public boolean isEntailed(OWLAxiom axiom) throws ReasonerInterruptedException, U
clses.addAll(getSubClasses(cls, false).getFlattened());

for (OWLClass curCls : clses) {
boolean contained = getRootOntology().containsAxiom(df.getOWLClassAssertionAxiom(curCls, individual), true);
boolean contained = getRootOntology().containsAxiom(df.getOWLClassAssertionAxiom(curCls, individual), INCLUDED, AxiomAnnotations.IGNORE_AXIOM_ANNOTATIONS);
if (contained) {
return true;
}
Expand Down Expand Up @@ -304,7 +307,7 @@ public boolean isEntailed(OWLAxiom axiom) throws ReasonerInterruptedException, U

OWLClassExpression filler = ((OWLObjectSomeValuesFrom) ce).getFiller();

Set<OWLIndividualAxiom> axioms = getRootOntology().getAxioms(individual);
Set<OWLIndividualAxiom> axioms = getRootOntology().getAxioms(individual, INCLUDED);

for (OWLIndividualAxiom curAx : axioms) {
if(curAx instanceof OWLObjectPropertyAssertionAxiom &&
Expand All @@ -325,7 +328,8 @@ public boolean isEntailed(OWLAxiom axiom) throws ReasonerInterruptedException, U
@Override
public boolean isEntailed(Set<? extends OWLAxiom> axioms) throws ReasonerInterruptedException, UnsupportedEntailmentTypeException, TimeOutException, AxiomNotInProfileException, FreshEntitiesException, InconsistentOntologyException {
for (OWLAxiom ax : axioms) {
if (!getRootOntology().containsAxiomIgnoreAnnotations(ax, true)) {
assert ax != null;
if (!getRootOntology().containsAxiom(ax, INCLUDED, AxiomAnnotations.IGNORE_AXIOM_ANNOTATIONS)) {
return false;
}
}
Expand Down Expand Up @@ -440,7 +444,7 @@ public NodeSet<OWLObjectPropertyExpression> getDisjointObjectProperties(OWLObjec
@Override
public Node<OWLObjectPropertyExpression> getInverseObjectProperties(OWLObjectPropertyExpression pe) throws InconsistentOntologyException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException {
ensurePrepared();
OWLObjectPropertyExpression inv = pe.getInverseProperty().getSimplified();
OWLObjectPropertyExpression inv = pe.getInverseProperty();
return getEquivalentObjectProperties(inv);
}

Expand Down Expand Up @@ -667,7 +671,7 @@ public NodeSet<OWLNamedIndividual> getObjectPropertyValues(OWLNamedIndividual in
for (OWLOntology ontology : getRootOntology().getImportsClosure()) {
for (OWLObjectPropertyAssertionAxiom axiom : ontology.getObjectPropertyAssertionAxioms(ind)) {
if (!axiom.getObject().isAnonymous()) {
if (axiom.getProperty().getSimplified().equals(pe.getSimplified())) {
if (axiom.getProperty().equals(pe)) {
if (getIndividualNodeSetPolicy().equals(IndividualNodeSetPolicy.BY_SAME_AS)) {
result.addNode(getSameIndividuals(axiom.getObject().asOWLNamedIndividual()));
}
Expand All @@ -678,7 +682,7 @@ public NodeSet<OWLNamedIndividual> getObjectPropertyValues(OWLNamedIndividual in
}
// Inverse of pe
if (axiom.getObject().equals(ind) && !axiom.getSubject().isAnonymous()) {
OWLObjectPropertyExpression invPe = axiom.getProperty().getInverseProperty().getSimplified();
OWLObjectPropertyExpression invPe = axiom.getProperty().getInverseProperty();
if (!invPe.isAnonymous() && inverses.contains(invPe.asOWLObjectProperty())) {
if (getIndividualNodeSetPolicy().equals(IndividualNodeSetPolicy.BY_SAME_AS)) {
result.addNode(getSameIndividuals(axiom.getObject().asOWLNamedIndividual()));
Expand Down
Expand Up @@ -739,7 +739,7 @@ public Set<OWLClassExpression> refine(OWLClassExpression description, int maxLen

} else if (description instanceof OWLDataHasValue) {
OWLDataPropertyExpression dp = ((OWLDataHasValue) description).getProperty();
OWLLiteral value = ((OWLDataHasValue) description).getValue();
OWLLiteral value = ((OWLDataHasValue) description).getFiller();

if(!dp.isAnonymous()){
Set<OWLDataProperty> subDPs = dataPropertyHierarchy.getMoreSpecialRoles(dp.asOWLDataProperty());
Expand Down
Expand Up @@ -994,14 +994,14 @@ else if (d.isOWLNothing())
case OBJECT_HAS_VALUE:

OWLObjectHasValue hasValue = (OWLObjectHasValue) c;
OWLIndividual i = hasValue.getValue();
OWLIndividual i = hasValue.getFiller();
p = hasValue.getProperty();
return getObjectHasValueName(p, i);

case DATA_HAS_VALUE:

OWLDataHasValue dataHasValue = (OWLDataHasValue) c;
OWLLiteral lit = dataHasValue.getValue();
OWLLiteral lit = dataHasValue.getFiller();
dp = dataHasValue.getProperty();
return getDataHasValueName(dp, lit);

Expand Down
Expand Up @@ -5,6 +5,7 @@

import org.semanticweb.owlapi.model.*;

import org.semanticweb.owlapi.model.parameters.Imports;
import uk.ac.manchester.cs.owl.owlapi.OWLClassImpl;
import uk.ac.manchester.cs.owl.owlapi.OWLNamedIndividualImpl;

Expand Down Expand Up @@ -136,7 +137,7 @@ public void visit(OWLNamedIndividual individual) {
visitedIndividuals.add(individual);

currentDepth++;
Set<OWLIndividualAxiom> axioms = ontology.getAxioms(individual);
Set<OWLIndividualAxiom> axioms = ontology.getAxioms(individual, Imports.INCLUDED);
for (OWLIndividualAxiom ax : axioms) {
ax.accept(this);
}
Expand All @@ -160,7 +161,7 @@ public void visit(OWLObjectProperty property) {
if(!visitedProperties.contains(property)){
visitedProperties.add(property);

Set<OWLObjectPropertyAxiom> axioms = ontology.getAxioms(property);
Set<OWLObjectPropertyAxiom> axioms = ontology.getAxioms(property, Imports.INCLUDED);
for (OWLObjectPropertyAxiom ax : axioms) {
ax.accept(this);
}
Expand All @@ -182,7 +183,7 @@ public void visit(OWLDataProperty property) {
if(!visitedProperties.contains(property)){
visitedProperties.add(property);

Set<OWLDataPropertyAxiom> axioms = ontology.getAxioms(property);
Set<OWLDataPropertyAxiom> axioms = ontology.getAxioms(property, Imports.INCLUDED);
for (OWLDataPropertyAxiom ax : axioms) {
ax.accept(this);
}
Expand Down
Expand Up @@ -252,7 +252,8 @@ public static void main(String[] args) throws Exception {

OWLOntologyManager man = OWLManager.createOWLOntologyManager();
OWLDataFactory df = man.getOWLDataFactory();
PrefixManager pm = new DefaultPrefixManager("http://dbpedia.org/ontology/");
PrefixManager pm = new DefaultPrefixManager();
pm.setDefaultPrefix("http://dbpedia.org/ontology/");

OWLClass clsA = df.getOWLClass("A", pm);
OWLClass clsB = df.getOWLClass("B", pm);
Expand Down
Expand Up @@ -365,7 +365,7 @@ public void visit(OWLObjectAllValuesFrom ce) {
@Override
public void visit(OWLObjectHasValue ce) {
OWLObjectPropertyExpression propertyExpression = ce.getProperty();
OWLNamedIndividual value = ce.getValue().asOWLNamedIndividual();
OWLNamedIndividual value = ce.getFiller().asOWLNamedIndividual();
if(propertyExpression.isAnonymous()){
//property expression is inverse of a property
sparql += triple(value.toStringID(), propertyExpression.getNamedProperty(), variables.peek());
Expand Down Expand Up @@ -523,7 +523,7 @@ public void visit(OWLDataAllValuesFrom ce) {
@Override
public void visit(OWLDataHasValue ce) {
OWLDataPropertyExpression propertyExpression = ce.getProperty();
OWLLiteral value = ce.getValue();
OWLLiteral value = ce.getFiller();
sparql += triple(variables.peek(), propertyExpression.asOWLDataProperty(), value);
}

Expand Down Expand Up @@ -622,7 +622,8 @@ public static void main(String[] args) throws Exception {

OWLOntologyManager man = OWLManager.createOWLOntologyManager();
OWLDataFactory df = man.getOWLDataFactory();
PrefixManager pm = new DefaultPrefixManager("http://dbpedia.org/ontology/");
PrefixManager pm = new DefaultPrefixManager();
pm.setDefaultPrefix("http://dbpedia.org/ontology/");

OWLClass clsA = df.getOWLClass("A", pm);
OWLClass clsB = df.getOWLClass("B", pm);
Expand Down

0 comments on commit 99f2328

Please sign in to comment.