Skip to content

Commit

Permalink
v.1.0.1: fixed management of \top generators.
Browse files Browse the repository at this point in the history
  • Loading branch information
lbozzato committed Apr 21, 2016
1 parent 59b1542 commit 84cc943
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 44 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ work. Please contact the authors for any other need.*

## Installation

The latest binary release of Asp-it (1.0) can be found at [dkm.fbk.eu/resources/asp-it/asp-it.zip](https://dkm.fbk.eu/resources/asp-it/asp-it.zip).
The latest binary release of Asp-it (1.0.1) can be found at [dkm.fbk.eu/resources/asp-it/asp-it.zip](https://dkm.fbk.eu/resources/asp-it/asp-it.zip).
See also [Asp-it GitHub releases page](https://github.com/dkmfbk/asp-it/releases) for current and previous releases.

The [source code](https://github.com/dkmfbk/asp-it) is distributed as a Maven project: binaries can be built executing `mvn assembly:assembly` from the main project directory.
Expand Down
2 changes: 1 addition & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ work. Please contact the authors for any other need.*
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
= INSTALLATION =

The latest binary release of Asp-it (1.0) can be found at
The latest binary release of Asp-it (1.0.1) can be found at
(https://dkm.fbk.eu/resources/asp-it/asp-it.zip).
See also Asp-it GitHub releases page (https://github.com/dkmfbk/asp-it/releases)
for current and previous releases.
Expand Down
24 changes: 12 additions & 12 deletions examples/food-and-wines-demo-out.n3
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@
<http://dkm.fbk.eu/asp-it/food-and-wines-demo#Food> rdf:type owl:Class ;

rdfs:subClassOf [ rdf:type owl:Restriction ;
owl:onProperty <http://dkm.fbk.eu/asp-it/food-and-wines-demo#goesWith> ;
owl:someValuesFrom <http://dkm.fbk.eu/asp-it/food-and-wines-demo#Color>
] ,
[ rdf:type owl:Restriction ;
owl:onProperty <http://dkm.fbk.eu/asp-it/food-and-wines-demo#goesWith> ;
owl:someValuesFrom [ rdf:type owl:Class ;
owl:intersectionOf ( <http://dkm.fbk.eu/asp-it/food-and-wines-demo#Color>
Expand All @@ -103,10 +107,6 @@
]
)
]
] ,
[ rdf:type owl:Restriction ;
owl:onProperty <http://dkm.fbk.eu/asp-it/food-and-wines-demo#goesWith> ;
owl:someValuesFrom <http://dkm.fbk.eu/asp-it/food-and-wines-demo#Color>
] .
[ rdf:type owl:Axiom ;
<http://dkm.fbk.eu/asp-it/elc-schema#hasIT> "[\"fish\", [\"white\", tt]]"^^xsd:string ,
Expand Down Expand Up @@ -188,15 +188,15 @@
<http://dkm.fbk.eu/asp-it/food-and-wines-demo#goesWith> <http://dkm.fbk.eu/asp-it/food-and-wines-demo#white> .
[ rdf:type owl:Axiom ;
<http://dkm.fbk.eu/asp-it/elc-schema#hasIT> "tt"^^xsd:string ;
owl:annotatedTarget <http://dkm.fbk.eu/asp-it/food-and-wines-demo#Food> ;
owl:annotatedSource <http://dkm.fbk.eu/asp-it/food-and-wines-demo#fish> ;
owl:annotatedProperty <http://dkm.fbk.eu/asp-it/food-and-wines-demo#goesWith> ;
owl:annotatedTarget <http://dkm.fbk.eu/asp-it/food-and-wines-demo#white>
owl:annotatedProperty rdf:type
] .
[ rdf:type owl:Axiom ;
<http://dkm.fbk.eu/asp-it/elc-schema#hasIT> "tt"^^xsd:string ;
owl:annotatedTarget <http://dkm.fbk.eu/asp-it/food-and-wines-demo#Food> ;
owl:annotatedSource <http://dkm.fbk.eu/asp-it/food-and-wines-demo#fish> ;
owl:annotatedProperty rdf:type
owl:annotatedProperty <http://dkm.fbk.eu/asp-it/food-and-wines-demo#goesWith> ;
owl:annotatedTarget <http://dkm.fbk.eu/asp-it/food-and-wines-demo#white>
] .


Expand Down Expand Up @@ -237,15 +237,15 @@
] .
[ rdf:type owl:Axiom ;
<http://dkm.fbk.eu/asp-it/elc-schema#hasIT> "tt"^^xsd:string ;
owl:annotatedTarget <http://dkm.fbk.eu/asp-it/food-and-wines-demo#Color> ;
owl:annotatedProperty <http://dkm.fbk.eu/asp-it/food-and-wines-demo#isColorOf> ;
owl:annotatedSource <http://dkm.fbk.eu/asp-it/food-and-wines-demo#red> ;
owl:annotatedProperty rdf:type
owl:annotatedTarget <http://dkm.fbk.eu/asp-it/food-and-wines-demo#teroldego>
] .
[ rdf:type owl:Axiom ;
<http://dkm.fbk.eu/asp-it/elc-schema#hasIT> "tt"^^xsd:string ;
owl:annotatedProperty <http://dkm.fbk.eu/asp-it/food-and-wines-demo#isColorOf> ;
owl:annotatedTarget <http://dkm.fbk.eu/asp-it/food-and-wines-demo#Color> ;
owl:annotatedSource <http://dkm.fbk.eu/asp-it/food-and-wines-demo#red> ;
owl:annotatedTarget <http://dkm.fbk.eu/asp-it/food-and-wines-demo#teroldego>
owl:annotatedProperty rdf:type
] .


Expand Down
14 changes: 7 additions & 7 deletions examples/isa-test-out.n3
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@
owl:onProperty <http://dkm.fbk.eu/asp-it/isa-test#R> ;
owl:someValuesFrom <http://dkm.fbk.eu/asp-it/isa-test#B>
] .
[ rdf:type owl:Axiom ;
<http://dkm.fbk.eu/asp-it/elc-schema#hasIT> "[\"a1\", tt]"^^xsd:string ,
"[\"a2\", tt]"^^xsd:string ;
owl:annotatedSource <http://dkm.fbk.eu/asp-it/isa-test#A> ;
owl:annotatedTarget <http://dkm.fbk.eu/asp-it/isa-test#C> ;
owl:annotatedProperty rdfs:subClassOf
] .
[ rdf:type owl:Axiom ;
<http://dkm.fbk.eu/asp-it/elc-schema#hasIT> "[\"a1\", [\"b1\", tt]]"^^xsd:string ;
owl:annotatedSource <http://dkm.fbk.eu/asp-it/isa-test#A> ;
Expand All @@ -79,13 +86,6 @@
owl:someValuesFrom <http://dkm.fbk.eu/asp-it/isa-test#B>
]
] .
[ rdf:type owl:Axiom ;
<http://dkm.fbk.eu/asp-it/elc-schema#hasIT> "[\"a1\", tt]"^^xsd:string ,
"[\"a2\", tt]"^^xsd:string ;
owl:annotatedSource <http://dkm.fbk.eu/asp-it/isa-test#A> ;
owl:annotatedTarget <http://dkm.fbk.eu/asp-it/isa-test#C> ;
owl:annotatedProperty rdfs:subClassOf
] .



Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<groupId>eu.fbk.dkm.aspit</groupId>
<artifactId>asp-it</artifactId>
<version>1.0</version>
<version>1.0.1</version>

<name>Asp-IT</name>
<description>ASP based information terms generator for ELc</description>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/eu/fbk/dkm/aspit/cli/AspitCLI.java
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ void printUsage() {
* Prints initial banner and version.
*/
void printBanner(){
String banner = "=== Asp-it v.1.0 (ELc) ===\n";
String banner = "=== Asp-it v.1.0.1 (ELc) ===\n";
System.out.println(banner);
}

Expand Down
43 changes: 24 additions & 19 deletions src/main/java/eu/fbk/dkm/aspit/rewriter/PoIDatalogRewriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ public void rewrite() {
ax.accept(this);
}

//for (OWLNamedIndividual i : ontology.getIndividualsInSignature()) {
// i.accept(this);
//}
for (OWLNamedIndividual i : ontology.getIndividualsInSignature()) {
i.accept(this);
}

//for (OWLObjectProperty p : ontology.getObjectPropertiesInSignature()) {
// p.accept(this);
Expand Down Expand Up @@ -124,25 +124,25 @@ private IRI rewriteConcept(boolean isaxiom, OWLIndividual individual, OWLClassEx

//add is_it(tt, c, Ltop) :- is(c, top).
addStringRules("is_it("+ TT +", X,\"" + label + "\") :- "
+"is(X," + TOP + ").\n");
+"is(X,\"" + TOP + "\").\n");

//add is(c, top) :- is(c, Ltop).
addStringRules("is(X," + TOP + ") :- "
addStringRules("is(X,\"" + TOP + "\") :- "
+"is(X,\"" + label + "\").\n");

} else {//c in NI
IRI individualIRI = individual.asOWLNamedIndividual().getIRI();

if(isaxiom){
addStringRules("is(\"" + individualIRI.getFragment() + "\"," + TOP + ").\n");
addStringRules("is(\"" + individualIRI.getFragment() + "\",\"" + TOP + "\").\n");
}
//add is_it(tt, c, Ltop) :- is(c, top).
addStringRules("is_it(" + TT + ", \"" + individualIRI.getFragment() + "\", \""
+ label + "\") :- is(\""
+ individualIRI.getFragment() + "\", " + TOP + ").\n");
+ individualIRI.getFragment() + "\", \"" + TOP + "\").\n");

//add is(c, top) :- is(c, Ltop).
addStringRules("is(\"" + individualIRI.getFragment() + "\", " + TOP + ") :- is(\""
addStringRules("is(\"" + individualIRI.getFragment() + "\", \"" + TOP + "\") :- is(\""
+ individualIRI.getFragment() + "\", \""
+ label + "\").\n");
}
Expand Down Expand Up @@ -355,20 +355,21 @@ public void visit(OWLSubClassOfAxiom axiom) {
OWLClassExpression subClass = axiom.getSubClass();
OWLClassExpression superClass = axiom.getSuperClass();

//System.out.println("SubClass: " + axiom);

IRI gen = subClass.asOWLClass().getIRI();
//System.out.println("SubClass: " + axiom);
String gen = subClass.asOWLClass().getIRI().getFragment();
if(subClass.isOWLThing())
gen = TOP.toString();

//rewrites complex concept for superclass
IRI labelA = rewriteConcept(false, null, superClass); //*!*

//add is(X, LA) :- is(X, g).
addStringRules("is(X, \"" + labelA + "\") :- "
+"is(X, \"" + gen.getFragment() + "\").\n");
+"is(X, \"" + gen + "\").\n");

//add isa_it([X,Y], g, LA) :- is(X, g), is_it(Y, X, LA).
addStringRules("isa_it([X,Y], \"" + gen.getFragment() + "\", \"" + labelA + "\") :- "
+"is(X, \"" + gen.getFragment() + "\"), "
addStringRules("isa_it([X,Y], \"" + gen + "\", \"" + labelA + "\") :- "
+"is(X, \"" + gen + "\"), "
+"is_it(Y, X, \"" + labelA + "\").\n");

if(labelA != null){
Expand All @@ -378,7 +379,7 @@ public void visit(OWLSubClassOfAxiom axiom) {

//poi.setPredicate(PoIRewritingVocabulary.INST.getName());
poi.setPredicate("isa_it");
poi.addArgument(gen.getFragment());
poi.addArgument(gen);
poi.addArgument(labelA.toString()); //*!*

inputKB.getPOIs().add(poi);
Expand All @@ -390,7 +391,15 @@ public void visit(OWLSubClassOfAxiom axiom) {
//- - RBOX AXIOMS - - - - - - - - - - - - - - - - - - - - - - - - - - - -

//- - SIGNATURE - - - - - - - - - - - - - - - - - - - - - - - -

@Override
//a \in \N
public void visit(OWLNamedIndividual individual) {

//add is(a, \top).
addStringRules("is(\"" + individual.getIRI().getFragment() + "\",\"" + TOP + "\").\n");
}

//- - NOT TREATED - - - - - - - - - - - - - - - - - - - - - - -

@Override
Expand All @@ -404,10 +413,6 @@ public void visit(OWLObjectProperty arg0) {
@Override
public void visit(OWLDataProperty arg0) {
}

@Override
public void visit(OWLNamedIndividual individual) {
}

@Override
public void visit(OWLDatatype arg0) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/scripts/asp-it.bat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
java -jar ./lib/asp-it-1.0.jar %*
java -jar ./lib/asp-it-1.0.1.jar %*
2 changes: 1 addition & 1 deletion src/main/scripts/asp-it.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

exec java -jar ./lib/asp-it-1.0.jar "$@"
exec java -jar ./lib/asp-it-1.0.1.jar "$@"

0 comments on commit 84cc943

Please sign in to comment.