Skip to content

Commit

Permalink
fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
TortugaAttack committed May 14, 2021
1 parent 4ac73b9 commit 83eb09f
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 14 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ jobs:
run: mvn help:evaluate -Dexpression=major.minor.version -q -DforceStdout > version.log
- shell: bash
run: mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout > artifactid.log
- name: Set env version
run: echo "MM_VERSION=$(cat version.log)" >> $GITHUB_ENV
- name: Set env version
run: echo "RELEASE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- name: Set env name
Expand All @@ -38,8 +40,8 @@ jobs:
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./site
destination_dir: ./
publish_dir: ./site/${{ env.MM_VERSION }}
destination_dir: ./${{ env.MM_VERSION }}
- run: mvn package -Dmaven.test.skip=true
- name: Create Release
id: create_release
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# CHANGELOG version 2.0.1

## General Changes

## Added Features

## Removed Features

## Issues fixed

* Concept creator threw error if domain/range of property is complex expression fixed.

# CHANGELOG version 2.0.0

## General Changes
Expand Down
2 changes: 1 addition & 1 deletion docs/Getting-Started/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ sudo apt-get install java
To download LPBenchGen get the latest release [here](https://github.com/dice-group/LPBenchGen/releases/latest).

```bash
wget https://github.com/dice-group/LPBenchGen/releases/{{ release_version }}/lpbenchgen-{{ version }}.jar
wget https://github.com/dice-group/LPBenchGen/releases/download/v{{ release_version }}/lpbenchgen-{{ release_version }}.jar
```

2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<major.minor.version>${major.version}.${minor.version}</major.minor.version>
<major.version>2</major.version>
<minor.version>0</minor.version>
<build.version>0</build.version>
<build.version>1</build.version>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<log4j.version>2.13.3</log4j.version>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.dice_group.lpbenchgen.dl.creator;

import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import org.dice_group.lpbenchgen.config.Configuration;
import org.dice_group.lpbenchgen.config.PosNegExample;
import org.dice_group.lpbenchgen.dl.ConceptLengthCalculator;
Expand Down Expand Up @@ -72,6 +73,7 @@ public OWLTBoxPositiveCreator(Configuration conf, IndividualRetriever retriever,
seed=conf.getSeed();
negationMutationRatio=conf.getNegationMutationRatio();
inferDirectSuperClasses=conf.getInferDirectSuperClasses();
negationMutationRandom = new Random(seed);

}

Expand All @@ -86,7 +88,6 @@ public List<String> getAllowedTypes() {

@Override
public Collection<PosNegExample> createDistinctConcepts(int noOfConcepts){
negationMutationRandom = new Random(seed);
Set<PosNegExample> ret = new HashSet<>();
int toSmallCount=0;
int noResults=0;
Expand Down Expand Up @@ -143,7 +144,11 @@ protected Double getConceptLength(OWLClassExpression concept) {
}


private Collection<OWLClassExpression> createConcepts(){
/**
* Creates a list of class expressions
* @return a list of class expressions
*/
public Collection<OWLClassExpression> createConcepts(){
List<OWLClassExpression> concepts = new ArrayList<>();
List<String> allowedTypes = new ArrayList<>(this.allowedTypes);
for(String type: allowedTypes){
Expand Down Expand Up @@ -183,37 +188,41 @@ private Set<OWLAxiom> getAxiomsForClass(OWLClass owlClass) {
}


private Collection<OWLClassExpression> createConceptsFromClass(OWLClass owlClass){
/**
* Creates a list of class expressions starting at the owlClass
* @param owlClass start point of the class expressions
* @return list of class expressions
*/
protected Collection<OWLClassExpression> createConceptsFromClass(OWLClass owlClass){
Collection<OWLClassExpression> ret = new ArrayList<>();
ret.add(owlClass);
addNegationMutation(ret, owlClass);
createConceptFromExpression(owlClass, ret);
getAxiomsForClass(owlClass).forEach(axiom ->{
if(axiom instanceof OWLObjectPropertyRangeAxiom){
createConceptFromExpression(((OWLObjectPropertyRangeAxiom) axiom), ret);
createConceptFromExpression(owlClass, ((OWLObjectPropertyRangeAxiom) axiom), ret);
}

});
return ret;
}

private void createConceptFromExpression(OWLObjectPropertyRangeAxiom ax, Collection<OWLClassExpression> ret) {
private void createConceptFromExpression(OWLClass start, OWLObjectPropertyRangeAxiom ax, Collection<OWLClassExpression> ret) {
if(1 <= maxDepth) {
OWLObjectPropertyExpression prop = ax.getProperty();
OWLClassExpression owlClass2 = ax.getRange();
OWLClassExpression propExpr = new OWLObjectSomeValuesFromImpl(prop, owlClass2);
OWLClassExpression propExpr = new OWLObjectSomeValuesFromImpl(prop, start);
if (getConceptLength(propExpr) <= maxConceptLength) {
ret.add(propExpr);

addNegationMutation(ret, propExpr);
for (OWLClassExpression expr : createConceptFromExpression(owlClass2, getRangePropertiesForClass((OWLClass) owlClass2), 1 + 1)) {
for (OWLClassExpression expr : createConceptFromExpression(start, getRangePropertiesForClass(start), 1 + 1)) {
OWLClassExpression pexpr = new OWLObjectSomeValuesFromImpl(prop, expr);
if (getConceptLength(pexpr) <= maxConceptLength) {
addNegationMutation(ret, pexpr);
ret.add(pexpr);
}
}
for (OWLClass inferredClass : res.getSubClasses(owlClass2).getFlattened()) {
for (OWLClass inferredClass : res.getSubClasses(start).getFlattened()) {
if (allowedTypes.contains(inferredClass.getIRI().toString())) {
OWLClassExpression negationPropExpr = new OWLObjectSomeValuesFromImpl(prop, inferredClass);
ret.add(negationPropExpr);
Expand Down Expand Up @@ -278,7 +287,6 @@ private Collection<OWLClassExpression> createConceptFromExpression(OWLClassExpre
}



private Collection<OWLObjectPropertyExpression> getRangePropertiesForClass(OWLClass owlClass) {
Collection<OWLObjectPropertyExpression> ret = new ArrayList<>();
getAxiomsForClass(owlClass).forEach(axiom -> {
Expand Down

0 comments on commit 83eb09f

Please sign in to comment.