neosemantics-3.4.0.2 支持3.4.x版本neo4j数据库,我使用的neo4j为3.4.10
其它版本在此处下载
https://github.com/jbarrasa/neosemantics/
修改配置文件,添加下面内容
dbms.unmanaged_extension_classes=semantics.extension=/rdf
之后Neo4j报错:
Failed to start Neo4j, Component ‘LifecycleManagingDatabase’ was successfully initialized,but failed to start. “cannot inherit from final class”
命令
导入RDF数据:RDF数据放置于/neo4j/import路径下
a) 使用URI全称
CALL semantics.importRDF(“file:///file.rdf”, “Turtle”, {shortenUrls: false})
CALL semantics.importRDF(“E:/protege_test/111111111.owl”, “Turtle”, {shortenUrls: false}) 错误
CALL semantics.importRDF(“F:/neo4j-community-3.4.10/import/20181129test.owl”, “Turtle”, {shortenUrls: false})
不会报错,但是导入无内容
正确示例
CALL semantics.importRDF(“file:///E:/protege_test/111111111.owl”, “RDF/XML”, {shortenUrls: false})
shortenUrls可直接改成true,注意关系的变化(省去了uri)
b)使用命名空间(未成功)
创建命名空间前缀
CREATE (:NamespacePrefixdefinition {‘http://www.example.com/ontology/1.0.0#’: ‘ex’, ‘http://www.w3.org/1999/02/22-rdf-syntax-ns#’: ‘rdfs’})
创建rdf映射到neo4j的标签
CREATE INDEX ON: Resource(uri)
CREATE INDEX ON: URI(uri)
CREATE INDEX ON: BNode(uri)
CREATE INDEX ON: Class(uri)
其它tips:
maven配置的版本和自己装的版本不一致可能会有问题