diff --git a/rdf2graphml/src/main/java/uk/ac/rothamsted/kg/rdf2pg/graphml/export/support/GraphMLRelationExportHandler.java b/rdf2graphml/src/main/java/uk/ac/rothamsted/kg/rdf2pg/graphml/export/support/GraphMLRelationExportHandler.java index ef320dd..cf1a914 100644 --- a/rdf2graphml/src/main/java/uk/ac/rothamsted/kg/rdf2pg/graphml/export/support/GraphMLRelationExportHandler.java +++ b/rdf2graphml/src/main/java/uk/ac/rothamsted/kg/rdf2pg/graphml/export/support/GraphMLRelationExportHandler.java @@ -62,6 +62,9 @@ public void accept ( Set relRecords ) // TODO: remove, debug int relOndexId = Optional.ofNullable ( pgRelation.getProperties ().get ( "ondexId" ) ) + .map ( pv -> ((Set) pv) ) + .filter ( pvset -> !pvset.isEmpty () ) + .map ( pvset -> pvset.iterator ().next () ) .map ( String::valueOf ) .map ( Integer::valueOf ) .orElse ( -1 ); diff --git a/rdf2pg-core/src/main/java/uk/ac/rothamsted/kg/rdf2pg/pgmaker/support/rdf/RdfDataManager.java b/rdf2pg-core/src/main/java/uk/ac/rothamsted/kg/rdf2pg/pgmaker/support/rdf/RdfDataManager.java index 1051e69..13e4d4c 100644 --- a/rdf2pg-core/src/main/java/uk/ac/rothamsted/kg/rdf2pg/pgmaker/support/rdf/RdfDataManager.java +++ b/rdf2pg-core/src/main/java/uk/ac/rothamsted/kg/rdf2pg/pgmaker/support/rdf/RdfDataManager.java @@ -124,13 +124,13 @@ public String getPGId ( RDFNode node, Function idConverter ) * It doesn't do anything if the query is null. * */ - protected void addPGProps ( PGEntity cyEnt, String propsSparql ) + protected void addPGProps ( PGEntity pgEntity, String propsSparql ) { ensureOpen (); Dataset dataSet = this.getDataSet (); QuerySolutionMap params = new QuerySolutionMap (); - params.add ( "iri", dataSet.getUnionModel().getResource ( cyEnt.getIri () ) ); + params.add ( "iri", dataSet.getUnionModel().getResource ( pgEntity.getIri () ) ); // It may be omitted, if you don't have any property except the IRI. if ( propsSparql == null ) return; @@ -143,11 +143,11 @@ protected void addPGProps ( PGEntity cyEnt, String propsSparql ) { String propName = this.getPGId ( row.get ( "name" ), propIdConverter ); if ( propName == null ) throw new IllegalArgumentException ( - "Null property name for " + cyEnt.getIri () + "Null property name for " + pgEntity.getIri () ); String propValue = JENAUTILS.literal2Value ( row.getLiteral ( "value" ) ).get (); - cyEnt.addPropValue ( propName, propValue ); + pgEntity.addPropValue ( propName, propValue ); }, params );