Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Alignment API
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
moex
Alignment API
Commits
f1709970
Commit
f1709970
authored
17 years ago
by
Jérôme Euzenat
Browse files
Options
Downloads
Patches
Plain Diff
- Added new tests
parent
f3c241a5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
README.TXT
+6
-0
6 additions, 0 deletions
README.TXT
test/src/JWNLTest.java
+85
-0
85 additions, 0 deletions
test/src/JWNLTest.java
test/src/OMWGTest.java
+118
-0
118 additions, 0 deletions
test/src/OMWGTest.java
test/src/READMETest.java
+22
-25
22 additions, 25 deletions
test/src/READMETest.java
with
231 additions
and
25 deletions
README.TXT
+
6
−
0
View file @
f1709970
...
@@ -38,6 +38,12 @@ Building:
...
@@ -38,6 +38,12 @@ Building:
---------
---------
$ ant jar
$ ant jar
(or ant compileall; ant jar)
Testing
-------
$ ant test
Running:
Running:
--------
--------
...
...
This diff is collapsed.
Click to expand it.
test/src/JWNLTest.java
0 → 100644
+
85
−
0
View file @
f1709970
/*
* $Id$
*
* Copyright (C) INRIA Rhne-Alpes, 2008
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//package test.com.acme.dona.dep;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertNotNull
;
import
static
org
.
testng
.
Assert
.
assertNull
;
import
static
org
.
testng
.
Assert
.
assertTrue
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.Configuration
;
import
org.testng.annotations.Test
;
//import org.testng.annotations.*;
import
org.semanticweb.owl.align.AlignmentVisitor
;
import
org.semanticweb.owl.align.AlignmentException
;
import
org.semanticweb.owl.align.Alignment
;
import
org.semanticweb.owl.align.AlignmentProcess
;
import
org.semanticweb.owl.align.Parameters
;
import
fr.inrialpes.exmo.align.impl.renderer.RDFRendererVisitor
;
import
fr.inrialpes.exmo.align.impl.BasicParameters
;
import
fr.inrialpes.exmo.align.ling.JWNLAlignment
;
import
java.io.ByteArrayOutputStream
;
import
java.io.PrintWriter
;
import
java.io.BufferedWriter
;
import
java.io.OutputStreamWriter
;
import
java.net.URI
;
import
java.net.URISyntaxException
;
/**
* These tests corresponds to the JWNL test of the README file in the main directory
*/
public
class
JWNLTest
{
private
AlignmentProcess
alignment
=
null
;
@Test
(
groups
=
{
"full"
,
"ling"
})
public
void
routineJWNLTest
()
throws
Exception
{
/*
$ setenv WNDIR
$ java -jar lib/alignwn.jar -D=$WNDIR file://$CWD/examples/rdf/ file://$CWD/examples/rdf/ -i fr.inrialpes.exmo.align.ling.JWNLAlignment -o examples/rdf/JWNL.rdf
*/
Parameters
params
=
new
BasicParameters
();
//System.getenv("WNDIR");
params
.
setParameter
(
"wndict"
,
"../WordNet-2.0/dict"
);
alignment
=
new
JWNLAlignment
();
assertNotNull
(
alignment
,
"ObjectAlignment should not be null"
);
assertEquals
(
alignment
.
nbCells
(),
0
);
alignment
.
init
(
new
URI
(
"file:examples/rdf/edu.umbc.ebiquity.publication.owl"
),
new
URI
(
"file:examples/rdf/edu.mit.visus.bibtex.owl"
));
alignment
.
align
(
(
Alignment
)
null
,
params
);
assertEquals
(
alignment
.
nbCells
(),
43
);
ByteArrayOutputStream
stream
=
new
ByteArrayOutputStream
();
//FileOutputStream stream = new FileOutputStream("result.rdf");
PrintWriter
writer
=
new
PrintWriter
(
new
BufferedWriter
(
new
OutputStreamWriter
(
stream
,
"UTF-8"
)),
true
);
AlignmentVisitor
renderer
=
new
RDFRendererVisitor
(
writer
);
alignment
.
render
(
renderer
);
writer
.
flush
();
writer
.
close
();
assertEquals
(
stream
.
toString
().
length
(),
14037
,
"Rendered differently"
);
alignment
.
cut
(
"hard"
,
0.4
);
assertEquals
(
alignment
.
nbCells
(),
35
);
}
}
This diff is collapsed.
Click to expand it.
test/src/OMWGTest.java
0 → 100644
+
118
−
0
View file @
f1709970
/*
* $Id$
*
* Copyright (C) INRIA Rhne-Alpes, 2008
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//package test.com.acme.dona.dep;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertNotNull
;
import
static
org
.
testng
.
Assert
.
assertNull
;
import
static
org
.
testng
.
Assert
.
assertTrue
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.Configuration
;
import
org.testng.annotations.Test
;
//import org.testng.annotations.*;
import
org.semanticweb.owl.align.AlignmentVisitor
;
import
org.semanticweb.owl.align.AlignmentException
;
import
org.semanticweb.owl.align.Alignment
;
import
fr.inrialpes.exmo.align.impl.renderer.RDFRendererVisitor
;
import
fr.inrialpes.exmo.align.parser.AlignmentParser
;
import
java.io.ByteArrayOutputStream
;
import
java.io.PrintWriter
;
import
java.io.BufferedWriter
;
import
java.io.OutputStreamWriter
;
import
java.io.FileOutputStream
;
/**
* These tests corresponds to the tests presented in the examples/omwg directory
*/
public
class
OMWGTest
{
private
Alignment
alignment
=
null
;
private
AlignmentParser
aparser1
=
null
;
@Test
(
groups
=
{
"full"
,
"omwg"
})
public
void
loadPrintTest
()
throws
Exception
{
/*
java -cp ../../lib/procalign.jar fr.inrialpes.exmo.align.util.ParserPrinter wine.xml > wine2.xml
*/
aparser1
=
new
AlignmentParser
(
0
);
assertNotNull
(
aparser1
);
alignment
=
aparser1
.
parse
(
"examples/omwg/wine.xml"
);
assertNotNull
(
alignment
);
//assertTrue( alignment instanceof OMWGAlignment );
FileOutputStream
stream
=
new
FileOutputStream
(
"examples/omwg/wine2.xml"
);
PrintWriter
writer
=
new
PrintWriter
(
new
BufferedWriter
(
new
OutputStreamWriter
(
stream
,
"UTF-8"
)),
true
);
AlignmentVisitor
renderer
=
new
RDFRendererVisitor
(
writer
);
alignment
.
render
(
renderer
);
writer
.
flush
();
writer
.
close
();
}
@Test
(
groups
=
{
"full"
,
"omwg"
},
dependsOnMethods
=
{
"loadPrintTest"
})
public
void
roundTripTest
()
throws
Exception
{
/*
java -cp ../../lib/procalign.jar fr.inrialpes.exmo.align.util.ParserPrinter wine2.xml > wine3.xml
*/
alignment
=
aparser1
.
parse
(
"examples/omwg/wine2.xml"
);
assertNotNull
(
alignment
);
FileOutputStream
stream
=
new
FileOutputStream
(
"examples/omwg/wine3.xml"
);
PrintWriter
writer
=
new
PrintWriter
(
new
BufferedWriter
(
new
OutputStreamWriter
(
stream
,
"UTF-8"
)),
true
);
AlignmentVisitor
renderer
=
new
RDFRendererVisitor
(
writer
);
alignment
.
render
(
renderer
);
writer
.
flush
();
writer
.
close
();
}
@Test
(
groups
=
{
"full"
,
"omwg"
},
dependsOnMethods
=
{
"roundTripTest"
})
public
void
diffTest
()
throws
Exception
{
/*
diff wine2.xml wine3.xml
*/
Alignment
oldal
=
aparser1
.
parse
(
"examples/omwg/wine2.xml"
);
alignment
=
aparser1
.
parse
(
"examples/omwg/wine3.xml"
);
assertNotNull
(
alignment
);
ByteArrayOutputStream
stream
=
new
ByteArrayOutputStream
();
PrintWriter
writer
=
new
PrintWriter
(
new
BufferedWriter
(
new
OutputStreamWriter
(
stream
,
"UTF-8"
)),
true
);
AlignmentVisitor
renderer
=
new
RDFRendererVisitor
(
writer
);
oldal
.
render
(
renderer
);
writer
.
flush
();
writer
.
close
();
String
wine2
=
stream
.
toString
();
stream
=
new
ByteArrayOutputStream
();
writer
=
new
PrintWriter
(
new
BufferedWriter
(
new
OutputStreamWriter
(
stream
,
"UTF-8"
)),
true
);
renderer
=
new
RDFRendererVisitor
(
writer
);
alignment
.
render
(
renderer
);
writer
.
flush
();
writer
.
close
();
assertEquals
(
wine2
,
stream
.
toString
()
);
}
}
This diff is collapsed.
Click to expand it.
test/src/READMETest.java
+
22
−
25
View file @
f1709970
...
@@ -43,15 +43,21 @@ import fr.inrialpes.exmo.align.impl.BasicParameters;
...
@@ -43,15 +43,21 @@ import fr.inrialpes.exmo.align.impl.BasicParameters;
import
fr.inrialpes.exmo.align.impl.URIAlignment
;
import
fr.inrialpes.exmo.align.impl.URIAlignment
;
import
fr.inrialpes.exmo.align.onto.OntologyCache
;
import
fr.inrialpes.exmo.align.onto.OntologyCache
;
import
fr.inrialpes.exmo.align.parser.AlignmentParser
;
import
fr.inrialpes.exmo.align.parser.AlignmentParser
;
import
fr.inrialpes.exmo.align.util.NullStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.PrintWriter
;
import
java.io.PrintWriter
;
import
java.io.BufferedWriter
;
import
java.io.BufferedWriter
;
import
java.io.OutputStreamWriter
;
import
java.io.OutputStreamWriter
;
import
java.io.FileOutputStream
;
import
java.io.FileOutputStream
;
import
java.io.OutputStream
;
import
java.net.URI
;
import
java.net.URI
;
import
java.net.URISyntaxException
;
import
java.net.URISyntaxException
;
/**
* These tests corresponds to the README file in the main directory
*/
public
class
READMETest
{
public
class
READMETest
{
private
AlignmentProcess
alignment
=
null
;
private
AlignmentProcess
alignment
=
null
;
...
@@ -194,33 +200,24 @@ $ java -cp lib/procalign.jar fr.inrialpes.exmo.align.util.EvalAlign -i fr.inrial
...
@@ -194,33 +200,24 @@ $ java -cp lib/procalign.jar fr.inrialpes.exmo.align.util.EvalAlign -i fr.inrial
assertNotNull
(
align2
);
assertNotNull
(
align2
);
Parameters
params
=
new
BasicParameters
();
Parameters
params
=
new
BasicParameters
();
assertNotNull
(
params
);
assertNotNull
(
params
);
Evaluator
eval
=
new
PRecEvaluator
(
align1
,
align2
);
PRec
Evaluator
eval
=
new
PRecEvaluator
(
align1
,
align2
);
assertNotNull
(
eval
);
assertNotNull
(
eval
);
eval
.
eval
(
params
)
;
eval
.
eval
(
params
)
;
/*
stream = new FileOutputStream(filename);
// This only output the result to check that this is possible
}
OutputStream
stream
=
new
NullStream
();
writer = new PrintWriter (
PrintWriter
writer
=
new
PrintWriter
(
new BufferedWriter(
new
BufferedWriter
(
new OutputStreamWriter( stream, "UTF-8" )), true);
new
OutputStreamWriter
(
stream
,
"UTF-8"
)),
true
);
eval.write( writer );
eval
.
write
(
writer
);
writer.flush();
writer
.
flush
();
*/
writer
.
close
();
/*
assertEquals
(
eval
.
getPrecision
(),
0.7441860465116279
);
<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
assertEquals
(
eval
.
getRecall
(),
1.0
);
xmlns:map='http://www.atl.external.lmco.com/projects/ontology/ResultsOntology.n3#'>
assertEquals
(
eval
.
getFallout
(),
0.2558139534883721
);
<map:output rdf:about=''>
assertEquals
(
eval
.
getFmeasure
(),
0.8533333333333333
);
<map:input1 rdf:resource="http://ebiquity.umbc.edu/v2.1/ontology/publication.owl#publication"/>
assertEquals
(
eval
.
getOverall
(),
0.65625
);
<map:input2 rdf:resource="file:examples/rdf/edu.mit.visus.bibtex.owl"/>
//assertEquals( eval.getResult(), 1.34375 );
<map:precision>0.8372093023255814</map:precision>
<map:recall>1.0</map:recall>
<fallout>0.16279069767441862</fallout>
<map:fMeasure>0.9113924050632911</map:fMeasure>
<map:oMeasure>0.8055555555555556</map:oMeasure>
<result>1.1944444444444444</result>
</map:output>
</rdf:RDF>
*/
}
}
@Test
(
groups
=
{
"full"
,
"impl"
})
@Test
(
groups
=
{
"full"
,
"impl"
})
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment