22
33import com .google .common .cache .Cache ;
44import com .google .common .cache .CacheBuilder ;
5+
6+ import java .util .Arrays ;
57import java .util .HashSet ;
68import java .util .List ;
79import java .util .Map ;
1820import org .eclipse .rdf4j .model .vocabulary .OWL ;
1921import org .eclipse .rdf4j .model .vocabulary .RDF ;
2022import org .eclipse .rdf4j .model .vocabulary .RDFS ;
23+ import org .eclipse .rdf4j .model .vocabulary .SKOS ;
2124import org .eclipse .rdf4j .rio .RDFHandlerException ;
2225import org .neo4j .graphdb .Direction ;
2326import org .neo4j .graphdb .GraphDatabaseService ;
@@ -35,6 +38,7 @@ public class OntologyImporter extends RDFToLPGStatementProcessor {
3538
3639 protected Set <Statement > extraStatements = new HashSet <>();
3740 public static final Label RESOURCE = Label .label ("Resource" );
41+ protected static final List <IRI > ANNOTATION_PROPERTIES_TO_IMPORT = Arrays .asList (RDFS .LABEL , RDFS .COMMENT , SKOS .PREF_LABEL , SKOS .ALT_LABEL , SKOS .DEFINITION );
3842 Cache <String , Node > nodeCache ;
3943
4044 public OntologyImporter (GraphDatabaseService db , Transaction tx ,
@@ -136,7 +140,7 @@ public void handleStatement(Statement st) {
136140 .getSubject () instanceof IRI ) {
137141 instantiatePair ("Resource" , (IRI ) st .getSubject (), "Resource" , (IRI ) st .getObject ());
138142 addStatement (st );
139- } else if (( st . getPredicate (). equals ( RDFS . LABEL ) || st .getPredicate (). equals ( RDFS . COMMENT ))
143+ } else if (ANNOTATION_PROPERTIES_TO_IMPORT . contains ( st .getPredicate ())
140144 && st .getSubject () instanceof IRI ) {
141145 setProp (st .getSubject ().stringValue (), vf .createIRI (BASE_SCH_NS , st .getPredicate ().getLocalName ()),
142146 (Literal ) st .getObject ());
0 commit comments