simmerchan / kg-demo-for-movie Goto Github PK
View Code? Open in Web Editor NEW从无到有构建一个电影知识图谱,并基于该KG,开发一个简易的KBQA程序。
Home Page: https://zhuanlan.zhihu.com/knowledgegraph
从无到有构建一个电影知识图谱,并基于该KG,开发一个简易的KBQA程序。
Home Page: https://zhuanlan.zhihu.com/knowledgegraph
想问一下有哪位朋友知道OWL推理的时候,为什么简单的spo查询会返回结果,
但是执行
PREFIX : http://www.kgdemo.com#
PREFIX rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
PREFIX rdfs: http://www.w3.org/2000/01/rdf-schema#
SELECT * WHERE {
?x :movieTitle '功夫'.
?x ?p ?o.
}
时却显示无结果!
还有一个问题是关于ontology文件的作用,我看了官方文档却没发现哪里有用到这个文件!
,降低了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版本的问题
这个系列的文章很棒,十分感谢!
看完后,有两个建议:
1、第一篇完成后的结果,实际上是在第四篇用到的,建议说明一下,整体会更连贯
2、建议说明一下Demo所需软件环境的版本,有些哥们不熟的话,会多花费一些时间
2.1、Python版本2.7
2.2、jena和jena-fuseki的版本希望也能注明一下,我用的是最新的3.9,配置文件需要有相应调整才能跑起来
2.3、Demo在Windows下运行的话,会遇到字符集的一些问题,建议操作系统环境也说明一下
希望能出更多后续的文章,加油!
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.
工程中描述的 *.owl文件在哪~
[ 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'
ERROR: failed to solve: process "/bin/sh -c apt-get -y install python3.6" did not complete successfully: exit code: 100
看了你的CSDN中的文章后受益匪浅,也有一些疑问。
RDFS查询语言SPARQL,和mysql查询语言,哪一个效率更高一点,速度更快一点。
RDFS感觉上和mysql一样是个数据库,只不过语法不同而已
kg_demo_movie/crawler/movie_crawler.py 第266行,是否应该改为 mysql_cursor.execute("SET FOREIGN_KEY_CHECKS = 1")
我是把pip3.6直接改成了pip,然后多试几次,就好了
Originally posted by @sshimii in #26 (comment)
在近期的项目上,遇到了需要从大段自然语言中抽取数据的需求。我现在可以搞定分词、词性标定、并通过正则进行部分数据抽取。但由于语言并不规范,抽取规则太多,很难完全通过正则表达式抽取数据。
看了很多资料,大家推荐用深度学习的。但找了一大圈,没找到合适的项目或例子。您能帮忙推荐一个吗?或者有其他建议吗?感谢!
怎么找不见owl文件啊?
[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
感谢作者分享项目,不过看到有些pyc文件在git仓库里,是不是加一个.gitignore文件比较好。
大佬,您好,请问在执行.\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这个类,除了逻辑上指服务器的意思,应该是和Fuseki没什么关系的吧 - 0-
brew install jena fueseki
这句话的fueseki作者好像多打了个e,实际是fuseki
在运行爬去数据的时候,使用的是python2.7,请问是如何安装crawler.tradition2simple呢?我尝试使用pip安装不成功。
你好,我走了一遍你博客里的整个流程,到最后一步执行query_main.py,但是运行了好长时间都没有问答的结果,程序也没有停止,这个过程是本来就很长吗?
另外请问如何使用d2rq将hive中的数据转换成rdf的格式?
启动服务时报错: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)]
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时 出现如上错误这是什么原因呢??
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
请教一下大家谢谢了
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.