RDF 导入 Neo4j 的分析
以CommonCoreOntologies/RadioTransceiver为例先:
ccos:RadioTransceiver rdf:type owl:Class ;
rdfs:subClassOf ccos:RadioCommunicationInstrument ,
[ rdf:type owl:Restriction ;
owl:onProperty ros:has_part ;
owl:someValuesFrom ccos:RadioReceiver
] ,
[ rdf:type owl:Restriction ;
owl:onProperty ros:has_part ;
owl:someValuesFrom ccos:RadioTransmitter
] ,
[ rdf:type owl:Restriction ;
owl:onProperty ccos:bearer_of ;
owl:someValuesFrom ccos:RadioCommunicationArtifactFunction
] ,
[ rdf:type owl:Restriction ;
owl:onProperty ccos:bearer_of ;
owl:someValuesFrom ccos:RadioCommunicationReceptionArtifactFunction
] .
ccos:RadioTransceiver是一个类,从属于ccos:RadioCommunicationInstrument
同时又有四个限制。
RadioRepeater是从属于RadioTransceiver的,注意箭头方向,所以不用去管。
ccos:RadioTransceiver rdf:type owl:Class ;是通过这个spo改为owl_Class的
rdfs:subClassOf ccos:RadioCommunicationInstrument ,是左上的
下面是4个限制匿名类
[ rdf:type owl:Restriction ;
owl:onProperty ros:has_part ;
owl:someValuesFrom ccos:RadioReceiver
] ,
第一行代表匿名类的Label为owl_Restriction
第二行即为匿名类与ros:has_part结点通过owl_onProperty连接
第三行是匿名类与ccos:RadioReceiver通过owl_someValuesFrom连接
其他三个类似分析,下面再看另一个:
提取与RadioReceiver有关节点在3条路径内的所有节点
ccos:RadioReceiver rdf:type owl:Class ;
rdfs:subClassOf ccos:RadioCommunicationInstrument ,
[ rdf:type owl:Restriction ;
owl:onProperty ccos:bearer_of ;
owl:someValuesFrom ccos:RadioCommunicationReceptionArtifactFunction
] .
其中ccos:RadioReceiver rdf:type owl:Class ;仍然是设置RadioReceiver节点的Label属性为owl_Class
从RadioReceiver节点往外的箭头有两条,第一条为
rdfs:subClassOf ccos:RadioCommunicationInstrument ,即红色箭头
[ rdf:type owl:Restriction ;
owl:onProperty ccos:bearer_of ;
owl:someValuesFrom ccos:RadioCommunicationReceptionArtifactFunction
] .
首先对这个蓝色匿名节点设置标签名,owl_Restriction
其他两个无特别和之前分析相同。
这里需要观察rdf_first和rdf_rest的情况
### http://www.ontologyrepository.com/CommonCoreOntologies/WireReceiver
ccos:WireReceiver rdf:type owl:Class ;
owl:equivalentClass [ owl:intersectionOf ( ccos:RadioReceiver
[ rdf:type owl:Restriction ;
owl:onProperty ros:has_part ;
owl:someValuesFrom ccos:WireAntenna
]
) ;
rdf:type owl:Class
] ;
rdfs:subClassOf ccos:RadioReceiver .
注意rdf:type就会改标签名
首先WireReceiver的标签名变为owl_Class
然后通过关系owl_equivalentClass连接一个匿名类,这个匿名类通过下面的rdf:type owl:Class会对自己标签改为owl_Class
然后这个匿名类会通过rdf:type owl:Class将标签改为owl_Class,然后通过owl:intersectionOf关系连接到另一个匿名类,此时这个匿名类没有属性连接,因此直接分为两部分,第一个部分通过rdf_first连接到ccos:RadioReceiver,第二部分通过rdf_rest连接到一个匿名类,注意此时这个匿名类不能直接分解
[ rdf:type owl:Restriction ;
owl:onProperty ros:has_part ;
owl:someValuesFrom ccos:WireAntenna
]
而是需要再次进行分解,通过rdf_first指向一个匿名类,将这个匿名类的标签改为owl_Restriction同时将这个节点通过owl_onProperty指向has_part,并且通过owl_someValueFrom 指向WireAntenna,特别注意这时候另一个rdf_rest指向是一个记录标准的节点。(rdf_rest指向的节点都不能有内容,只能再次分解,内容只能在rdf_first指向的节点中)
备注:rdf:first 和rdf:rest是针对list的结构,两个都是节点。
( ccos:RadioReceiver
[ rdf:type owl:Restriction ;
owl:onProperty ros:has_part ;
owl:someValuesFrom ccos:WireAntenna
]
)