jena

知识图谱 KBQA Demo:fuseki sparql python 版本问题详细解决方案

风格不统一 提交于 2020-02-27 06:47:40
刚入坑知识图谱,看了一位大神的教程,但是由于 jena、fuseki、python 等版本不同,踩了不少坑,特此记录一下 本文不做具体知识的讲解(具体知识可移步 https://zhuanlan.zhihu.com/knowledgegraph ),仅罗列实践过程中遇到的坑及解决方案 以下内容大多从教程下面几百条评论中提炼总结而来 环境版本 jena :3.14.0 fuseki :3.14.0 jdk :1.8.0_201 python :3.7.6 anaconda :4.8.2 具体问题及解决方案 1. 通过 D2RQ 生成 mapping 文件 此时须打开 MySQL 服务,进入 D2RQ 目录 generate-mapping -u root -p 密码 -o kg_demo_movie_mapping.ttl jdbc:mysql:///kg_demo_movie?useSSL=false -u :指定 mysql 用户名 -p :指定用户密码 -o :指定输出文件路径及名称 jdbc:mysql:/// 后面指定 mysql 中的数据库名称 对于博主的 kg_demo_movie 项目,mapping 文件生成后还需要修改,所以直接使用博主 GitHub 仓库中的 mapping 文件即可 2. 通过 D2RQ 将数据转为 RDF 同样需要打开 MySQL 服务,在

Jena TDB to store and query using API

回眸只為那壹抹淺笑 提交于 2020-01-31 05:35:17
问题 I am new to both Jena-TDB and SPARQL, so it might be a silly question. I am using tdb-0.9.0, on Windows XP. I am creating the TDB model for my trail_1.rdf file. My understanding here(correct me if I am wrong) is that the following code will read the given rdf file in TDB model and also stores/load (not sure what's the better word) the model in the given directory D:\Project\Store_DB\data1\tdb : // open TDB dataset String directory = "D:\\Project\\Store_DB\\data1\\tdb"; Dataset dataset =

Jena TDB to store and query using API

人走茶凉 提交于 2020-01-31 05:35:06
问题 I am new to both Jena-TDB and SPARQL, so it might be a silly question. I am using tdb-0.9.0, on Windows XP. I am creating the TDB model for my trail_1.rdf file. My understanding here(correct me if I am wrong) is that the following code will read the given rdf file in TDB model and also stores/load (not sure what's the better word) the model in the given directory D:\Project\Store_DB\data1\tdb : // open TDB dataset String directory = "D:\\Project\\Store_DB\\data1\\tdb"; Dataset dataset =

Defining Protege class with expression of numerical data

£可爱£侵袭症+ 提交于 2020-01-28 10:58:24
问题 I am building a smart home ontology. I now have a class hierarchy like that: I want to give definitions to the subclass of 'RoomStatus'. For example, I want to define that when room temperature is in range of 18-22 Centigrade and Humidity is in range of 40-50%, then the room has a mild status. I tried to use Class Expression Editor in Protege but it doesn't work. How can I realize this definition? Thanks in advance! 回答1: Hatim's answer may work for you, but I think it might be better not to

Retrieve the collection of unionOf and intersectionOf for each OWL

♀尐吖头ヾ 提交于 2020-01-23 22:03:30
问题 I'm trying to extract intersectionOf and unionOf in an OWL file, where interesctionOf and unionOf consist of collection of classes, someValuesFrom or/and onProperty . I have created a SPARQL query which extracts the "collection" for the intersectionOf , but the problem is that some of the retrieved data are not related to the class. For example, I have class called man . This class has an equivalent class which is intersectionOf of three classes, namely, adult , person , and male .My SPARQL

Is there a differense between a CONSTRUCT queries sent to a virtuoso endpoint and one sent to a Jena one?

て烟熏妆下的殇ゞ 提交于 2020-01-23 02:54:46
问题 I am trying to infer some new triples based on the following CONSTRUCT query: PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX dc: <http://purl.org/dc/elements/1.1/> PREFIX dcterms: <http://purl.org/dc/terms/> PREFIX gpml: <http://vocabularies.wikipathways.org/gpml#> PREFIX wp: <http://vocabularies.wikipathways.org/wp#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> CONSTRUCT { ?line rdf:type wp:DirectedInteraction . } WHERE { ?pathway dc:identifier ?wpIdentifier .{ SELECT

Filter by date range in SPARQL

老子叫甜甜 提交于 2020-01-22 11:07:06
问题 I am using Jena's SPARQL engine and trying to write a query to filter on a date range as I need to find the value of a property after a fixed date. My date property is in the following format: Fri May 23 10:20:13 IST 2014 How do I write a SPARQL query to get other properties with dates greater than this? 回答1: With your data in that format you can't filter on a range of it without adding a custom extension function to ARQ (which is intended for advanced users) since you would need to parse and

Filter by date range in SPARQL

六月ゝ 毕业季﹏ 提交于 2020-01-22 11:03:50
问题 I am using Jena's SPARQL engine and trying to write a query to filter on a date range as I need to find the value of a property after a fixed date. My date property is in the following format: Fri May 23 10:20:13 IST 2014 How do I write a SPARQL query to get other properties with dates greater than this? 回答1: With your data in that format you can't filter on a range of it without adding a custom extension function to ARQ (which is intended for advanced users) since you would need to parse and

Filter by date range in SPARQL

和自甴很熟 提交于 2020-01-22 11:03:06
问题 I am using Jena's SPARQL engine and trying to write a query to filter on a date range as I need to find the value of a property after a fixed date. My date property is in the following format: Fri May 23 10:20:13 IST 2014 How do I write a SPARQL query to get other properties with dates greater than this? 回答1: With your data in that format you can't filter on a range of it without adding a custom extension function to ARQ (which is intended for advanced users) since you would need to parse and

Adding more complicated subclass axiom

邮差的信 提交于 2020-01-21 15:19:33
问题 I have stumbled upon another problem... I want to achieve something similar to this: I wanted to do so using RDFList, adding the necessary properties in to the list and then call method createUnionClass (or createIntersectionClass) and combine it together. Then, the result of this method would be added to particular ontClass with addSuperClass(). Is this wrong? I have started with something really simple, like: RDFList rdfList = ontModel.createList(); rdfList.addProperty(ExampleResource1);