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
ba79ea2f
Commit
ba79ea2f
authored
10 years ago
by
Jérôme Euzenat
Browse files
Options
Downloads
Patches
Plain Diff
- preliminary bits for algebraic manipulation of BasicOntologyNetworks
parent
6b856ca0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/fr/inrialpes/exmo/align/impl/BasicOntologyNetwork.java
+111
-1
111 additions, 1 deletion
src/fr/inrialpes/exmo/align/impl/BasicOntologyNetwork.java
with
111 additions
and
1 deletion
src/fr/inrialpes/exmo/align/impl/BasicOntologyNetwork.java
+
111
−
1
View file @
ba79ea2f
...
...
@@ -131,7 +131,7 @@ public class BasicOntologyNetwork implements OntologyNetwork {
public
Set
<
Alignment
>
getAlignments
(){
return
alignments
;
};
public
Set
<
URI
>
getOntologies
(){
public
Set
<
URI
>
getOntologies
()
{
return
ontologies
.
keySet
();
// ??
};
public
Set
<
Alignment
>
getTargetingAlignments
(
URI
onto
){
...
...
@@ -148,6 +148,116 @@ public class BasicOntologyNetwork implements OntologyNetwork {
for
(
Alignment
al
:
newal
)
addAlignment
(
al
);
}
/**
* Normalizes an ontology network for it to have exactly one alignment between each pair of ontologies.
* Modifies the network
*/
public
void
normalize
()
throws
AlignmentException
{
for
(
OntologyTriple
ot1
:
ontologies
.
values
()
)
{
for
(
OntologyTriple
ot2
:
ontologies
.
values
()
)
{
Set
<
Alignment
>
als
=
intersect
(
ot1
.
sourceAlignments
,
ot2
.
targettingAlignments
);
// Suppress them
if
(
als
.
size
()
!=
1
)
{
Alignment
norm
=
normalizeAlignmentSet
(
als
,
ot1
.
onto
,
ot2
.
onto
);
for
(
Alignment
al
:
als
)
{
remAlignment
(
al
);
}
// Add new
addAlignment
(
norm
);
}
}
}
}
protected
Alignment
normalizeAlignmentSet
(
Set
<
Alignment
>
als
,
URI
onto1
,
URI
onto2
)
{
Alignment
result
=
null
;
if
(
als
.
size
()
==
0
)
{
// If no element, create new
result
=
new
BasicAlignment
();
result
.
init
(
onto1
,
onto2
);
}
else
if
(
als
.
size
()
>
1
)
{
// If more than one element, merge them
result
=
null
;
for
(
Alignment
al
:
als
)
{
if
(
result
==
null
)
{
result
=
al
;
}
else
{
result
.
join
(
al
);
}
}
}
else
{
result
=
als
.
iterator
().
next
();
}
return
result
;
}
protected
Set
<
Alignment
>
intersect
(
Set
<
Alignment
>
s1
,
Set
<
Alignment
>
s2
)
{
Set
<
Alignment
>
result
=
new
HashSet
<
Alignment
>();
for
(
Alignment
x
:
s1
)
{
if
(
s2
.
contains
(
x
)
)
result
.
add
(
x
);
}
return
result
;
}
/**
* Match ontologies in a network, using existing ontologies as input...
* Modifies the network
* TODO
*/
public
void
match
(
String
method
,
boolean
reflexive
,
boolean
symmetric
)
throws
AlignmentException
{
for
(
OntologyTriple
ot1
:
ontologies
.
values
()
)
{
for
(
OntologyTriple
ot2
:
ontologies
.
values
()
)
{
if
(
(
ot1
==
ot2
&&
reflexive
)
||
symmetric
)
{
Set
<
Alignment
>
als
=
intersect
(
ot1
.
sourceAlignments
,
ot2
.
targettingAlignments
);
Alignment
init
=
normalizeAlignmentSet
(
als
,
ot1
.
onto
,
ot2
.
onto
);
for
(
Alignment
al
:
als
)
{
remAlignment
(
al
);
}
// Create the alignment process
//AlignmentProcess ap = ...
// Match
//ap.init( ot1.onto, ot2.onto );
//ap.align( init, (Properties)null );
// replace
//addAlignment( ap );
}
}
}
}
/**
* Intersection of two ontology networks...
* Creates a new network
* TODO
*/
public
static
BasicOntologyNetwork
meet
(
OntologyNetwork
on1
,
OntologyNetwork
on2
)
throws
AlignmentException
{
BasicOntologyNetwork
result
=
new
BasicOntologyNetwork
();
Set
<
URI
>
ontologies2ndNetwork
=
on2
.
getOntologies
();
// intersect these...
for
(
URI
onto1
:
on1
.
getOntologies
()
)
{
if
(
ontologies2ndNetwork
.
contains
(
onto1
)
)
{
result
.
addOntology
(
onto1
);
}
}
// go to the networks now
for
(
URI
onto1
:
result
.
getOntologies
()
)
{
for
(
URI
onto2
:
result
.
getOntologies
()
)
{
// Get the alignments from both networks
// Normalise them (yes because it is join)
// Meet them
}
}
return
result
;
}
/**
* Union of two ontology networks...
* Creates a new network
* TODO
*/
public
static
BasicOntologyNetwork
join
(
OntologyNetwork
on1
,
OntologyNetwork
on2
)
throws
AlignmentException
{
return
(
BasicOntologyNetwork
)
null
;
}
/**
* Add alignments only if there is no existing alignments
public void match( Class<? extends AlignmentProcess> method, boolean reflexive ) throws AlignmentException {
...
...
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