aboutsummaryrefslogtreecommitdiff
path: root/src/uk/ac/ox/cs/pagoda/rules/GeneralProgram.java
blob: 01ab427ed277455208e6e3af6abc88a6bebc4aea (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package uk.ac.ox.cs.pagoda.rules;

import org.apache.commons.io.FilenameUtils;
import org.semanticweb.HermiT.model.DLClause;
import org.semanticweb.owlapi.model.OWLOntology;
import uk.ac.ox.cs.pagoda.constraints.UnaryBottom;

import java.util.Collection;
import java.util.Collections;
import java.util.Set;

public class GeneralProgram extends Program {
	
	public GeneralProgram(Set<DLClause> relevantClauses, OWLOntology relevantOntology) {
		ontology = relevantOntology;
		
		ontologyDirectory = null; 
		dlOntology = null; 
		botStrategy = new UnaryBottom(); 
		
		clauses = botStrategy.process(relevantClauses); 
	}

	public GeneralProgram() {}

	public Collection<DLClause> convert2Clauses(DLClause clause) {
		return botStrategy.process(Collections.singleton(clause));
	}

	@Override
	public String getOutputPath() {
		return FilenameUtils.concat(getDirectory(), "rules.dlog");
	}

//	@Override
//	public String getDirectory() {
//		File dir = new File(ontologyDirectory + Utility.FILE_SEPARATOR + "general");
//		if (!dir.exists())
//			dir.mkdirs();
//		return dir.getPath();
//	}

	public boolean isHorn() {
		for (DLClause clause: clauses)
			if (clause.getHeadLength() > 1)
				return false;
		return true; 
	}

}