Skip to content

Commit d2c56b5

Browse files
committed
Merge branch '4.2' of github.com:neo4j-labs/neosemantics into 4.2
2 parents 6d7f1dc + ff1edac commit d2c56b5

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
lossless manner (imported RDF can subsequently be exported without losing a single triple in the process).
66
* On-demand **export property graph data** from Neo4j *as RDF*.
77
* Model **validation** based on the **W3C SHACL language**
8-
* Impoort of **Ontologies and Taxonomies** in **OWL/RDFS/SKOS/...**
8+
* Import of **Ontologies and Taxonomies** in **OWL/RDFS/SKOS/...**
99

1010
Other features in NSMNTX include *model mapping* and *inferencing* on Neo4j graphs.
1111

src/main/java/n10s/onto/OntologyImporter.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import com.google.common.cache.Cache;
44
import com.google.common.cache.CacheBuilder;
5+
6+
import java.util.Arrays;
57
import java.util.HashSet;
68
import java.util.List;
79
import java.util.Map;
@@ -18,6 +20,7 @@
1820
import org.eclipse.rdf4j.model.vocabulary.OWL;
1921
import org.eclipse.rdf4j.model.vocabulary.RDF;
2022
import org.eclipse.rdf4j.model.vocabulary.RDFS;
23+
import org.eclipse.rdf4j.model.vocabulary.SKOS;
2124
import org.eclipse.rdf4j.rio.RDFHandlerException;
2225
import org.neo4j.graphdb.Direction;
2326
import 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

Comments
 (0)