4747import org .eclipse .rdf4j .model .Resource ;
4848import org .eclipse .rdf4j .model .Statement ;
4949import org .eclipse .rdf4j .model .Value ;
50- import org .eclipse .rdf4j .model .impl .BooleanLiteralImpl ;
51- import org .eclipse .rdf4j .model .impl .LiteralImpl ;
52- import org .eclipse .rdf4j .model .impl .URIImpl ;
50+ import org .eclipse .rdf4j .model .impl .SimpleValueFactory ;
5351import org .eclipse .rdf4j .repository .Repository ;
5452import org .eclipse .rdf4j .repository .RepositoryConnection ;
5553import org .eclipse .rdf4j .repository .RepositoryException ;
@@ -86,7 +84,7 @@ private void doParseRdfInputStream(InputStream stream) throws BridgeDBException
8684 RepositoryConnection repositoryConnection = null ;
8785 try {
8886 repository = new SailRepository (new MemoryStore ());
89- repository .initialize ();
87+ repository .init ();
9088 repositoryConnection = repository .getConnection ();
9189 repositoryConnection .add (stream , DEFAULT_BASE_URI , DEFAULT_FILE_FORMAT );
9290 readAllDataSources (repositoryConnection );
@@ -216,7 +214,7 @@ public DataSource readDataSource(RepositoryConnection repositoryConnection, Reso
216214
217215 private void readCodeMapper (RepositoryConnection repositoryConnection , String systemCode , Pattern regex ) throws RepositoryException , BridgeDBException {
218216 RepositoryResult <Statement > statements =
219- repositoryConnection .getStatements (null , BridgeDBConstants .SYSTEM_CODE_URI , new LiteralImpl (systemCode ), true );
217+ repositoryConnection .getStatements (null , BridgeDBConstants .SYSTEM_CODE_URI , SimpleValueFactory . getInstance (). createLiteral (systemCode ), true );
220218// String xrefPrefix = null;
221219 Resource codeMapperReseource = null ;
222220 while (statements .hasNext ()) {
@@ -321,7 +319,7 @@ public static void writeRdfToFile(File file, SortedSet<DataSource> dataSources)
321319 RepositoryConnection repositoryConnection = null ;
322320 try {
323321 repository = new SailRepository (new MemoryStore ());
324- repository .initialize ();
322+ repository .init ();
325323 repositoryConnection = repository .getConnection ();
326324 for (DataSource dataSource : dataSources ){
327325 writeDataSource (repositoryConnection , dataSource );
@@ -341,29 +339,25 @@ private static void writeDataSource(RepositoryConnection repositoryConnection, D
341339 repositoryConnection .add (id , RdfConstants .TYPE_URI , BridgeDBConstants .DATA_SOURCE_URI );
342340
343341 if (dataSource .getFullName () != null ){
344- repositoryConnection .add (id , BridgeDBConstants .FULL_NAME_URI , new LiteralImpl (dataSource .getFullName ()));
342+ repositoryConnection .add (id , BridgeDBConstants .FULL_NAME_URI , SimpleValueFactory . getInstance (). createLiteral (dataSource .getFullName ()));
345343 }
346344
347345 if (dataSource .getSystemCode () != null && (!dataSource .getSystemCode ().trim ().isEmpty ())){
348- repositoryConnection .add (id , BridgeDBConstants .SYSTEM_CODE_URI , new LiteralImpl (dataSource .getSystemCode ()));
346+ repositoryConnection .add (id , BridgeDBConstants .SYSTEM_CODE_URI , SimpleValueFactory . getInstance (). createLiteral (dataSource .getSystemCode ()));
349347 }
350348
351349 if (dataSource .getMainUrl () != null ){
352- repositoryConnection .add (id , BridgeDBConstants .MAIN_URL_URI , new LiteralImpl (dataSource .getMainUrl ()));
350+ repositoryConnection .add (id , BridgeDBConstants .MAIN_URL_URI , SimpleValueFactory . getInstance (). createLiteral (dataSource .getMainUrl ()));
353351 }
354352
355353 if (dataSource .getExample () != null && dataSource .getExample ().getId () != null ){
356- repositoryConnection .add (id , BridgeDBConstants .ID_EXAMPLE_URI , new LiteralImpl (dataSource .getExample ().getId ()));
354+ repositoryConnection .add (id , BridgeDBConstants .ID_EXAMPLE_URI , SimpleValueFactory . getInstance (). createLiteral (dataSource .getExample ().getId ()));
357355 }
358356
359- if (dataSource .isPrimary ()){
360- repositoryConnection .add (id , BridgeDBConstants .PRIMARY_URI , BooleanLiteralImpl .TRUE );
361- } else {
362- repositoryConnection .add (id , BridgeDBConstants .PRIMARY_URI , BooleanLiteralImpl .FALSE );
363- }
357+ repositoryConnection .add (id , BridgeDBConstants .PRIMARY_URI , SimpleValueFactory .getInstance ().createLiteral (dataSource .isPrimary ()));
364358
365359 if (dataSource .getType () != null ){
366- repositoryConnection .add (id , BridgeDBConstants .TYPE_URI , new LiteralImpl (dataSource .getType ()));
360+ repositoryConnection .add (id , BridgeDBConstants .TYPE_URI , SimpleValueFactory . getInstance (). createLiteral (dataSource .getType ()));
367361 }
368362
369363 Pattern regex = DataSourcePatterns .getPatterns ().get (dataSource );
@@ -391,16 +385,16 @@ private static void writeDataSource(RepositoryConnection repositoryConnection, D
391385
392386 Pattern pattern = DataSourcePatterns .getPatterns ().get (dataSource );
393387 if (pattern != null && !pattern .toString ().isEmpty ()){
394- Value patternValue = new LiteralImpl (pattern .toString ());
388+ Value patternValue = SimpleValueFactory . getInstance (). createLiteral (pattern .toString ());
395389 repositoryConnection .add (id , BridgeDBConstants .HAS_REGEX_PATTERN_URI , patternValue );
396390 }
397391
398392 if (dataSource .getAlternative () != null ){
399- repositoryConnection .add (id , DCTermsConstants .ALTERNATIVE_URI , new LiteralImpl (dataSource .getAlternative ()));
393+ repositoryConnection .add (id , DCTermsConstants .ALTERNATIVE_URI , SimpleValueFactory . getInstance (). createLiteral (dataSource .getAlternative ()));
400394 }
401395
402396 if (dataSource .getDescription () != null ){
403- repositoryConnection .add (id , DCatConstants .DESCRIPTION_URI , new LiteralImpl (dataSource .getDescription ()));
397+ repositoryConnection .add (id , DCatConstants .DESCRIPTION_URI , SimpleValueFactory . getInstance (). createLiteral (dataSource .getDescription ()));
404398 }
405399
406400 SortedSet <UriPattern > sortedPatterns = UriPattern .byCodeAndType (dataSource .getSystemCode (), UriPatternType .dataSourceUriPattern );
@@ -421,8 +415,8 @@ private static void writeCodeMapper(RepositoryConnection repositoryConnection, D
421415 }
422416 Resource id = asCodeMapperResource (dataSource );
423417 repositoryConnection .add (id , RdfConstants .TYPE_URI , BridgeDBConstants .CODE_MAPPER_URI );
424- repositoryConnection .add (id , BridgeDBConstants .SYSTEM_CODE_URI , new LiteralImpl (dataSource .getSystemCode ()));
425- Value prefixValue = new LiteralImpl (xrefPrefix );
418+ repositoryConnection .add (id , BridgeDBConstants .SYSTEM_CODE_URI , SimpleValueFactory . getInstance (). createLiteral (dataSource .getSystemCode ()));
419+ Value prefixValue = SimpleValueFactory . getInstance (). createLiteral (xrefPrefix );
426420 repositoryConnection .add (id , BridgeDBConstants .XREF_PREFIX_URI , prefixValue );
427421
428422 SortedSet <UriPattern > sortedPatterns = UriPattern .byCodeAndType (dataSource .getSystemCode (), UriPatternType .codeMapperPattern );
@@ -476,17 +470,17 @@ private static RDFFormat getFormat(File file){
476470
477471 protected static Resource asResource (DataSource dataSource ) {
478472 if (dataSource .getFullName () == null ){
479- return new URIImpl (BridgeDBConstants .DATA_SOURCE1 + "_bysysCode_" + scrub (dataSource .getSystemCode ()));
473+ return SimpleValueFactory . getInstance (). createIRI (BridgeDBConstants .DATA_SOURCE1 + "_bysysCode_" + scrub (dataSource .getSystemCode ()));
480474 } else {
481- return new URIImpl (BridgeDBConstants .DATA_SOURCE1 + "_" + scrub (dataSource .getFullName ()));
475+ return SimpleValueFactory . getInstance (). createIRI (BridgeDBConstants .DATA_SOURCE1 + "_" + scrub (dataSource .getFullName ()));
482476 }
483477 }
484478
485479 protected static Resource asCodeMapperResource (DataSource dataSource ) {
486480 if (dataSource .getFullName () == null ){
487- return new URIImpl (BridgeDBConstants .CODE_MAPPER1 + "_bysysCode_" + scrub (dataSource .getSystemCode ()));
481+ return SimpleValueFactory . getInstance (). createIRI (BridgeDBConstants .CODE_MAPPER1 + "_bysysCode_" + scrub (dataSource .getSystemCode ()));
488482 } else {
489- return new URIImpl (BridgeDBConstants .CODE_MAPPER1 + "_" + scrub (dataSource .getFullName ()));
483+ return SimpleValueFactory . getInstance (). createIRI (BridgeDBConstants .CODE_MAPPER1 + "_" + scrub (dataSource .getFullName ()));
490484 }
491485 }
492486
0 commit comments