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
3545f6d3
Commit
3545f6d3
authored
13 years ago
by
Jérôme Euzenat
Browse files
Options
Downloads
Patches
Plain Diff
- improved error messages for Cell parsing
parent
9f7139e7
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/parser/RDFParser.java
+21
-5
21 additions, 5 deletions
src/fr/inrialpes/exmo/align/parser/RDFParser.java
with
21 additions
and
5 deletions
src/fr/inrialpes/exmo/align/parser/RDFParser.java
+
21
−
5
View file @
3545f6d3
...
...
@@ -356,19 +356,35 @@ public class RDFParser {
try
{
// Should be better to use Alignment API relation recognition
// determine the relation, the relation shall be Literal
final
String
relation
=
node
.
getProperty
((
Property
)
SyntaxElement
.
RULE_RELATION
.
resource
).
getString
();
Statement
st
=
node
.
getProperty
((
Property
)
SyntaxElement
.
RULE_RELATION
.
resource
);
if
(
st
==
null
)
{
throw
new
AlignmentException
(
"Correspondence must contain a relation"
+
node
.
getLocalName
());
}
final
String
relation
=
st
.
getString
();
//Get the relation
final
Relation
type
=
BasicRelation
.
createRelation
(
relation
);
if
(
type
==
null
)
{
// I raise an error in this case anyway
throw
new
IllegalArgumentException
(
"Cannot parse the string \""
+
relation
+
"\" to a valid relation"
);
}
// parse the measure, the node shall be Literal and it's a number
final
float
m
=
node
.
getProperty
((
Property
)
SyntaxElement
.
MEASURE
.
resource
).
getFloat
();
st
=
node
.
getProperty
((
Property
)
SyntaxElement
.
MEASURE
.
resource
);
if
(
st
==
null
)
{
throw
new
AlignmentException
(
"Correspondence must contain a measure"
+
node
.
getLocalName
());
}
final
float
m
=
st
.
getFloat
();
// get the id
final
String
id
=
node
.
getURI
();
//parsing the entity1 and entity2
Resource
entity1
=
node
.
getProperty
((
Property
)
SyntaxElement
.
ENTITY1
.
resource
).
getResource
();
Resource
entity2
=
node
.
getProperty
((
Property
)
SyntaxElement
.
ENTITY2
.
resource
).
getResource
();
st
=
node
.
getProperty
((
Property
)
SyntaxElement
.
ENTITY1
.
resource
);
if
(
st
==
null
)
{
throw
new
AlignmentException
(
"Correspondence must contain an entity1"
+
node
.
getLocalName
());
}
Resource
entity1
=
st
.
getResource
();
st
=
node
.
getProperty
((
Property
)
SyntaxElement
.
ENTITY2
.
resource
);
if
(
st
==
null
)
{
throw
new
AlignmentException
(
"Correspondence must contain an entity2"
+
node
.
getLocalName
());
}
Resource
entity2
=
st
.
getResource
();
// JE2010:
// Here it would be better to check if the entity has a type.
// If both have none, then we get a old-style correspondence for free
...
...
@@ -396,7 +412,7 @@ public class RDFParser {
}
return
cell
;
}
catch
(
Exception
e
)
{
//wrap other type exception
logger
.
log
(
java
.
util
.
logging
.
Level
.
SEVERE
,
"The cell isn't correct:"
+
node
.
getLocalName
()
+
" "
+
e
.
getMessage
());
logger
.
log
(
java
.
util
.
logging
.
Level
.
SEVERE
,
"The cell isn't correct:
"
+
node
.
getLocalName
()
+
" "
+
e
.
getMessage
());
throw
new
AlignmentException
(
"Cannot parse correspondence "
+
node
.
getLocalName
(),
e
);
}
}
...
...
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