Coder Social home page Coder Social logo

simmerchan / kg-demo-for-movie Goto Github PK

View Code? Open in Web Editor NEW
1.3K 1.3K 422.0 67.63 MB

从无到有构建一个电影知识图谱,并基于该KG,开发一个简易的KBQA程序。

Home Page: https://zhuanlan.zhihu.com/knowledgegraph

Python 57.55% Dockerfile 0.02% Batchfile 0.54% Shell 3.72% Java 6.12% Ruby 4.80% HTML 1.12% CSS 0.66% JavaScript 25.10% Smarty 0.36%
knowledge-graph question-answering

kg-demo-for-movie's People

Contributors

lilac avatar simmerchan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kg-demo-for-movie's Issues

docker无法正常使用

,降低了refo的版本,成功build,网页输入localhost打开后Streamlit报错
ModuleNotFoundError: No module named 'match'
Traceback:
File "/usr/local/lib/python3.6/dist-packages/streamlit/script_runner.py", line 324, in _run_script
exec(code, module.dict)
File "/kbqa/streamlit_app.py", line 2, in
from kg_demo_movie.KB_query.query_main import QAInterface
File "/kbqa/kg_demo_movie/KB_query/query_main.py", line 16, in
from kg_demo_movie.KB_query import jena_sparql_endpoint, question2sparql
File "/kbqa/kg_demo_movie/KB_query/question2sparql.py", line 16, in
from kg_demo_movie.KB_query import question_temp, word_tagging
File "/kbqa/kg_demo_movie/KB_query/question_temp.py", line 29, in
from refo import finditer, Predicate, Star, Any, Disjunction
File "/usr/local/lib/python3.6/dist-packages/refo/init.py", line 8, in
from match import match, search, finditer

好像是refo版本的问题

WARN JettyLauncher

您好:

我在运行
d2r-server.bat kg_demo_movie_mapping.ttl
时,报错

Database connection to jdbc:mysql:///kg_demo_movie failed (user: root): Could not
create connection to database server. Attempted reconnect 3 times. Giving up. (E54)

image

我的mysql服务已经启动了,系统是windows。
刚接触这一领域,java也不太熟悉,希望得到你的指教。

很棒的文章,有两个建议

这个系列的文章很棒,十分感谢!

看完后,有两个建议:
1、第一篇完成后的结果,实际上是在第四篇用到的,建议说明一下,整体会更连贯
2、建议说明一下Demo所需软件环境的版本,有些哥们不熟的话,会多花费一些时间
2.1、Python版本2.7
2.2、jena和jena-fuseki的版本希望也能注明一下,我用的是最新的3.9,配置文件需要有相应调整才能跑起来
2.3、Demo在Windows下运行的话,会遇到字符集的一些问题,建议操作系统环境也说明一下

希望能出更多后续的文章,加油!

Logical error when sorting the query dictionary

I looked through part of your source code, and I happened to notice the following at question2sparql.py line 47:
sorted_dict = sorted(queries_dict.iteritems(), key=lambda item: item[1]),
which would sort the iterator in the ascending order of the query strings.
According to the comment above this line, I guess you might be thinking of the following instead:
sorted_dict = sorted(queries_dict.iteritems(), key = lambda item: item[0], reverse = True),
which would sort the iterator in the descending order of the number of key words matched.

Dockerfile:Unable to locate package python3.6

=> ERROR [ 9/16] RUN apt-get -y install python3.6 1.9s

[ 9/16] RUN apt-get -y install python3.6:
0.466 Reading package lists...
1.598 Building dependency tree...
1.794 Reading state information...
1.870 E: Unable to locate package python3.6
1.870 E: Couldn't find any package by glob 'python3.6'
1.870 E: Couldn't find any package by regex 'python3.6'


Dockerfile:11

9 | RUN apt-get update
10 | RUN apt-get upgrade -y
11 | >>> RUN apt-get -y install python3.6
12 | RUN apt-get -y install python3.6-dev
13 | RUN apt-get -y install default-jdk

ERROR: failed to solve: process "/bin/sh -c apt-get -y install python3.6" did not complete successfully: exit code: 100

RDFS和关系型数据库

看了你的CSDN中的文章后受益匪浅,也有一些疑问。
RDFS查询语言SPARQL,和mysql查询语言,哪一个效率更高一点,速度更快一点。
RDFS感觉上和mysql一样是个数据库,只不过语法不同而已

启用外键约束

kg_demo_movie/crawler/movie_crawler.py 第266行,是否应该改为 mysql_cursor.execute("SET FOREIGN_KEY_CHECKS = 1")

请教一个关于自然语言数据抽取的问题

在近期的项目上,遇到了需要从大段自然语言中抽取数据的需求。我现在可以搞定分词、词性标定、并通过正则进行部分数据抽取。但由于语言并不规范,抽取规则太多,很难完全通过正则表达式抽取数据。

看了很多资料,大家推荐用深度学习的。但找了一大圈,没找到合适的项目或例子。您能帮忙推荐一个吗?或者有其他建议吗?感谢!

Fuseki启动时报TDBException

您好,我是在知乎上看到您写的语义网的文章的,我也在学习语义网相关的知识,看了之后感觉很有用。但是在动手做您上面的例子时却有问题。实践篇(四)里面,按照您说的配置好之后,启动Fuseki时却报错了。试了很多次,每一步都是按您说的做的,但是还是有问题,很迷惑,希望您帮助我一下。

image

image

怎么运行demo

请问大家,我在ubuntu的终端输入docker build -t kbqa:V0.1 .后报错如下

image
请问这个怎么解决呢
我是第一次使用docker,感谢大家

ERROR [14/15],ERROR[15/15]

在执行docker build -t kbqa:V0.1 . 命令时出现的两个错误,有人可以解答吗?谢谢各位!
=> ERROR [14/15] RUN /usr/local/bin/pip3.6 install -r requirements.txt -i https://pypi.tun 71.6s

[14/15] RUN /usr/local/bin/pip3.6 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/ && rm -rf ~/.cache/pip:
#18 0.947 Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple/
#18 6.284 Collecting jieba>=0.39
#18 6.890 Downloading https://pypi.tuna.tsinghua.edu.cn/packages/c6/cb/18eeb235f833b726522d7ebed54f2278ce28ba9438e3135ab0278d9792a2/jieba-0.42.1.tar.gz (19.2 MB)
#18 17.51 Collecting refo==0.13
#18 19.05 Downloading https://pypi.tuna.tsinghua.edu.cn/packages/51/b1/fe3af8c96aa634a9502bec5622aadc2e27880843a1da2c5869435772b075/REfO-0.13.tar.gz (12 kB)
#18 19.88 Collecting SPARQLWrapper==1.8.5
#18 19.93 Downloading https://pypi.tuna.tsinghua.edu.cn/packages/00/9b/443fbe06996c080ee9c1f01b04e2f683b2b07e149905f33a2397ee3b80a2/SPARQLWrapper-1.8.5-py3-none-any.whl (26 kB)
#18 20.05 Collecting streamlit==0.66.0
#18 20.13 Downloading https://pypi.tuna.tsinghua.edu.cn/packages/73/f2/03193332b9ced126141f095a7b0b75a1a5f43665aa1e4eb58d7cc0f69977/streamlit-0.66.0-py2.py3-none-any.whl (7.2 MB)
#18 38.05 Collecting altair>=3.2.0
#18 38.23 Downloading https://pypi.tuna.tsinghua.edu.cn/packages/01/55/0bb2226e34f21fa549c3f4557b4f154a5632f61132a969da17c95ca8eab9/altair-4.1.0-py3-none-any.whl (727 kB)
#18 39.73 Collecting astor
#18 40.05 Downloading https://pypi.tuna.tsinghua.edu.cn/packages/c3/88/97eef84f48fa04fbd6750e62dcceafba6c63c81b7ac1420856c8dcc0a3f9/astor-0.8.1-py2.py3-none-any.whl (27 kB)
#18 40.23 Collecting base58
#18 40.33 Downloading https://pypi.tuna.tsinghua.edu.cn/packages/3c/03/58572025c77b9e6027155b272a1b96298e711cd4f95c24967f7137ab0c4b/base58-2.0.1-py3-none-any.whl (4.3 kB)
#18 40.34 Collecting blinker
#18 40.40 Downloading https://pypi.tuna.tsinghua.edu.cn/packages/1b/51/e2a9f3b757eb802f61dc1f2b09c8c99f6eb01cf06416c0671253536517b6/blinker-1.4.tar.gz (111 kB)
#18 40.69 Collecting boto3
#18 41.02 Downloading https://pypi.tuna.tsinghua.edu.cn/packages/5c/8f/93e490e99c25bebbc79f762448866acf4b942ea6666423ac308c2aedb800/boto3-1.16.29-py2.py3-none-any.whl (129 kB)
#18 41.46 Downloading https://pypi.tuna.tsinghua.edu.cn/packages/b7/df/6c160e21a5caa800de16f2aa859b92671623118b4d124639aeab06876c06/boto3-1.16.28-py2.py3-none-any.whl (129 kB)
#18 42.15 Collecting botocore>=1.13.44
#18 42.33 Downloading https://pypi.tuna.tsinghua.edu.cn/packages/ac/e0/966b82eb9eab5fe36e80bcbbfda0d3f49cdd9ec896ebe9edb9824f896cd7/botocore-1.19.28-py2.py3-none-any.whl (7.0 MB)
#18 46.55 Collecting cachetools>=4.0
#18 46.59 Downloading https://pypi.tuna.tsinghua.edu.cn/packages/cd/5c/f3aa86b6d5482f3051b433c7616668a9b96fbe49a622210e2c9781938a5c/cachetools-4.1.1-py3-none-any.whl (10 kB)
[+] Building 459.8s (19/22)
=> [internal] load build definition from Dockerfile 0.1so
=> => transferring dockerfile: 1.18kB 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0sy
=> [internal] load metadata for docker.io/library/ubuntu:16.04 3.0s
=> [1/18] FROM docker.io/library/ubuntu:16.04@sha256:3355b6e4ba1b12071ba5fe9742042a2f10b257c908fbdfac81912a16eb463879 0.0s
=> [internal] load build context 0.1s-
=> => transferring context: 39.49kB 0.1s
=> CACHED [2/18] RUN sed -i 's#http://archive.ubuntu.com/#http://mirrors.tuna.tsinghua.edu.cn/#' /etc/apt/sources.list 0.0s
=> CACHED [3/18] RUN apt-get update 0.0s-
=> [4/18] RUN apt-get install dos2unix 1.9s
=> [5/18] RUN apt-get -y install vim 25.6s
=> [6/18] RUN apt-get -y install python-software-properties 74.5s
=> [7/18] RUN apt-get -y install software-properties-common 4.6s
=> [8/18] RUN add-apt-repository ppa:deadsnakes/ppa -y 5.8s
=> [9/18] RUN apt-get update 8.7s
=> [10/18] RUN apt-get -y install python3.6 55.5s
=> [11/18] RUN apt-get -y install python3.6-dev 73.2s
=> [12/18] RUN apt-get -y install default-jdk 114.5s
=> [13/18] ADD . /kbqa 13.1s
=> [14/18] WORKDIR /kbqa 0.3s
=> ERROR [15/18] RUN /usr/bin/python3.6 get-pip.py 78.7s


[15/18] RUN /usr/bin/python3.6 get-pip.py:
#19 3.478 Collecting pip
#19 5.143 Downloading pip-20.3.1-py2.py3-none-any.whl (1.5 MB)
#19 78.66 ERROR: Exception:
#19 78.66 Traceback (most recent call last):
#19 78.66 File "/tmp/tmphlld1n8u/pip.zip/pip/_vendor/urllib3/response.py", line 425, in _error_catcher
#19 78.66 yieldding https://pypi.tuna.tsinghua.edu.cn/packages/87/86/753182c9085ba4936c0076269a571613387cdb77ae2bf537448bfd63472c/numpy-1.19.4-cp36-cp36
#19 78.66 File "/tmp/tmphlld1n8u/pip.zip/pip/_vendor/urllib3/response.py", line 507, in read
#19 78.66 data = self._fp.read(amt) if not fp_closed else b""
#19 78.66 File "/tmp/tmphlld1n8u/pip.zip/pip/_vendor/cachecontrol/filewrapper.py", line 62, in read
#19 78.66 data = self.__fp.read(amt).6/dist-packages/pip/_vendor/urllib3/response.py", line 438, in _error_catcher
#19 78.66 File "/usr/lib/python3.6/http/client.py", line 463, in read
#19 78.66 n = self.readinto(b)ython3.6/dist-packages/pip/_vendor/urllib3/response.py", line 519, in read
#19 78.66 File "/usr/lib/python3.6/http/client.py", line 507, in readinto
#19 78.66 n = self.fp.readinto(b)on3.6/dist-packages/pip/_vendor/cachecontrol/filewrapper.py", line 62, in read
#19 78.66 File "/usr/lib/python3.6/socket.py", line 586, in readinto
#19 78.66 return self._sock.recv_into(b)ient.py", line 463, in read
#19 78.66 File "/usr/lib/python3.6/ssl.py", line 1012, in recv_into
#19 78.66 return self.read(nbytes, buffer)nt.py", line 507, in readinto
#19 78.66 File "/usr/lib/python3.6/ssl.py", line 874, in read
#19 78.66 return self._sslobj.read(len, buffer)ne 586, in readinto
#19 78.66 File "/usr/lib/python3.6/ssl.py", line 631, in read
#19 78.66 v = self._sslobj.read(len, buffer)ne 1012, in recv_into
#19 78.66 socket.timeout: The read operation timed out
#19 78.66 File "/usr/lib/python3.6/ssl.py", line 874, in read
#19 78.66 During handling of the above exception, another exception occurred:
#19 78.66 File "/usr/lib/python3.6/ssl.py", line 631, in read
#19 78.66 Traceback (most recent call last):fer)
#19 78.66 File "/tmp/tmphlld1n8u/pip.zip/pip/_internal/cli/base_command.py", line 186, in _main
#19 78.66 status = self.run(options, args)
#19 78.66 File "/tmp/tmphlld1n8u/pip.zip/pip/_internal/commands/install.py", line 331, in run
#19 78.66 resolver.resolve(requirement_set)
#19 78.66 File "/tmp/tmphlld1n8u/pip.zip/pip/_internal/legacy_resolve.py", line 177, in resolve
#19 78.66 discovered_reqs.extend(self._resolve_one(requirement_set, req))se_command.py", line 224, in _main
#19 78.66 File "/tmp/tmphlld1n8u/pip.zip/pip/_internal/legacy_resolve.py", line 333, in _resolve_one
#19 78.66 abstract_dist = self._get_abstract_dist_for(req_to_install)i/req_command.py", line 180, in wrapper
#19 78.66 File "/tmp/tmphlld1n8u/pip.zip/pip/_internal/legacy_resolve.py", line 282, in _get_abstract_dist_for
#19 78.66 abstract_dist = self.preparer.prepare_linked_requirement(req)ands/install.py", line 321, in run
#19 78.66 File "/tmp/tmphlld1n8u/pip.zip/pip/_internal/operations/prepare.py", line 482, in prepare_linked_requirement
#19 78.66 hashes=hashes,/lib/python3.6/dist-packages/pip/_internal/resolution/resolvelib/resolver.py", line 122, in resolve
#19 78.66 File "/tmp/tmphlld1n8u/pip.zip/pip/_internal/operations/prepare.py", line 287, in unpack_url
#19 78.66 hashes=hashes,/lib/python3.6/dist-packages/pip/_vendor/resolvelib/resolvers.py", line 445, in resolve
#19 78.66 File "/tmp/tmphlld1n8u/pip.zip/pip/_internal/operations/prepare.py", line 159, in unpack_http_url
#19 78.66 link, downloader, temp_dir.path, hashesges/pip/_vendor/resolvelib/resolvers.py", line 339, in resolve
#19 78.66 File "/tmp/tmphlld1n8u/pip.zip/pip/_internal/operations/prepare.py", line 303, in _download_http_url
#19 78.66 for chunk in download.chunks:dist-packages/pip/_vendor/resolvelib/resolvers.py", line 207, in _attempt_to_pin_criterion
#19 78.66 File "/tmp/tmphlld1n8u/pip.zip/pip/_internal/utils/ui.py", line 160, in iter
#19 78.66 for x in it:al/lib/python3.6/dist-packages/pip/_vendor/resolvelib/resolvers.py", line 198, in _get_criteria_to_update
#19 78.66 File "/tmp/tmphlld1n8u/pip.zip/pip/_internal/network/utils.py", line 39, in response_chunks
#19 78.66 decode_content=False,thon3.6/dist-packages/pip/_internal/resolution/resolvelib/provider.py", line 102, in get_dependencies
#19 78.66 File "/tmp/tmphlld1n8u/pip.zip/pip/_vendor/urllib3/response.py", line 564, in stream
#19 78.66 data = self.read(amt=amt, decode_content=decode_content)/resolution/resolvelib/provider.py", line 101, in
#19 78.66 File "/tmp/tmphlld1n8u/pip.zip/pip/_vendor/urllib3/response.py", line 529, in read
#19 78.66 raise IncompleteRead(self._fp_bytes_read, self.length_remaining)ion/resolvelib/candidates.py", line 252, in iter_dependencies
#19 78.66 File "/usr/lib/python3.6/contextlib.py", line 99, in exit
#19 78.66 self.gen.throw(type, value, traceback)ages/pip/_internal/resolution/resolvelib/candidates.py", line 234, in dist
#19 78.66 File "/tmp/tmphlld1n8u/pip.zip/pip/_vendor/urllib3/response.py", line 430, in _error_catcher
#19 78.66 raise ReadTimeoutError(self._pool, None, "Read timed out.")solution/resolvelib/candidates.py", line 221, in _prepare
#19 78.66 pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.
------.51 File "/usr/local/lib/python3.6/dist-packages/pip/_internal/resolution/resolvelib/candidates.py", line 314, in _prepare_distribution
failed to solve with frontend dockerfile.v0: failed to build LLB: executor failed running [/bin/sh -c /usr/bin/python3.6 get-pip.py]: runc did not terminate sucessfullyFile "/usr/local/lib/python3.6/dist-packages/pip/_internal/operations/prepare.py", line 480, in prepare_linked_requirement
#18 71.51 return self._prepare_linked_requirement(req, parallel_builds)
F:\Repository\testgit\KG-demo-for-movie-master>-packages/pip/_internal/operations/prepare.py", line 505, in _prepare_linked_requirement
#18 71.51 self.download_dir, hashes,
#18 71.51 File "/usr/local/lib/python3.6/dist-packages/pip/_internal/operations/prepare.py", line 257, in unpack_url
#18 71.51 hashes=hashes,
#18 71.51 File "/usr/local/lib/python3.6/dist-packages/pip/_internal/operations/prepare.py", line 130, in get_http_url
#18 71.51 from_path, content_type = download(link, temp_dir.path)
#18 71.51 File "/usr/local/lib/python3.6/dist-packages/pip/_internal/network/download.py", line 163, in call
#18 71.51 for chunk in chunks:
#18 71.51 File "/usr/local/lib/python3.6/dist-packages/pip/_internal/cli/progress_bars.py", line 168, in iter
#18 71.51 for x in it:
#18 71.51 File "/usr/local/lib/python3.6/dist-packages/pip/_internal/network/utils.py", line 88, in response_chunks
#18 71.51 decode_content=False,
#18 71.51 File "/usr/local/lib/python3.6/dist-packages/pip/_vendor/urllib3/response.py", line 576, in stream
#18 71.51 data = self.read(amt=amt, decode_content=decode_content)
#18 71.51 File "/usr/local/lib/python3.6/dist-packages/pip/_vendor/urllib3/response.py", line 541, in read
#18 71.51 raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
#18 71.51 File "/usr/lib/python3.6/contextlib.py", line 99, in exit
#18 71.51 self.gen.throw(type, value, traceback)
#18 71.51 File "/usr/local/lib/python3.6/dist-packages/pip/_vendor/urllib3/response.py", line 443, in _error_catcher
#18 71.51 raise ReadTimeoutError(self._pool, None, "Read timed out.")
#18 71.51 pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='pypi.tuna.tsinghua.edu.cn', port=443): Read timed out.


failed to solve with frontend dockerfile.v0: failed to build LLB: executor failed running [/bin/sh -c /usr/local/bin/pip3.6 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/ && rm -rf ~/.cache/pip]: runc did not terminate sucessfully

gitignore

感谢作者分享项目,不过看到有些pyc文件在git仓库里,是不是加一个.gitignore文件比较好。

Exception in thread "main" java.lang.ExceptionInInitializerError

大佬,您好,请问在执行.\dump-rdf.bat -o tlkg.nt .\tlkg_mapping.ttl时候出现错误:

Exception in thread "main" java.lang.ExceptionInInitializerError
        at com.ibm.icu.impl.UPropertyAliases.<clinit>(UPropertyAliases.java:87)
        at com.ibm.icu.lang.UCharacter.<clinit>(UCharacter.java:5680)
        at com.hp.hpl.jena.iri.impl.AbsLexer.difficultCodePoint(AbsLexer.java:139)
        at com.hp.hpl.jena.iri.impl.AbsLexer.difficultChar(AbsLexer.java:224)
        at com.hp.hpl.jena.iri.impl.LexerQuery.yylex(LexerQuery.java:603)
        at com.hp.hpl.jena.iri.impl.AbsLexer.analyse(AbsLexer.java:53)
        at com.hp.hpl.jena.iri.impl.Parser.<init>(Parser.java:112)
        at com.hp.hpl.jena.iri.impl.IRIImpl.<init>(IRIImpl.java:65)
        at com.hp.hpl.jena.iri.impl.AbsIRIImpl.create(AbsIRIImpl.java:702)
        at com.hp.hpl.jena.iri.IRI.resolve(IRI.java:431)
        at org.openjena.riot.system.IRIResolver$IRIResolverNormal.resolveSilent(IRIResolver.java:433)
        at org.openjena.riot.system.ParserProfileChecker.makeIRI(ParserProfileChecker.java:51)
        at org.openjena.riot.system.ParserProfileChecker.resolveIRI(ParserProfileChecker.java:45)
        at org.openjena.riot.system.ParserProfileChecker.createURI(ParserProfileChecker.java:103)
        at org.openjena.riot.system.ParserProfileBase.create(ParserProfileBase.java:165)
        at org.openjena.riot.lang.LangTurtleBase.tokenAsNode(LangTurtleBase.java:529)
        at org.openjena.riot.lang.LangTurtleBase.node(LangTurtleBase.java:366)
        at org.openjena.riot.lang.LangTurtleBase.triplesNode(LangTurtleBase.java:395)
        at org.openjena.riot.lang.LangTurtleBase.objectList(LangTurtleBase.java:376)
        at org.openjena.riot.lang.LangTurtleBase.predicateObjectItem(LangTurtleBase.java:309)
        at org.openjena.riot.lang.LangTurtleBase.predicateObjectList(LangTurtleBase.java:301)
        at org.openjena.riot.lang.LangTurtleBase.triples(LangTurtleBase.java:281)
        at org.openjena.riot.lang.LangTurtleBase.triplesSameSubject(LangTurtleBase.java:220)
        at org.openjena.riot.lang.LangTurtle.oneTopLevelElement(LangTurtle.java:46)
        at org.openjena.riot.lang.LangTurtleBase.runParser(LangTurtleBase.java:145)
        at org.openjena.riot.lang.LangBase.parse(LangBase.java:43)
        at org.openjena.riot.system.JenaReaderTurtle2.readWorker(JenaReaderTurtle2.java:45)
        at org.openjena.riot.system.JenaReaderRIOT.readImpl(JenaReaderRIOT.java:138)
        at org.openjena.riot.system.JenaReaderRIOT.read(JenaReaderRIOT.java:95)
        at com.hp.hpl.jena.rdf.model.impl.ModelCom.read(ModelCom.java:268)
        at com.hp.hpl.jena.util.FileManager.readModelWorker(FileManager.java:408)
        at com.hp.hpl.jena.util.FileManager.loadModelWorker(FileManager.java:312)
        at com.hp.hpl.jena.util.FileManager.loadModel(FileManager.java:298)
        at de.fuberlin.wiwiss.d2rq.SystemLoader.getMappingModel(SystemLoader.java:266)
        at de.fuberlin.wiwiss.d2rq.SystemLoader.getMapping(SystemLoader.java:300)
        at d2rq.dump_rdf.run(dump_rdf.java:97)
        at de.fuberlin.wiwiss.d2rq.CommandLineTool.process(CommandLineTool.java:158)
        at d2rq.dump_rdf.main(dump_rdf.java:40)
Caused by: java.lang.IllegalArgumentException: Invalid version number: Version number may be negative or greater than 255
        at com.ibm.icu.util.VersionInfo.getInstance(VersionInfo.java:188)
        at com.ibm.icu.impl.ICUDebug.getInstanceLenient(ICUDebug.java:65)
        at com.ibm.icu.impl.ICUDebug.<clinit>(ICUDebug.java:69)
        ... 38 more

有什么办法解决吗?

JenaFuseki这个类

你好,JenaFuseki这个类,除了逻辑上指服务器的意思,应该是和Fuseki没什么关系的吧 - 0-

main函数会运行很长时间吗?

你好,我走了一遍你博客里的整个流程,到最后一步执行query_main.py,但是运行了好长时间都没有问答的结果,程序也没有停止,这个过程是本来就很长吗?

自定义推理rules.ttl启动失败,Undefined prefix: ruleComedian

启动服务时报错:Undefined prefix: ruleComedian
如下图,该如何修改?
rules.ttl内容如下
@Prefix : http://www.kgdemo.com# .
@Prefix owl: http://www.w3.org/2002/07/owl# .
@Prefix rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# .
@Prefix xsd: http://www.w3.org/2001/XMLSchema# .
@Prefix rdfs: http://www.w3.org/2000/01/rdf-schema# .

[ruleComedian: (?p :hasActedIn ?m) (?m :hasGenre ?g) (?g :genreName '喜剧') -> (?p rdf:type :Comedian)]
[ruleSymmetric: (?p :hasActedIn ?m) -> (?m :hasActor ?p)]

image

cannot use a string pattern on a bytes-like object

File "C:\Users\mynumber\Anaconda3\lib\site-packages\refo\virtualmachine.py", line 49, in feed
if isinstance(self.pc, Accept) or not self.pc.comparison_function(x):

File "C:\Users\mynumber\KG-demo-for-movie\kg_demo_movie\KB_query\question_temp.py", line 62, in match
m1 = self.token.match(word.token)

TypeError: cannot use a string pattern on a bytes-like object
在运行query_main时 出现如上错误这是什么原因呢??

想请教一下我运行最新的这个版本,为什么运行query_main文件报错了

Traceback (most recent call last):
File "D:/Graduation project experiment/KG-demo-for-movie-master/kg_demo_movie/KB_query/query_main.py", line 65, in
ans = qa_interface.answer(question)
File "D:/Graduation project experiment/KG-demo-for-movie-master/kg_demo_movie/KB_query/query_main.py", line 33, in answer
result = self.fuseki.get_sparql_result(my_query)
File "D:\Graduation project experiment\KG-demo-for-movie-master\kg_demo_movie\KB_query\jena_sparql_endpoint.py", line 28, in get_sparql_result
return self.sparql_conn.query().convert()
File "D:\Python\lib\site-packages\SPARQLWrapper\Wrapper.py", line 1107, in query
return QueryResult(self._query())
File "D:\Python\lib\site-packages\SPARQLWrapper\Wrapper.py", line 1073, in _query
response = urlopener(request)
File "D:\Python\lib\urllib\request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "D:\Python\lib\urllib\request.py", line 526, in open
response = self._open(req, data)
File "D:\Python\lib\urllib\request.py", line 544, in _open
'_open', req)
File "D:\Python\lib\urllib\request.py", line 504, in _call_chain
result = func(*args)
File "D:\Python\lib\urllib\request.py", line 1346, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "D:\Python\lib\urllib\request.py", line 1321, in do_open
r = h.getresponse()
File "D:\Python\lib\http\client.py", line 1331, in getresponse
response.begin()
File "D:\Python\lib\http\client.py", line 297, in begin
version, status, reason = self._read_status()
File "D:\Python\lib\http\client.py", line 266, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

请教一下大家谢谢了

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.