Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Raphael
histream
Commits
bd18f59b
Commit
bd18f59b
authored
Jul 27, 2015
by
R.W.Majeed
Browse files
wrap RDFParseException with IOException
parent
98a32fce
Changes
2
Hide whitespace changes
Inline
Side-by-side
HIStream-SKOS/src/main/java/de/sekmi/histream/ontology/skos/Store.java
View file @
bd18f59b
...
@@ -66,7 +66,7 @@ public class Store implements Ontology, Plugin {
...
@@ -66,7 +66,7 @@ public class Store implements Ontology, Plugin {
* @throws RDFParseException if rdf files can not be parsed
* @throws RDFParseException if rdf files can not be parsed
* @throws RepositoryException for any other exceptions during ontology initialisation
* @throws RepositoryException for any other exceptions during ontology initialisation
*/
*/
public
Store
(
Map
<
String
,
String
>
conf
)
throws
RepositoryException
,
RDFParseException
,
IOException
{
public
Store
(
Map
<
String
,
String
>
conf
)
throws
RepositoryException
,
IOException
{
int
i
=
1
;
int
i
=
1
;
List
<
File
>
files
=
new
ArrayList
<>();
List
<
File
>
files
=
new
ArrayList
<>();
String
baseURI
=
conf
.
get
(
"rdf.baseURI"
);
String
baseURI
=
conf
.
get
(
"rdf.baseURI"
);
...
@@ -110,28 +110,35 @@ public class Store implements Ontology, Plugin {
...
@@ -110,28 +110,35 @@ public class Store implements Ontology, Plugin {
}
}
return
count
;
return
count
;
}
}
private
void
initializeRepo
(
Iterable
<
File
>
files
,
Iterable
<
URL
>
urls
,
String
baseURI
)
throws
RepositoryException
,
RDFParseException
,
IOException
{
private
void
initializeRepo
(
Iterable
<
File
>
files
,
Iterable
<
URL
>
urls
,
String
baseURI
)
throws
RepositoryException
,
IOException
{
repo
=
new
SailRepository
(
new
MemoryStore
());
repo
=
new
SailRepository
(
new
MemoryStore
());
repo
.
initialize
();
repo
.
initialize
();
rc
=
repo
.
getConnection
();
rc
=
repo
.
getConnection
();
inferredContext
=
repo
.
getValueFactory
().
createURI
(
"http://sekmi.de/histream/inferredInverse"
);
inferredContext
=
repo
.
getValueFactory
().
createURI
(
"http://sekmi.de/histream/inferredInverse"
);
this
.
lastModified
=
0
;
this
.
lastModified
=
0
;
if
(
files
!=
null
){
if
(
files
!=
null
){
for
(
File
file
:
files
){
for
(
File
file
:
files
){
rc
.
add
(
file
,
baseURI
,
RDFFormat
.
TURTLE
);
try
{
rc
.
add
(
file
,
baseURI
,
RDFFormat
.
TURTLE
);
// use timestamps from files for last modified date
}
catch
(
RDFParseException
e
){
lastModified
=
Math
.
max
(
lastModified
,
file
.
lastModified
());
throw
new
IOException
(
"Parse error for file "
+
file
+
":"
+
e
.
getLineNumber
()+
": "
+
e
.
getMessage
(),
e
);
}
// use timestamps from files for last modified date
lastModified
=
Math
.
max
(
lastModified
,
file
.
lastModified
());
}
}
}
}
if
(
urls
!=
null
){
if
(
urls
!=
null
){
for
(
URL
url
:
urls
){
for
(
URL
url
:
urls
){
try
{
rc
.
add
(
url
,
baseURI
,
RDFFormat
.
TURTLE
);
rc
.
add
(
url
,
baseURI
,
RDFFormat
.
TURTLE
);
// TODO: determine last modified (should work for file,jar,http urls)
}
catch
(
RDFParseException
e
){
lastModified
=
System
.
currentTimeMillis
();
throw
new
IOException
(
"Parse error for url "
+
url
+
":"
+
e
.
getLineNumber
()+
": "
+
e
.
getMessage
(),
e
);
}
// TODO: determine last modified (should work for file,jar,http urls)
lastModified
=
System
.
currentTimeMillis
();
}
}
}
}
int
inferred
=
0
;
int
inferred
=
0
;
inferred
+=
inferInverseRelations
(
SKOS
.
TOP_CONCEPT_OF
,
SKOS
.
HAS_TOP_CONCEPT
);
inferred
+=
inferInverseRelations
(
SKOS
.
TOP_CONCEPT_OF
,
SKOS
.
HAS_TOP_CONCEPT
);
inferred
+=
inferInverseRelations
(
SKOS
.
BROADER
,
SKOS
.
NARROWER
);
inferred
+=
inferInverseRelations
(
SKOS
.
BROADER
,
SKOS
.
NARROWER
);
...
@@ -142,16 +149,16 @@ public class Store implements Ontology, Plugin {
...
@@ -142,16 +149,16 @@ public class Store implements Ontology, Plugin {
}
}
public
Store
(
Iterable
<
File
>
files
,
String
baseURI
)
throws
RepositoryException
,
RDFParseException
,
IOException
{
public
Store
(
Iterable
<
File
>
files
,
String
baseURI
)
throws
RepositoryException
,
IOException
{
initializeRepo
(
files
,
null
,
baseURI
);
initializeRepo
(
files
,
null
,
baseURI
);
}
}
public
Store
(
Iterable
<
URL
>
urls
)
throws
RepositoryException
,
RDFParseException
,
IOException
{
public
Store
(
Iterable
<
URL
>
urls
)
throws
RepositoryException
,
IOException
{
// TODO: clean implementation
// TODO: clean implementation
initializeRepo
(
null
,
urls
,
null
);
initializeRepo
(
null
,
urls
,
null
);
}
}
public
Store
(
File
file
)
throws
RepositoryException
,
RDFParseException
,
IOException
{
public
Store
(
File
file
)
throws
RepositoryException
,
IOException
{
this
(
Arrays
.
asList
(
new
File
[]{
file
}),
(
String
)
null
);
this
(
Arrays
.
asList
(
new
File
[]{
file
}),
(
String
)
null
);
}
}
public
void
setConceptScheme
(
String
schemeURI
){
public
void
setConceptScheme
(
String
schemeURI
){
...
...
histream-core/src/main/java/de/sekmi/histream/ontology/OntologyException.java
View file @
bd18f59b
...
@@ -19,4 +19,7 @@ public class OntologyException extends Exception{
...
@@ -19,4 +19,7 @@ public class OntologyException extends Exception{
public
OntologyException
(
String
message
){
public
OntologyException
(
String
message
){
super
(
message
);
super
(
message
);
}
}
public
OntologyException
(
String
message
,
Throwable
cause
){
super
(
message
,
cause
);
}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment