├── KGServer ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── Fuseki │ ├── LICENSE │ ├── NOTICE │ ├── README │ ├── bin │ │ ├── s-delete │ │ ├── s-get │ │ ├── s-head │ │ ├── s-post │ │ ├── s-put │ │ ├── s-query │ │ ├── s-update │ │ ├── s-update-form │ │ └── soh │ ├── fuseki │ ├── fuseki-backup │ ├── fuseki-server │ ├── fuseki-server.bat │ ├── fuseki-server.jar │ ├── fuseki.service │ ├── fuseki.war │ ├── kg_demo_movie.nt │ ├── run │ │ ├── config.ttl │ │ ├── configuration │ │ │ └── fuseki_conf.ttl │ │ ├── databases │ │ │ └── rules.ttl │ │ ├── shiro.ini │ │ ├── system │ │ │ ├── GOSP.dat │ │ │ ├── GOSP.idn │ │ │ ├── GPOS.dat │ │ │ ├── GPOS.idn │ │ │ ├── GSPO.dat │ │ │ ├── GSPO.idn │ │ │ ├── OSP.dat │ │ │ ├── OSP.idn │ │ │ ├── OSPG.dat │ │ │ ├── OSPG.idn │ │ │ ├── POS.dat │ │ │ ├── POS.idn │ │ │ ├── POSG.dat │ │ │ ├── POSG.idn │ │ │ ├── SPO.dat │ │ │ ├── SPO.idn │ │ │ ├── SPOG.dat │ │ │ ├── SPOG.idn │ │ │ ├── journal.jrnl │ │ │ ├── node2id.dat │ │ │ ├── node2id.idn │ │ │ ├── nodes.dat │ │ │ ├── prefix2id.dat │ │ │ ├── prefix2id.idn │ │ │ ├── prefixIdx.dat │ │ │ ├── prefixIdx.idn │ │ │ ├── prefixes.dat │ │ │ └── tdb.cfg │ │ └── templates │ │ │ ├── config-mem │ │ │ ├── config-service │ │ │ ├── config-tdb │ │ │ ├── config-tdb-dir │ │ │ └── config-tdb-mem │ └── webapp │ │ ├── WEB-INF │ │ └── web.xml │ │ ├── admin-logs.html │ │ ├── css │ │ ├── bootstrap-select.min.css │ │ ├── bootstrap-theme.css.map │ │ ├── bootstrap-theme.min.css │ │ ├── bootstrap.css.map │ │ ├── bootstrap.min.css │ │ ├── codemirror.css │ │ ├── codemirror.min.css │ │ ├── font-awesome.min.css │ │ ├── fui.css │ │ ├── jquery.dataTables.css │ │ ├── jquery.fileupload-noscript.css │ │ ├── jquery.fileupload-ui-noscript.css │ │ ├── jquery.fileupload-ui.css │ │ ├── jquery.fileupload.css │ │ ├── pivot.min.css │ │ ├── qonsole.css │ │ ├── yasqe.min.css │ │ └── yasr.min.css │ │ ├── dataset.html │ │ ├── documentation.html │ │ ├── fonts │ │ ├── FontAwesome.otf │ │ ├── fontawesome-webfont.eot │ │ ├── fontawesome-webfont.svg │ │ ├── fontawesome-webfont.ttf │ │ ├── fontawesome-webfont.woff │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ └── glyphicons-halflings-regular.woff │ │ ├── images │ │ ├── back_disabled.png │ │ ├── back_enabled.png │ │ ├── back_enabled_hover.png │ │ ├── favicon.ico │ │ ├── forward_disabled.png │ │ ├── forward_enabled.png │ │ ├── forward_enabled_hover.png │ │ ├── jena-logo-notext-small.png │ │ ├── sort_asc.png │ │ ├── sort_asc_disabled.png │ │ ├── sort_both.png │ │ ├── sort_desc.png │ │ ├── sort_desc_disabled.png │ │ └── wait30.gif │ │ ├── index.html │ │ ├── js │ │ ├── app │ │ │ ├── controllers │ │ │ │ ├── .svnkeep │ │ │ │ ├── dataset-controller.js │ │ │ │ ├── index-controller.js │ │ │ │ ├── manage-controller.js │ │ │ │ ├── query-controller.js │ │ │ │ ├── upload-controller.js │ │ │ │ └── validation-controller.js │ │ │ ├── fui.js │ │ │ ├── layouts │ │ │ │ └── .svnkeep │ │ │ ├── main.dataset.js │ │ │ ├── main.index.js │ │ │ ├── main.manage.js │ │ │ ├── main.validation.js │ │ │ ├── models │ │ │ │ ├── dataset-stats.js │ │ │ │ ├── dataset.js │ │ │ │ ├── fuseki-server.js │ │ │ │ ├── task.js │ │ │ │ └── validation-options.js │ │ │ ├── qonsole-config.js │ │ │ ├── routers │ │ │ │ └── .svnkeep │ │ │ ├── services │ │ │ │ ├── ping-service.js │ │ │ │ └── validation-service.js │ │ │ ├── templates │ │ │ │ ├── dataset-edit.tpl │ │ │ │ ├── dataset-info.tpl │ │ │ │ ├── dataset-management.tpl │ │ │ │ ├── dataset-selection-list.tpl │ │ │ │ ├── dataset-selector.tpl │ │ │ │ ├── dataset-simple-create.tpl │ │ │ │ ├── dataset-stats.tpl │ │ │ │ ├── file-upload.tpl │ │ │ │ └── uploadable-file.tpl │ │ │ ├── util │ │ │ │ └── page-utils.js │ │ │ └── views │ │ │ │ ├── .svnkeep │ │ │ │ ├── dataset-edit.js │ │ │ │ ├── dataset-info.js │ │ │ │ ├── dataset-management.js │ │ │ │ ├── dataset-selection-list.js │ │ │ │ ├── dataset-selector.js │ │ │ │ ├── dataset-simple-create.js │ │ │ │ ├── dataset-stats.js │ │ │ │ ├── datasets-dropdown-list.js │ │ │ │ ├── file-upload.js │ │ │ │ ├── tabbed-view-manager.js │ │ │ │ ├── uploadable-file.js │ │ │ │ └── validation-options.js │ │ ├── common-config.js │ │ └── lib │ │ │ ├── addon │ │ │ └── fold │ │ │ │ ├── brace-fold.js │ │ │ │ ├── comment-fold.js │ │ │ │ ├── foldcode.js │ │ │ │ ├── foldgutter.js │ │ │ │ └── xml-fold.js │ │ │ ├── backbone-min.js │ │ │ ├── backbone.js │ │ │ ├── backbone.marionette.js │ │ │ ├── bootstrap-select.min.js │ │ │ ├── bootstrap.min.js │ │ │ ├── html5shiv.js │ │ │ ├── jquery-1.10.2.js │ │ │ ├── jquery-1.10.2.min.js │ │ │ ├── jquery-ui.min.js │ │ │ ├── jquery.dataTables.min.js │ │ │ ├── jquery.fileupload.js │ │ │ ├── jquery.fileupload.local.js │ │ │ ├── jquery.form.js │ │ │ ├── jquery.iframe-transport.js │ │ │ ├── jquery.ui.widget.js │ │ │ ├── jquery.xdomainrequest.js │ │ │ ├── lib │ │ │ └── codemirror.js │ │ │ ├── mode │ │ │ ├── javascript │ │ │ │ └── javascript.js │ │ │ ├── sparql │ │ │ │ └── sparql.js │ │ │ ├── turtle │ │ │ │ └── turtle.js │ │ │ └── xml │ │ │ │ └── xml.js │ │ │ ├── pivot.js │ │ │ ├── pivot.min.js │ │ │ ├── pivot.min.js.map │ │ │ ├── plugins │ │ │ └── text.js │ │ │ ├── qonsole.js │ │ │ ├── refresh.sh │ │ │ ├── require.js │ │ │ ├── require.min.js │ │ │ ├── respond.min.js │ │ │ ├── sprintf-0.7-beta1.js │ │ │ ├── underscore.js │ │ │ ├── yasqe.min.js │ │ │ ├── yasqe.min.js.map │ │ │ ├── yasr.min.js │ │ │ └── yasr.min.js.map │ │ ├── manage.html │ │ ├── services.html │ │ ├── test │ │ └── test-fuseki-config.ttl │ │ └── validate.html ├── lib │ ├── hanlp-1.6.6-sources.jar │ └── hanlp-1.6.6.jar ├── mvnw ├── mvnw.cmd ├── newnode.txt ├── pom.xml └── src │ └── main │ ├── java │ ├── NLP │ │ ├── Doc2Vec.java │ │ ├── Question2Sparql_2.java │ │ ├── QunN.java │ │ ├── Show.java │ │ └── Word2Vec.java │ ├── TDB │ │ ├── HandleTDB.java │ │ └── InsertTDB.java │ ├── org │ │ └── horizon │ │ │ ├── KGServer.java │ │ │ ├── Neo4j │ │ │ └── Util.java │ │ │ ├── bean │ │ │ ├── Department.java │ │ │ ├── Employee.java │ │ │ ├── Hr.java │ │ │ ├── HrRole.java │ │ │ ├── JobLevel.java │ │ │ ├── MapJ.java │ │ │ ├── Menu.java │ │ │ ├── MenuMeta.java │ │ │ ├── Nation.java │ │ │ ├── Personnel.java │ │ │ ├── PoliticsStatus.java │ │ │ ├── Position.java │ │ │ ├── RespBean.java │ │ │ ├── Role.java │ │ │ ├── Salary.java │ │ │ └── Student.java │ │ │ ├── common │ │ │ ├── DateConverter.java │ │ │ ├── EmailRunnable.java │ │ │ ├── ErrorCode.java │ │ │ ├── ErrorResponse.java │ │ │ ├── HrUtils.java │ │ │ ├── InMemoryDatabaseConfig.java │ │ │ ├── WebUtil.java │ │ │ ├── poi │ │ │ │ ├── PersonnelUtils.java │ │ │ │ ├── PoiUtils.java │ │ │ │ └── StudentUtils.java │ │ │ └── security │ │ │ │ ├── CustomCorsFilter.java │ │ │ │ ├── RestAuthenticationEntryPoint.java │ │ │ │ ├── auth │ │ │ │ ├── JwtAuthenticationToken.java │ │ │ │ ├── ajax │ │ │ │ │ ├── AjaxAuthenticationProvider.java │ │ │ │ │ ├── AjaxAwareAuthenticationFailureHandler.java │ │ │ │ │ ├── AjaxAwareAuthenticationSuccessHandler.java │ │ │ │ │ ├── AjaxLoginProcessingFilter.java │ │ │ │ │ └── LoginRequest.java │ │ │ │ └── jwt │ │ │ │ │ ├── JwtAuthenticationProvider.java │ │ │ │ │ ├── JwtTokenAuthenticationProcessingFilter.java │ │ │ │ │ ├── SkipPathRequestMatcher.java │ │ │ │ │ ├── extractor │ │ │ │ │ ├── JwtHeaderTokenExtractor.java │ │ │ │ │ └── TokenExtractor.java │ │ │ │ │ └── verifier │ │ │ │ │ ├── BloomFilterTokenVerifier.java │ │ │ │ │ └── TokenVerifier.java │ │ │ │ ├── config │ │ │ │ ├── JwtSettings.java │ │ │ │ ├── PasswordEncoderConfig.java │ │ │ │ └── WebSecurityConfig.java │ │ │ │ ├── endpoint │ │ │ │ └── RefreshTokenEndpoint.java │ │ │ │ ├── exceptions │ │ │ │ ├── AuthMethodNotSupportedException.java │ │ │ │ ├── InvalidJwtToken.java │ │ │ │ └── JwtExpiredTokenException.java │ │ │ │ └── model │ │ │ │ ├── Scopes.java │ │ │ │ ├── UserContext.java │ │ │ │ └── token │ │ │ │ ├── AccessJwtToken.java │ │ │ │ ├── JwtToken.java │ │ │ │ ├── JwtTokenFactory.java │ │ │ │ ├── RawAccessJwtToken.java │ │ │ │ └── RefreshToken.java │ │ │ ├── config │ │ │ ├── AuthenticationAccessDeniedHandler.java │ │ │ ├── UrlAccessDecisionManager.java │ │ │ ├── UrlFilterInvocationSecurityMetadataSource.java │ │ │ ├── WebMvcConfig.java │ │ │ └── WebSecurityConfig.java │ │ │ ├── controller │ │ │ ├── ConfigController.java │ │ │ ├── EmployeeController.java │ │ │ ├── PersonnelController.java │ │ │ ├── RegLoginController.java │ │ │ ├── emp │ │ │ │ ├── EmpBasicController.java │ │ │ │ ├── newnode.txt │ │ │ │ └── newrelation.txt │ │ │ ├── salary │ │ │ │ ├── SalaryController.java │ │ │ │ └── SalaryEmpController.java │ │ │ ├── student │ │ │ │ └── StudentController.java │ │ │ └── system │ │ │ │ ├── SystemBasicController.java │ │ │ │ └── SystemHrController.java │ │ │ ├── exception │ │ │ └── CustomExceptionResolver.java │ │ │ ├── mapper │ │ │ ├── DepartmentMapper.java │ │ │ ├── DepartmentMapper.xml │ │ │ ├── EmpMapper.java │ │ │ ├── EmpMapper.xml │ │ │ ├── HrMapper.java │ │ │ ├── HrMapper.xml │ │ │ ├── JobLevelMapper.java │ │ │ ├── JobLevelMapper.xml │ │ │ ├── MenuMapper.java │ │ │ ├── MenuMapper.xml │ │ │ ├── MenuRoleMapper.java │ │ │ ├── MenuRoleMapper.xml │ │ │ ├── PersonnelMapper.java │ │ │ ├── PersonnelMapper.xml │ │ │ ├── PositionMapper.java │ │ │ ├── PositionMapper.xml │ │ │ ├── RoleMapper.java │ │ │ ├── RoleMapper.xml │ │ │ ├── SalaryMapper.java │ │ │ ├── SalaryMapper.xml │ │ │ ├── StudentMapper.java │ │ │ ├── StudentMapper.xml │ │ │ └── SystemMapper.java │ │ │ └── service │ │ │ ├── DepartmentService.java │ │ │ ├── EmpService.java │ │ │ ├── HrService.java │ │ │ ├── JobLevelService.java │ │ │ ├── MenuRoleService.java │ │ │ ├── MenuService.java │ │ │ ├── PersonnelService.java │ │ │ ├── PositionService.java │ │ │ ├── RoleService.java │ │ │ ├── SalaryService.java │ │ │ ├── StudentService.java │ │ │ └── SystemService.java │ └── test.java │ └── resources │ ├── application.properties │ ├── application.yml │ ├── ftl │ └── email.ftl │ ├── hanlp.properties │ ├── mybatis-config.xml │ ├── static │ ├── index.html │ └── static │ │ ├── css │ │ ├── app.6cb628d4625a7f919c738b82f1d3116b.css │ │ └── app.6cb628d4625a7f919c738b82f1d3116b.css.map │ │ ├── fonts │ │ ├── element-icons.6f0a763.ttf │ │ ├── fontawesome-webfont.674f50d.eot │ │ ├── fontawesome-webfont.af7ae50.woff2 │ │ ├── fontawesome-webfont.b06871f.ttf │ │ └── fontawesome-webfont.fee66e7.woff │ │ ├── img │ │ └── fontawesome-webfont.912ec66.svg │ │ └── js │ │ ├── 0.024699a367c602dc3fd4.js │ │ ├── 0.024699a367c602dc3fd4.js.map │ │ ├── 1.86ac68dee683d077f76d.js │ │ ├── 1.86ac68dee683d077f76d.js.map │ │ ├── 2.d59f8add63cac6302342.js │ │ ├── 2.d59f8add63cac6302342.js.map │ │ ├── 3.1a3428d2e4bedb745200.js │ │ ├── 3.1a3428d2e4bedb745200.js.map │ │ ├── 4.b25d67ddc90d6ac44980.js │ │ ├── 4.b25d67ddc90d6ac44980.js.map │ │ ├── 5.00192f6b258763152047.js │ │ ├── 5.00192f6b258763152047.js.map │ │ ├── app.3b84d16288cea5119fe2.js │ │ ├── app.3b84d16288cea5119fe2.js.map │ │ ├── manifest.299d11d1ac656dd1152c.js │ │ ├── manifest.299d11d1ac656dd1152c.js.map │ │ ├── vendor.59f7a0d2e440c37c0dac.js │ │ └── vendor.59f7a0d2e440c37c0dac.js.map │ └── vhr.sql ├── KGWeb ├── .babelrc ├── .editorconfig ├── .gitignore ├── .postcssrc.js ├── README.md ├── build │ ├── build.js │ ├── check-versions.js │ ├── logo.png │ ├── utils.js │ ├── vue-loader.conf.js │ ├── webpack.base.conf.js │ ├── webpack.dev.conf.js │ └── webpack.prod.conf.js ├── config │ ├── dev.env.js │ ├── index.js │ └── prod.env.js ├── index.html ├── package-lock.json ├── package.json ├── src │ ├── App.vue │ ├── components │ │ ├── 111.jpg │ │ ├── Home.vue │ │ ├── Login.vue │ │ ├── emp │ │ │ ├── AEmpBasic.vue │ │ │ ├── EmpAdv.vue │ │ │ ├── EmpBasic.vue │ │ │ ├── EmpBasic.vue.bak │ │ │ ├── EmpBasic2.vue │ │ │ └── EmpBasic_n.vue │ │ ├── personnel │ │ │ ├── PerEc.vue │ │ │ ├── PerEc.vue.bak │ │ │ ├── PerEc.vue2 │ │ │ ├── PerEcD3.vue │ │ │ ├── PerEmp.vue │ │ │ ├── PerMv.vue │ │ │ ├── PerSalary.vue │ │ │ ├── PerTrain.vue │ │ │ ├── PerTrain1.vue │ │ │ ├── d3.geom.js │ │ │ ├── d3.js │ │ │ ├── d3.layout.js │ │ │ ├── repeat.vue │ │ │ └── test.js │ │ ├── salary │ │ │ ├── SalMonth.vue │ │ │ ├── SalSearch.vue │ │ │ ├── SalSob.vue │ │ │ ├── SalSobCfg.vue │ │ │ └── SalTable.vue │ │ ├── save.jpg │ │ ├── statistics │ │ │ ├── StaAll.vue │ │ │ ├── StaPers.vue │ │ │ ├── StaRecord.vue │ │ │ └── StaScore.vue │ │ └── system │ │ │ ├── SysBasic.vue │ │ │ ├── SysCfg.vue │ │ │ ├── SysData.vue │ │ │ ├── SysHr.vue │ │ │ ├── SysInit.vue │ │ │ ├── SysLog.vue │ │ │ └── basic │ │ │ ├── DepMana.vue │ │ │ ├── ECMana.vue │ │ │ ├── JobTitleMana.vue │ │ │ ├── MenuRole.vue │ │ │ └── PosMana.vue │ ├── main.js │ ├── router │ │ └── index.js │ ├── store │ │ └── index.js │ └── utils │ │ ├── api.js │ │ ├── d3.geom.js │ │ ├── d3.js │ │ ├── d3.layout.js │ │ ├── filter_utils.js │ │ └── utils.js └── static │ ├── .gitkeep │ └── test.html └── README.md /KGServer/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | 4 | ### STS ### 5 | .apt_generated 6 | .classpath 7 | .factorypath 8 | .project 9 | .settings 10 | .springBeans 11 | 12 | ### IntelliJ IDEA ### 13 | .idea 14 | *.iws 15 | *.iml 16 | *.ipr 17 | 18 | ### NetBeans ### 19 | nbproject/private/ 20 | build/ 21 | nbbuild/ 22 | dist/ 23 | nbdist/ 24 | .nb-gradle/ -------------------------------------------------------------------------------- /KGServer/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /KGServer/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip 2 | -------------------------------------------------------------------------------- /KGServer/Fuseki/fuseki-backup: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | # Simple backup script for Fuseki - adapt as needed. 19 | # You may need to set the URL for example. 20 | # This script trigger the backup. It does not wait for it to complete. 21 | # Backups are placed in the /backups/ directory. 22 | 23 | if [[ $# != 1 ]] 24 | then 25 | echo "Usage : $(basename $0) NAME" 1>&2 26 | exit 1 27 | fi 28 | 29 | NAME="$1" 30 | 31 | curl -XPOST "http://localhost:3030/\$/backup/${NAME}" 32 | 33 | # You can track the background task with: 34 | #curl 'http://localhost:3030/$/tasks' 35 | -------------------------------------------------------------------------------- /KGServer/Fuseki/fuseki-server.bat: -------------------------------------------------------------------------------- 1 | @REM Licensed to the Apache Software Foundation (ASF) under one 2 | @REM or more contributor license agreements. See the NOTICE file 3 | @REM distributed with this work for additional information 4 | @REM regarding copyright ownership. The ASF licenses this file 5 | @REM to you under the Apache License, Version 2.0 (the 6 | @REM "License"); you may not use this file except in compliance 7 | @REM with the License. You may obtain a copy of the License at 8 | @REM 9 | @REM http://www.apache.org/licenses/LICENSE-2.0 10 | @REM 11 | @REM Unless required by applicable law or agreed to in writing, software 12 | @REM distributed under the License is distributed on an "AS IS" BASIS, 13 | @REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | @REM See the License for the specific language governing permissions and 15 | @REM limitations under the License. 16 | 17 | @echo off 18 | @REM modify this to name the server jar 19 | java -Xmx1200M -jar fuseki-server.jar %* 20 | 21 | @REM Adding custom code to the Fuseki server: 22 | @REM 23 | @REM It is also possible to launch Fuseki using 24 | @REM java ..jvmarsg... -cp $JAR org.apache.jena.fuseki.cmd.FusekiCmd %* 25 | @REM 26 | @REM In this way, you can add custom java to the classpath: 27 | @REM 28 | @REM java ... -cp fuseki-server.jar;MyCustomCode.jar org.apache.jena.fuseki.cmd.FusekiCmd %* 29 | -------------------------------------------------------------------------------- /KGServer/Fuseki/fuseki-server.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/fuseki-server.jar -------------------------------------------------------------------------------- /KGServer/Fuseki/fuseki.service: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | # ========= 18 | # 19 | # Fuseki service configuration / unit file for systemd 20 | # 21 | # Usage: 22 | # ------ 23 | # 24 | # 1. Place this file under /etc/systemd/system/ 25 | # 2. Create a system user called "fuseki" and make sure it has permission 26 | # to access the Fuseki configuration and databases 27 | # 3. Adjust the paths and other settings below if necessary 28 | # 4. Activate using: sudo systemctl enable fuseki.service 29 | 30 | [Unit] 31 | Description=Fuseki 32 | 33 | [Service] 34 | # Edit environment variables to match your installation 35 | Environment=FUSEKI_HOME=/opt/fuseki 36 | Environment=FUSEKI_BASE=/etc/fuseki 37 | # Edit the line below to adjust the amount of memory allocated to Fuseki 38 | Environment=JVM_ARGS=-Xmx2G 39 | # Edit to match your installation 40 | ExecStart=/opt/fuseki/fuseki-server 41 | # Run as user "fuseki" 42 | User=fuseki 43 | Restart=on-abort 44 | # Java processes exit with status 143 when terminated by SIGTERM, this 45 | # should be considered a successful shutdown 46 | SuccessExitStatus=143 47 | ### By default, the service logs to journalctl only. 48 | ### If additional logging to a file is required, uncomment the following three lines 49 | # StandardOutput=syslog 50 | # StandardError=syslog 51 | # SyslogIdentifier=fuseki 52 | ### This logs to syslog. If, e.g., rsyslogd is used, you can provide a file 53 | ### /etc/rsyslog.d/fuseki.conf, consisting of the following two lines (uncommented) 54 | ### if $programname == 'fuseki' then /var/log/fuseki/stderrout.log 55 | ### if $programname == 'fuseki' then stop 56 | 57 | 58 | [Install] 59 | WantedBy=multi-user.target 60 | -------------------------------------------------------------------------------- /KGServer/Fuseki/fuseki.war: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/fuseki.war -------------------------------------------------------------------------------- /KGServer/Fuseki/run/config.ttl: -------------------------------------------------------------------------------- 1 | # Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0 2 | 3 | ## Fuseki Server configuration file. 4 | 5 | @prefix : <#> . 6 | @prefix fuseki: . 7 | @prefix rdf: . 8 | @prefix rdfs: . 9 | @prefix ja: . 10 | 11 | [] rdf:type fuseki:Server ; 12 | # Example:: 13 | # Server-wide query timeout. 14 | # 15 | # Timeout - server-wide default: milliseconds. 16 | # Format 1: "1000" -- 1 second timeout 17 | # Format 2: "10000,60000" -- 10s timeout to first result, 18 | # then 60s timeout for the rest of query. 19 | # 20 | # See javadoc for ARQ.queryTimeout for details. 21 | # This can also be set on a per dataset basis in the dataset assembler. 22 | # 23 | # ja:context [ ja:cxtName "arq:queryTimeout" ; ja:cxtValue "30000" ] ; 24 | 25 | # Add any custom classes you want to load. 26 | # Must have a "public static void init()" method. 27 | # ja:loadClass "your.code.Class" ; 28 | 29 | # End triples. 30 | . 31 | -------------------------------------------------------------------------------- /KGServer/Fuseki/run/configuration/fuseki_conf.ttl: -------------------------------------------------------------------------------- 1 | @prefix : . 2 | @prefix tdb: . 3 | @prefix rdf: . 4 | @prefix ja: . 5 | @prefix rdfs: . 6 | @prefix fuseki: . 7 | 8 | 9 | :service1 a fuseki:Service ; 10 | fuseki:dataset <#dataset> ; 11 | fuseki:name "kg_demo_medicine" ; 12 | fuseki:serviceQuery "query" ; 13 | fuseki:serviceReadGraphStore "get" ; 14 | fuseki:serviceReadWriteGraphStore "data" ; 15 | fuseki:serviceUpdate "update"; 16 | fuseki:serviceUpload "upload" . 17 | 18 | 19 | <#dataset> rdf:type ja:RDFDataset ; 20 | ja:defaultGraph <#model_inf> ; 21 | . 22 | 23 | <#model_inf> a ja:InfModel ; 24 | ja:baseModel <#tdbGraph> ; 25 | 26 | #本体文件的路径 27 | ja:content [ja:externalContent ] ; 28 | 29 | #启用OWL推理机 30 | #ja:reasoner [ja:reasonerURL ] . 31 | #开启规则推理机,并指定规则文件路径 32 | ja:reasoner [ 33 | ja:reasonerURL ; 34 | ja:rulesFrom ; ] 35 | . 36 | 37 | <#tdbGraph> rdf:type tdb:GraphTDB ; 38 | tdb:dataset <#tdbDataset> ; 39 | . 40 | 41 | <#tdbDataset> rdf:type tdb:DatasetTDB ; 42 | tdb:location "E:/algorithm_code/java/KGQADemo/data/KGQATDB" ; 43 | . -------------------------------------------------------------------------------- /KGServer/Fuseki/run/databases/rules.ttl: -------------------------------------------------------------------------------- 1 | @prefix a: . 2 | @prefix fa: . 3 | @prefix fb: . 4 | [ruleZhuyuan: (?p ?m) (?m \"内科\"@ZH) -> (?p \"yes\"@ZH)] 5 | 6 | -------------------------------------------------------------------------------- /KGServer/Fuseki/run/shiro.ini: -------------------------------------------------------------------------------- 1 | # Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0 2 | 3 | [main] 4 | # Development 5 | ssl.enabled = false 6 | 7 | plainMatcher=org.apache.shiro.authc.credential.SimpleCredentialsMatcher 8 | #iniRealm=org.apache.shiro.realm.text.IniRealm 9 | iniRealm.credentialsMatcher = $plainMatcher 10 | 11 | localhostFilter=org.apache.jena.fuseki.authz.LocalhostFilter 12 | 13 | [users] 14 | # Implicitly adds "iniRealm = org.apache.shiro.realm.text.IniRealm" 15 | admin=pw 16 | 17 | [roles] 18 | 19 | [urls] 20 | ## Control functions open to anyone 21 | /$/status = anon 22 | /$/ping = anon 23 | 24 | ## and the rest are restricted to localhost. 25 | /$/** = localhostFilter 26 | 27 | ## If you want simple, basic authentication user/password 28 | ## on the operations, 29 | ## 1 - set a better password in [users] above. 30 | ## 2 - comment out the "/$/** = localhost" line and use: 31 | ## "/$/** = authcBasic,user[admin]" 32 | 33 | ## or to allow any access. 34 | ##/$/** = anon 35 | 36 | # Everything else 37 | /**=anon 38 | -------------------------------------------------------------------------------- /KGServer/Fuseki/run/system/GOSP.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/run/system/GOSP.dat -------------------------------------------------------------------------------- /KGServer/Fuseki/run/system/GOSP.idn: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /KGServer/Fuseki/run/system/GPOS.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/run/system/GPOS.dat -------------------------------------------------------------------------------- /KGServer/Fuseki/run/system/GPOS.idn: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /KGServer/Fuseki/run/system/GSPO.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/run/system/GSPO.dat -------------------------------------------------------------------------------- /KGServer/Fuseki/run/system/GSPO.idn: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /KGServer/Fuseki/run/system/OSP.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/run/system/OSP.dat -------------------------------------------------------------------------------- /KGServer/Fuseki/run/system/OSP.idn: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /KGServer/Fuseki/run/system/OSPG.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/run/system/OSPG.dat -------------------------------------------------------------------------------- /KGServer/Fuseki/run/system/OSPG.idn: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /KGServer/Fuseki/run/system/POS.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/run/system/POS.dat -------------------------------------------------------------------------------- /KGServer/Fuseki/run/system/POS.idn: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /KGServer/Fuseki/run/system/POSG.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/run/system/POSG.dat -------------------------------------------------------------------------------- /KGServer/Fuseki/run/system/POSG.idn: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /KGServer/Fuseki/run/system/SPO.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/run/system/SPO.dat -------------------------------------------------------------------------------- /KGServer/Fuseki/run/system/SPO.idn: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /KGServer/Fuseki/run/system/SPOG.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/run/system/SPOG.dat -------------------------------------------------------------------------------- /KGServer/Fuseki/run/system/SPOG.idn: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /KGServer/Fuseki/run/system/journal.jrnl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/run/system/journal.jrnl -------------------------------------------------------------------------------- /KGServer/Fuseki/run/system/node2id.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/run/system/node2id.dat -------------------------------------------------------------------------------- /KGServer/Fuseki/run/system/node2id.idn: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /KGServer/Fuseki/run/system/nodes.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/run/system/nodes.dat -------------------------------------------------------------------------------- /KGServer/Fuseki/run/system/prefix2id.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/run/system/prefix2id.dat -------------------------------------------------------------------------------- /KGServer/Fuseki/run/system/prefix2id.idn: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /KGServer/Fuseki/run/system/prefixIdx.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/run/system/prefixIdx.dat -------------------------------------------------------------------------------- /KGServer/Fuseki/run/system/prefixIdx.idn: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /KGServer/Fuseki/run/system/prefixes.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/run/system/prefixes.dat -------------------------------------------------------------------------------- /KGServer/Fuseki/run/system/tdb.cfg: -------------------------------------------------------------------------------- 1 | { 2 | "tdb.file_mode" : "direct" , 3 | "tdb.block_size" : 1024 , 4 | "tdb.block_read_cache_size" : 50 , 5 | "tdb.block_write_cache_size" : 20 , 6 | "tdb.node2nodeid_cache_size" : 500 , 7 | "tdb.nodeid2node_cache_size" : 500 , 8 | "tdb.node_miss_cache_size" : 100 , 9 | "tdb.index_node2id" : "node2id" , 10 | "tdb.index_id2node" : "nodes" , 11 | "tdb.triple_index_primary" : "SPO" , 12 | "tdb.triple_indexes" : [ 13 | "SPO" , 14 | "POS" , 15 | "OSP" 16 | ] , 17 | "tdb.quad_index_primary" : "GSPO" , 18 | "tdb.quad_indexes" : [ 19 | "GSPO" , 20 | "GPOS" , 21 | "GOSP" , 22 | "POSG" , 23 | "OSPG" , 24 | "SPOG" 25 | ] , 26 | "tdb.prefix_index_primary" : "GPU" , 27 | "tdb.prefix_indexes" : [ "GPU" ] , 28 | "tdb.file_prefix_index" : "prefixIdx" , 29 | "tdb.file_prefix_nodeid" : "prefix2id" , 30 | "tdb.file_prefix_id2node" : "prefixes" 31 | } 32 | 33 | -------------------------------------------------------------------------------- /KGServer/Fuseki/run/templates/config-mem: -------------------------------------------------------------------------------- 1 | # Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0 2 | 3 | @prefix : <#> . 4 | @prefix fuseki: . 5 | @prefix rdf: . 6 | 7 | @prefix rdfs: . 8 | @prefix tdb: . 9 | @prefix ja: . 10 | 11 | ## --------------------------------------------------------------- 12 | ## Updatable in-memory dataset. 13 | 14 | <#service1> rdf:type fuseki:Service ; 15 | # URI of the dataset -- http://host:port/{NAME} 16 | fuseki:name "{NAME}" ; 17 | fuseki:serviceQuery "sparql" ; 18 | fuseki:serviceQuery "query" ; 19 | fuseki:serviceUpdate "update" ; 20 | fuseki:serviceUpload "upload" ; 21 | fuseki:serviceReadWriteGraphStore "data" ; 22 | fuseki:serviceReadGraphStore "get" ; 23 | fuseki:dataset <#dataset> ; 24 | . 25 | 26 | # Transactional, in-memory dataset. Initially empty. 27 | <#dataset> rdf:type ja:DatasetTxnMem . 28 | -------------------------------------------------------------------------------- /KGServer/Fuseki/run/templates/config-service: -------------------------------------------------------------------------------- 1 | # Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0 2 | 3 | @prefix : <#> . 4 | @prefix fuseki: . 5 | @prefix rdf: . 6 | 7 | @prefix rdfs: . 8 | @prefix tdb: . 9 | @prefix ja: . 10 | 11 | ## --------------------------------------------------------------- 12 | ## Read-only in-memory dataset - used as a default, dummy datasets 13 | 14 | <#service1> rdf:type fuseki:Service ; 15 | fuseki:name "" ; 16 | fuseki:serviceQuery "sparql" ; 17 | fuseki:serviceQuery "query" ; 18 | fuseki:serviceReadGraphStore "get" ; 19 | fuseki:dataset <#dataset> ; 20 | . 21 | 22 | ## In-memory, empty. 23 | <#dataset> rdf:type ja:RDFDataset . 24 | -------------------------------------------------------------------------------- /KGServer/Fuseki/run/templates/config-tdb: -------------------------------------------------------------------------------- 1 | # Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0 2 | 3 | @prefix : <#> . 4 | @prefix fuseki: . 5 | @prefix rdf: . 6 | @prefix rdfs: . 7 | @prefix tdb: . 8 | @prefix ja: . 9 | 10 | ## --------------------------------------------------------------- 11 | ## Updatable TDB dataset with all services enabled. 12 | 13 | <#service_tdb_all> rdf:type fuseki:Service ; 14 | rdfs:label "TDB {NAME}" ; 15 | fuseki:name "{NAME}" ; 16 | fuseki:serviceQuery "query" ; 17 | fuseki:serviceQuery "sparql" ; 18 | fuseki:serviceUpdate "update" ; 19 | fuseki:serviceUpload "upload" ; 20 | fuseki:serviceReadWriteGraphStore "data" ; 21 | # A separate read-only graph store endpoint: 22 | fuseki:serviceReadGraphStore "get" ; 23 | fuseki:dataset <#tdb_dataset_readwrite> ; 24 | 25 | . 26 | 27 | <#tdb_dataset_readwrite> rdf:type tdb:DatasetTDB ; 28 | tdb:location "{FUSEKI_BASE}/databases/{NAME}" ; 29 | ##ja:context [ ja:cxtName "arq:queryTimeout" ; ja:cxtValue "3000" ] ; 30 | ##tdb:unionDefaultGraph true ; 31 | . 32 | -------------------------------------------------------------------------------- /KGServer/Fuseki/run/templates/config-tdb-dir: -------------------------------------------------------------------------------- 1 | # Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0 2 | 3 | @prefix : <#> . 4 | @prefix fuseki: . 5 | @prefix rdf: . 6 | @prefix rdfs: . 7 | @prefix tdb: . 8 | @prefix ja: . 9 | 10 | ## --------------------------------------------------------------- 11 | ## Updatable TDB dataset with all services enabled. 12 | 13 | <#service_tdb_all> rdf:type fuseki:Service ; 14 | rdfs:label "TDB {NAME}" ; 15 | fuseki:name "{NAME}" ; 16 | fuseki:serviceQuery "query" ; 17 | fuseki:serviceQuery "sparql" ; 18 | fuseki:serviceUpdate "update" ; 19 | fuseki:serviceUpload "upload" ; 20 | fuseki:serviceReadWriteGraphStore "data" ; 21 | # A separate read-only graph store endpoint: 22 | fuseki:serviceReadGraphStore "get" ; 23 | fuseki:dataset <#tdb_dataset_readwrite> ; 24 | 25 | . 26 | 27 | <#tdb_dataset_readwrite> rdf:type tdb:DatasetTDB ; 28 | tdb:location "{DIR}" ; 29 | ##tdb:unionDefaultGraph true ; 30 | . 31 | -------------------------------------------------------------------------------- /KGServer/Fuseki/run/templates/config-tdb-mem: -------------------------------------------------------------------------------- 1 | # Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0 2 | 3 | @prefix : <#> . 4 | @prefix fuseki: . 5 | @prefix rdf: . 6 | @prefix rdfs: . 7 | @prefix tdb: . 8 | @prefix ja: . 9 | 10 | ## --------------------------------------------------------------- 11 | ## Updatable TDB dataset im-memory with all services enabled. 12 | 13 | <#service_tdb_all> rdf:type fuseki:Service ; 14 | rdfs:label "TDB {NAME}" ; 15 | fuseki:name "{NAME}" ; 16 | fuseki:serviceQuery "query" ; 17 | fuseki:serviceQuery "sparql" ; 18 | fuseki:serviceUpdate "update" ; 19 | fuseki:serviceUpload "upload" ; 20 | fuseki:serviceReadWriteGraphStore "data" ; 21 | # A separate read-only graph store endpoint: 22 | fuseki:serviceReadGraphStore "get" ; 23 | fuseki:dataset <#tdb_dataset_readwrite> ; 24 | 25 | . 26 | 27 | <#tdb_dataset_readwrite> rdf:type tdb:DatasetTDB ; 28 | tdb:location "--mem--" ; 29 | ## tdb:unionDefaultGraph true ; 30 | . 31 | -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/css/jquery.fileupload-noscript.css: -------------------------------------------------------------------------------- 1 | @charset "UTF-8"; 2 | /* 3 | * jQuery File Upload Plugin NoScript CSS 1.2.0 4 | * https://github.com/blueimp/jQuery-File-Upload 5 | * 6 | * Copyright 2013, Sebastian Tschan 7 | * https://blueimp.net 8 | * 9 | * Licensed under the MIT license: 10 | * http://www.opensource.org/licenses/MIT 11 | */ 12 | 13 | .fileinput-button input { 14 | position: static; 15 | opacity: 1; 16 | filter: none; 17 | font-size: inherit; 18 | direction: inherit; 19 | } 20 | .fileinput-button span { 21 | display: none; 22 | } 23 | -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/css/jquery.fileupload-ui-noscript.css: -------------------------------------------------------------------------------- 1 | @charset "UTF-8"; 2 | /* 3 | * jQuery File Upload UI Plugin NoScript CSS 8.8.5 4 | * https://github.com/blueimp/jQuery-File-Upload 5 | * 6 | * Copyright 2012, Sebastian Tschan 7 | * https://blueimp.net 8 | * 9 | * Licensed under the MIT license: 10 | * http://www.opensource.org/licenses/MIT 11 | */ 12 | 13 | .fileinput-button i, 14 | .fileupload-buttonbar .delete, 15 | .fileupload-buttonbar .toggle { 16 | display: none; 17 | } 18 | -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/css/jquery.fileupload-ui.css: -------------------------------------------------------------------------------- 1 | @charset "UTF-8"; 2 | /* 3 | * jQuery File Upload UI Plugin CSS 9.0.0 4 | * https://github.com/blueimp/jQuery-File-Upload 5 | * 6 | * Copyright 2010, Sebastian Tschan 7 | * https://blueimp.net 8 | * 9 | * Licensed under the MIT license: 10 | * http://www.opensource.org/licenses/MIT 11 | */ 12 | 13 | .fileupload-buttonbar .btn, 14 | .fileupload-buttonbar .toggle { 15 | margin-bottom: 5px; 16 | } 17 | .progress-animated .progress-bar, 18 | .progress-animated .bar { 19 | background: url("../img/progressbar.gif") !important; 20 | filter: none; 21 | } 22 | .fileupload-process { 23 | float: right; 24 | display: none; 25 | } 26 | .fileupload-processing .fileupload-process, 27 | .files .processing .preview { 28 | display: block; 29 | width: 32px; 30 | height: 32px; 31 | background: url("../img/loading.gif") center no-repeat; 32 | background-size: contain; 33 | } 34 | .files audio, 35 | .files video { 36 | max-width: 300px; 37 | } 38 | 39 | @media (max-width: 767px) { 40 | .fileupload-buttonbar .toggle, 41 | .files .toggle, 42 | .files .btn span { 43 | display: none; 44 | } 45 | .files .name { 46 | width: 80px; 47 | word-wrap: break-word; 48 | } 49 | .files audio, 50 | .files video { 51 | max-width: 80px; 52 | } 53 | .files img, 54 | .files canvas { 55 | max-width: 100%; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/css/jquery.fileupload.css: -------------------------------------------------------------------------------- 1 | @charset "UTF-8"; 2 | /* 3 | * jQuery File Upload Plugin CSS 1.3.0 4 | * https://github.com/blueimp/jQuery-File-Upload 5 | * 6 | * Copyright 2013, Sebastian Tschan 7 | * https://blueimp.net 8 | * 9 | * Licensed under the MIT license: 10 | * http://www.opensource.org/licenses/MIT 11 | */ 12 | 13 | .fileinput-button { 14 | position: relative; 15 | overflow: hidden; 16 | } 17 | .fileinput-button input { 18 | position: absolute; 19 | top: 0; 20 | right: 0; 21 | margin: 0; 22 | opacity: 0; 23 | -ms-filter: 'alpha(opacity=0)'; 24 | font-size: 200px; 25 | direction: ltr; 26 | cursor: pointer; 27 | } 28 | 29 | /* Fixes for IE < 8 */ 30 | @media screen\9 { 31 | .fileinput-button input { 32 | filter: alpha(opacity=0); 33 | font-size: 100%; 34 | height: 100%; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/css/pivot.min.css: -------------------------------------------------------------------------------- 1 | table.pvtTable{font-family:arial;font-size:8pt;text-align:left;border-collapse:collapse}table.pvtTable tr th{background-color:#e6EEEE;border:1px solid #CDCDCD;font-size:8pt;padding:5px}table.pvtTable .pvtColLabel{text-align:center}table.pvtTable .pvtTotalLabel{text-align:right}table.pvtTable tr td{color:#3D3D3D;padding:5px;background-color:#FFF;border:1px solid #CDCDCD;vertical-align:top;text-align:right}.pvtGrandTotal,.pvtTotal{font-weight:700}.pvtVals{text-align:center}.pvtAggregator{margin-bottom:5px}.pvtAxisContainer,.pvtVals{border:1px solid gray;background:#EEE;padding:5px;min-width:20px;min-height:20px}.pvtAxisContainer li{padding:8px 6px;list-style-type:none;cursor:move}.pvtAxisContainer li.pvtPlaceholder{-webkit-border-radius:5px;padding:3px 15px;-moz-border-radius:5px;border-radius:5px;border:1px dashed #aaa}.pvtAxisContainer li span.pvtAttr{background:#F3F3F3;border:1px solid #DEDEDE;padding:2px 5px;white-space:nowrap;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.pvtTriangle{cursor:pointer;color:grey}.pvtHorizList li{display:inline}.pvtVertList{vertical-align:top}.pvtFilteredAttribute{font-style:italic}.pvtFilterBox{z-index:100;width:280px;border:1px solid gray;background-color:#fff;position:absolute;padding:20px;text-align:center}.pvtFilterBox h4{margin:0}.pvtCheckContainer{text-align:left;overflow:scroll;width:100%;max-height:200px}.pvtCheckContainer p{margin:5px} -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/webapp/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/webapp/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/webapp/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/webapp/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/webapp/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/webapp/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/webapp/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/images/back_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/webapp/images/back_disabled.png -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/images/back_enabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/webapp/images/back_enabled.png -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/images/back_enabled_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/webapp/images/back_enabled_hover.png -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/webapp/images/favicon.ico -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/images/forward_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/webapp/images/forward_disabled.png -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/images/forward_enabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/webapp/images/forward_enabled.png -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/images/forward_enabled_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/webapp/images/forward_enabled_hover.png -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/images/jena-logo-notext-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/webapp/images/jena-logo-notext-small.png -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/images/sort_asc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/webapp/images/sort_asc.png -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/images/sort_asc_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/webapp/images/sort_asc_disabled.png -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/images/sort_both.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/webapp/images/sort_both.png -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/images/sort_desc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/webapp/images/sort_desc.png -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/images/sort_desc_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/webapp/images/sort_desc_disabled.png -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/images/wait30.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/webapp/images/wait30.gif -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/js/app/controllers/.svnkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/webapp/js/app/controllers/.svnkeep -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/js/app/controllers/index-controller.js: -------------------------------------------------------------------------------- 1 | /** Controller for the main index.html page */ 2 | define( 3 | function( require ) { 4 | var Marionette = require( "marionette" ), 5 | Backbone = require( "backbone" ), 6 | _ = require( "underscore" ), 7 | fui = require( "app/fui" ), 8 | sprintf = require( "sprintf" ), 9 | DatasetSelectionListView = require( "app/views/dataset-selection-list" ); 10 | 11 | var IndexController = function() { 12 | this.initEvents(); 13 | }; 14 | 15 | // add the behaviours defined on the controller 16 | _.extend( IndexController.prototype, { 17 | 18 | initEvents: function() { 19 | _.bindAll( this, "onServerModelReady" ); 20 | fui.vent.on( "models.fuseki-server.ready", this.onServerModelReady ); 21 | }, 22 | 23 | onServerModelReady: function() { 24 | new DatasetSelectionListView( {model: fui.models.fusekiServer} ).render(); 25 | this.displayVersion(); 26 | }, 27 | 28 | /** Display the fuseki software version */ 29 | displayVersion: function() { 30 | var sd = fui.models.fusekiServer.get( "serverDescription" ); 31 | var version = sd.version; 32 | var uptime = sd.uptime; 33 | var s = uptime % 60; 34 | var m = Math.floor( (uptime / 60) % 60 ); 35 | var h = Math.floor( (uptime / (60 * 60)) % 24 ); 36 | var d = Math.floor( (uptime / (60 * 60 * 24)) ); 37 | 38 | var status = sprintf( "Version %s. Uptime: %s %s %dm %02ds", 39 | version, 40 | (d > 0 ? d + "d" : ""), 41 | (h > 0 ? h + "h" : ""), 42 | m, s ); 43 | $('.host-details').html( status ); 44 | } 45 | 46 | } ); 47 | 48 | return IndexController; 49 | } 50 | ); 51 | -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/js/app/controllers/manage-controller.js: -------------------------------------------------------------------------------- 1 | /** Controller for the admin/data-management.html page */ 2 | define( 3 | function( require ) { 4 | var Marionette = require( "marionette" ), 5 | Backbone = require( "backbone" ), 6 | _ = require( "underscore" ), 7 | fui = require( "app/fui" ), 8 | TabbedViewManagerView = require( "app/views/tabbed-view-manager" ), 9 | DatasetSimpleCreateView = require( "app/views/dataset-simple-create" ), 10 | DatasetManagementView = require( "app/views/dataset-management" ); 11 | 12 | var ManageController = function() { 13 | this.initEvents(); 14 | }; 15 | 16 | _.extend( ManageController.prototype, { 17 | 18 | initEvents: function() { 19 | _.bindAll( this, "onServerModelReady" ); 20 | fui.vent.on( "models.fuseki-server.ready", this.onServerModelReady ); 21 | }, 22 | 23 | /** When the fuseki server is ready, we can list the initial datasets */ 24 | onServerModelReady: function( event ) { 25 | fui.views.datasetManagement = new DatasetManagementView( {model: fui.models.fusekiServer} ); 26 | fui.views.datasetManagement.render(); 27 | 28 | fui.views.tabbedViewManagerView = new TabbedViewManagerView(); 29 | fui.views.tabbedViewManagerView.render(); 30 | 31 | fui.views.datasetSimpleCreate = new DatasetSimpleCreateView(); 32 | fui.views.datasetSimpleCreate.render(); 33 | } 34 | 35 | } ); 36 | 37 | return ManageController; 38 | } 39 | ); 40 | -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/js/app/controllers/upload-controller.js: -------------------------------------------------------------------------------- 1 | /** Controller for the file uploader component */ 2 | 3 | define( 4 | function( require ) { 5 | var Marionette = require( "marionette" ), 6 | Backbone = require( "backbone" ), 7 | _ = require( "underscore" ), 8 | sprintf = require("sprintf"), 9 | pageUtils = require( "app/util/page-utils" ), 10 | fui = require( "app/fui" ), 11 | FileUploadView = require( "app/views/file-upload" ); 12 | 13 | var UploadController = function() { 14 | this.initialize(); 15 | }; 16 | 17 | _.extend( UploadController.prototype, { 18 | 19 | /** Initialize the controler */ 20 | initialize: function() { 21 | if (fui.models.fusekiServer && fui.models.fusekiServer.get( "ready" )) { 22 | this.onServerModelReady(); 23 | } 24 | else { 25 | _.bindAll( this, "onServerModelReady" ); 26 | fui.vent.on( "models.fuseki-server.ready", this.onServerModelReady ); 27 | } 28 | 29 | }, 30 | 31 | /** When the fuseki server is ready, we can set up the initial view */ 32 | onServerModelReady: function( event ) { 33 | var fusekiServer = fui.models.fusekiServer; 34 | 35 | fui.views.fileUploadView = new FileUploadView(); 36 | fui.views.fileUploadView.render(); 37 | }, 38 | } ); 39 | 40 | return UploadController; 41 | } 42 | ); 43 | -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/js/app/controllers/validation-controller.js: -------------------------------------------------------------------------------- 1 | /** Controller for the main index.html page */ 2 | define( 3 | function( require ) { 4 | var Marionette = require( "marionette" ), 5 | Backbone = require( "backbone" ), 6 | _ = require( "underscore" ), 7 | fui = require( "app/fui" ), 8 | ValidationOptions = require( "app/views/validation-options" ), 9 | ValidationService = require( "app/services/validation-service" ); 10 | 11 | var ValidationController = function() { 12 | this.initServices(); 13 | this.initEvents(); 14 | }; 15 | 16 | // add the behaviours defined on the controller 17 | _.extend( ValidationController.prototype, { 18 | initEvents: function() { 19 | fui.vent.on( "models.validation-options.ready", this.onValidationOptionsModelReady ); 20 | $(".validation").on( "click", "a.perform-validation", function( event ) { 21 | fui.services.validation.performValidation( fui.views.validationOptions.model ); 22 | } ); 23 | }, 24 | 25 | onValidationOptionsModelReady: function( e ) { 26 | fui.views.validationOptions = new ValidationOptions( {model: fui.models.validationOptions} ); 27 | }, 28 | 29 | initServices: function() { 30 | fui.services.validation = new ValidationService( "#query-edit-cm", "#validation-output-cm" ); 31 | fui.services.validation.init(); 32 | } 33 | 34 | } ); 35 | 36 | return ValidationController; 37 | } 38 | ); 39 | -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/js/app/fui.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Top-level application code module for Fuseki UI 3 | */ 4 | 5 | define( ['require', 'backbone', 'marionette'], 6 | function( require, Backbone, Marionette ) { 7 | // define the application object, and add it to the global namespace 8 | var fui = new Marionette.Application(); 9 | 10 | // define some Marionette modules, because they have a lifecycle component 11 | // see https://github.com/marionettejs/backbone.marionette/wiki/AMD-Modules-vs-Marionette%27s-Modules 12 | fui.module( "models" ); 13 | fui.module( "views" ); 14 | fui.module( "layouts" ); 15 | fui.module( "controllers" ); 16 | fui.module( "services" ); 17 | 18 | // define top-level regions where our layouts will go 19 | fui.addRegions({ 20 | }); 21 | 22 | fui.on('initialize:before', function( options ) { 23 | }); 24 | 25 | fui.on('initialize:after', function( options ) { 26 | // Backbone.history.start(); 27 | this.initialized = true; 28 | }); 29 | 30 | 31 | return fui; 32 | } 33 | ); 34 | -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/js/app/layouts/.svnkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/webapp/js/app/layouts/.svnkeep -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/js/app/main.dataset.js: -------------------------------------------------------------------------------- 1 | /** RequireJS dependency configuration for dataset.html page */ 2 | 3 | define( ['require', '../common-config'], 4 | function( require ) { 5 | require( 6 | ['underscore', 'jquery', 'backbone', 'marionette', 'app/fui', 'app/controllers/dataset-controller', 7 | 'sprintf', 8 | 'bootstrap-select.min', 9 | 'app/controllers/query-controller', 10 | 'app/controllers/upload-controller', 11 | 'app/models/fuseki-server', 12 | 'app/models/dataset', 13 | 'app/views/dataset-selector', 14 | 'app/views/tabbed-view-manager', 15 | 'app/services/ping-service', 16 | 'jquery.xdomainrequest', 17 | 'jquery.form', 18 | 'jquery.fileupload' 19 | ], 20 | function( _, $, Backbone, Marionette, fui, DatasetController ) { 21 | var options = { }; 22 | 23 | // initialise the backbone application 24 | fui.controllers.datasetController = new DatasetController(); 25 | fui.start( options ); 26 | 27 | // additional services 28 | require( 'app/services/ping-service' ).start(); 29 | }); 30 | } 31 | ); 32 | -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/js/app/main.index.js: -------------------------------------------------------------------------------- 1 | 2 | define( ['require', '../common-config'], 3 | function( require ) { 4 | require( 5 | ['underscore', 'jquery', 'backbone', 'marionette', 6 | 'app/fui', 'app/controllers/index-controller', 7 | 'sprintf', 'bootstrap', 8 | 'app/models/fuseki-server', 9 | 'app/models/dataset', 10 | 'app/views/dataset-selection-list', 11 | 'app/services/ping-service' 12 | ], 13 | function( _, $, Backbone, Marionette, fui, IndexController ) { 14 | var options = { }; 15 | 16 | // initialise the backbone application 17 | fui.controllers.indexController = new IndexController(); 18 | fui.start( options ); 19 | 20 | // additional services 21 | require( 'app/services/ping-service' ).start(); 22 | }); 23 | } 24 | ); -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/js/app/main.manage.js: -------------------------------------------------------------------------------- 1 | 2 | define( ['require', '../common-config'], 3 | function( require ) { 4 | require( 5 | ['underscore', 'jquery', 'backbone', 'marionette', 6 | 'app/fui', 'app/controllers/manage-controller', 7 | 'sprintf', 'bootstrap', 8 | 'app/models/fuseki-server', 9 | 'app/models/dataset', 10 | 'app/models/task', 11 | 'app/views/dataset-management', 12 | 'app/services/ping-service', 13 | 'jquery.xdomainrequest' 14 | ], 15 | function( _, $, Backbone, Marionette, fui, ManageController ) { 16 | 17 | var options = { } ; 18 | 19 | // initialise the backbone application 20 | fui.controllers.manageController = new ManageController(); 21 | fui.start( options ); 22 | 23 | // additional services 24 | require( 'app/services/ping-service' ).start(); 25 | }); 26 | } 27 | ); 28 | -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/js/app/main.validation.js: -------------------------------------------------------------------------------- 1 | 2 | define( ['require', '../common-config'], 3 | function( require ) { 4 | require( 5 | ['underscore', 'jquery', 'backbone', 'marionette', 6 | 'app/fui', 'app/controllers/validation-controller', 7 | 'sprintf', 'bootstrap', 8 | 'app/models/validation-options', 9 | 'app/services/ping-service', 10 | 'app/services/validation-service', 11 | 'jquery.xdomainrequest' 12 | ], 13 | function( _, $, Backbone, Marionette, fui, ValidationController ) { 14 | var options = { } ; 15 | 16 | // initialise the backbone application 17 | fui.controllers.validationController = new ValidationController(); 18 | fui.start( options ); 19 | 20 | // additional services 21 | // require( 'services/ping-service' ).start(); TODO restore 22 | }); 23 | } 24 | ); -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/js/app/qonsole-config.js: -------------------------------------------------------------------------------- 1 | /** Standalone configuration for qonsole on index page */ 2 | 3 | define( [], function() { 4 | return { 5 | prefixes: { 6 | "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", 7 | "rdfs": "http://www.w3.org/2000/01/rdf-schema#", 8 | "owl": "http://www.w3.org/2002/07/owl#", 9 | "xsd": "http://www.w3.org/2001/XMLSchema#" 10 | }, 11 | queries: [ 12 | { "name": "Selection of triples", 13 | "query": "SELECT ?subject ?predicate ?object\nWHERE {\n" + 14 | " ?subject ?predicate ?object\n}\n" + 15 | "LIMIT 25" 16 | }, 17 | { "name": "Selection of classes", 18 | "query": "SELECT DISTINCT ?class ?label ?description\nWHERE {\n" + 19 | " ?class a owl:Class.\n" + 20 | " OPTIONAL { ?class rdfs:label ?label}\n" + 21 | " OPTIONAL { ?class rdfs:comment ?description}\n}\n" + 22 | "LIMIT 25", 23 | "prefixes": ["owl", "rdfs"] 24 | } 25 | ] 26 | }; 27 | } ); 28 | -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/js/app/routers/.svnkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/webapp/js/app/routers/.svnkeep -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/js/app/services/ping-service.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The ping service checks the status of the attached server and sets the light in the 3 | * control bar accordingly. 4 | */ 5 | define( ['jquery', 'underscore', 'sprintf'], 6 | function( $, _, sprintf ) { 7 | 8 | var PING_URL = "$/ping" 9 | var DEFAULT_PING_TIME = 500000; // TODO slowed down during debugging phase 10 | var _startTime = 0; 11 | 12 | var onBeforeSend = function() { 13 | _startTime = new Date().getTime(); 14 | }; 15 | 16 | var duration = function() { 17 | return new Date().getTime() - _startTime; 18 | }; 19 | 20 | var onPingSuccess = function( ) { 21 | setPingStatus( "server-up", sprintf( "Last ping returned OK in %dms", duration() ) ); 22 | }; 23 | 24 | var onPingFail = function( jqXHR, msg, errorThrown ) { 25 | setPingStatus( "server-down", sprintf( "Last ping returned '%s' in %dms", errorThrown || msg, duration() ) ); 26 | }; 27 | 28 | var setPingStatus = function( lampClass, statusText ) { 29 | $( "a#server-status-light span").removeClass() 30 | .addClass( lampClass ) 31 | .attr( "title", statusText ); 32 | }; 33 | 34 | /** Return a cache-defeating ping URL */ 35 | var ping_url = function() { 36 | return PING_URL + "?_=" + Math.random(); 37 | }; 38 | 39 | var start = function( period ) { 40 | ping( period || DEFAULT_PING_TIME ); 41 | }; 42 | 43 | var ping = function( period ) { 44 | onBeforeSend(); 45 | $.get( ping_url() ).done( onPingSuccess ) 46 | .fail( onPingFail ); 47 | setTimeout( function() {ping( period );}, period ); 48 | }; 49 | 50 | return { 51 | start: start 52 | } 53 | } 54 | ); -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/js/app/templates/dataset-edit.tpl: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 5 | 6 | 7 |

Available graphs

8 | 9 | <% if (countPerformed()) { %> 10 | 19 | <% } else { %> 20 |

Click to list current graphs

21 | <% } %> 22 |
23 |
24 | 25 |
26 |
27 |
28 |
29 |
30 |
graph:
31 | 32 |
33 |
34 |
35 |
36 | 37 |
38 |
39 |
40 |
41 |
42 | 43 |
44 |
45 | 46 |
47 |
48 | 49 |
50 |
51 | 52 | 53 | 54 | 55 |
56 |
57 |
58 |
59 | -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/js/app/templates/dataset-info.tpl: -------------------------------------------------------------------------------- 1 |

Available services

2 | 3 |
4 | <% _.each( servicesDescription(), function( serviceDescription ) { %> 5 |
6 | <%= serviceDescription.label %>: 7 |
8 |
9 | <%= serviceDescription.url %> 10 |
11 | <% } ); %> 12 |
13 | 14 |

Statistics

15 |
16 | 17 |

Dataset size

18 |

19 | Note this may be slow and impose a significant load on large datasets: 20 | 21 |

22 | <% if (countPerformed()) { %> 23 |
24 |
graph name:
triples:
25 | <% _.each( counts(), function( n, g ) { %> 26 |
27 | <%= g %> 28 |
29 |
30 |
<%= n %>
31 |
32 | <% } ); %> 33 |
34 | 35 | <% } %> 36 | 37 |

Ongoing operations

38 | 39 |

TBD. Will list any long-lasting operations that are ongoing or recently completed, 40 | e.g. backups.

41 | -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/js/app/templates/dataset-selection-list.tpl: -------------------------------------------------------------------------------- 1 |
2 | <% if (datasets.length > 0) { %> 3 | 4 | 5 | <% _.each( datasets, function( ds ) { %> 6 | 7 | 10 | 15 | 16 | <% }) %> 17 | 18 |
dataset nameactions
8 | <%= ds.name() %> 9 | 11 | query 12 | add data 13 | info 14 |
19 | <% } else { %> 20 |

There are no datasets on this server yet. Add one.

21 | <% } %> 22 |
23 | -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/js/app/templates/dataset-selector.tpl: -------------------------------------------------------------------------------- 1 |
2 | <% if (datasets.length == 0) { %> 3 | <% } else { %> 4 | 14 | <% } %> 15 |
16 | -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/js/app/templates/dataset-stats.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | <% _.each( headings, function( h ) { %> 4 | 5 | <% } ); %> 6 | 7 | <% _.each( rows, function( row ) { %> 8 | 9 | <% _.each( row, function( cell ) { %> 10 | 11 | <% } ); %> 12 | 13 | <% } ) %> 14 |
<%= h %>
<%= cell %>
-------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/js/app/templates/file-upload.tpl: -------------------------------------------------------------------------------- 1 |
2 |

Upload files

3 |

Load data into the default graph of the currently selected dataset, 4 | or the given named graph. 5 | You may upload any RDF format, such as Turtle, RDF/XML or TRiG. 6 |

7 | 8 |
9 |
10 | 11 | 12 |

13 | 14 |

15 |
16 |
17 |
18 | 19 |
20 |
21 |
22 | 23 |
24 | 25 | 26 | 27 | select files... 28 | 29 | 30 | 34 | 35 |
36 |
37 | 38 |
39 |
40 |
    41 |
42 |
43 |
44 |
45 |
46 |
-------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/js/app/templates/uploadable-file.tpl: -------------------------------------------------------------------------------- 1 |
2 |
3 | <%= file.name %> 4 |
5 |
6 | 7 | <%= file.readableFileSize %> 8 | 9 |
10 |
11 | 12 | 13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | 23 |
24 | -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/js/app/util/page-utils.js: -------------------------------------------------------------------------------- 1 | /** Utilities for managing HTML pages */ 2 | 3 | define( 4 | function( require ) { 5 | "use strict"; 6 | 7 | var _ = require( "underscore" ); 8 | 9 | /** Return true if a given query parameter is defined, otherwise null */ 10 | var hasQueryParam = function( param ) { 11 | return !!queryParam( param ); 12 | }; 13 | 14 | /** Return the value of a query parameter, or null */ 15 | var queryParam = function( param ) { 16 | var p = param && queryParams()[param]; 17 | return p ? p : null; 18 | }; 19 | 20 | /** Return the current query params as a map */ 21 | var queryParams = function() { 22 | return _.chain( document.location.search.slice(1).split('&') ) 23 | .invoke('split', '=') 24 | .object() 25 | .value(); 26 | }; 27 | 28 | return { 29 | hasQueryParam: hasQueryParam, 30 | queryParam: queryParam 31 | }; 32 | } 33 | ); -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/js/app/views/.svnkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/Fuseki/webapp/js/app/views/.svnkeep -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/js/app/views/dataset-info.js: -------------------------------------------------------------------------------- 1 | /** Component for showing detailed information about a dataset */ 2 | 3 | define( 4 | function( require ) { 5 | var Backbone = require( "backbone" ), 6 | _ = require( "underscore" ), 7 | fui = require( "app/fui" ), 8 | DatasetInfoTpl = require( "plugins/text!app/templates/dataset-info.tpl" ), 9 | DatasetStatsView = require( "app/views/dataset-stats" ), 10 | DatasetStatsModel = require( "app/models/dataset-stats" ); 11 | 12 | var DatasetInfo = Backbone.Marionette.ItemView.extend( { 13 | 14 | initialize: function() { 15 | _.bindAll( this, "onModelChanged", "onCountGraphs" ); 16 | 17 | this.showStatistics( true ); 18 | this.model.on( "change", this.onModelChanged ); 19 | }, 20 | 21 | template: _.template( DatasetInfoTpl ), 22 | 23 | ui: { 24 | stats: "#statistics", 25 | count: ".count-graphs" 26 | }, 27 | 28 | el: "#info .with-dataset", 29 | 30 | events: { 31 | "click .count-graphs": "onCountGraphs" 32 | }, 33 | 34 | templateHelpers: { 35 | }, 36 | 37 | serializeData: function() { 38 | return this.model; 39 | }, 40 | 41 | /** Alias for the model */ 42 | dataset: function() { 43 | return this.model; 44 | }, 45 | 46 | // event handlers 47 | 48 | onModelChanged: function() { 49 | if (!this.model.counting) { 50 | this.render(); 51 | this.showStatistics( false ); 52 | } 53 | }, 54 | 55 | onCountGraphs: function( e ) { 56 | e.preventDefault(); 57 | this.model.count(); 58 | }, 59 | 60 | showStatistics: function( keep ) { 61 | var self = this; 62 | 63 | this.model 64 | .statistics( keep ) 65 | .done( function( data ) { 66 | var statsModel = new DatasetStatsModel( self.dataset(), data ); 67 | new DatasetStatsView( {model: statsModel} ).render(); 68 | } ); 69 | } 70 | 71 | }); 72 | 73 | 74 | return DatasetInfo; 75 | } 76 | ); 77 | -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/js/app/views/dataset-selection-list.js: -------------------------------------------------------------------------------- 1 | /** 2 | * This view presents a list of the available datasets for the user to interact 3 | * with. 4 | */ 5 | 6 | define( 7 | function( require ) { 8 | var Backbone = require( "backbone" ), 9 | _ = require( "underscore" ), 10 | fui = require( "app/fui" ), 11 | datasetSelectionListTemplate = require( "plugins/text!app/templates/dataset-selection-list.tpl" ); 12 | 13 | var DatasetSelectionListView = Backbone.Marionette.ItemView.extend( { 14 | initialize: function(){ 15 | // _.bindAll(this, "onFilter", "onModelChange"); 16 | this.listenTo( this.model, "change", this.onModelChange, this ); 17 | }, 18 | 19 | template: _.template( datasetSelectionListTemplate ), 20 | 21 | el: "#dataset-selection-list", 22 | 23 | ui: { 24 | }, 25 | 26 | events: { 27 | // "change #independent-variable-selection": "selectVariable", 28 | // "click a.action.filter": "onFilter" 29 | }, 30 | 31 | templateHelpers: { 32 | }, 33 | 34 | // /** Update the model when the user changes the selection */ 35 | // selectVariable: function( event ) { 36 | // this.model.set( "independentVarSelection", this.ui.variableSelection.val() ); 37 | // }, 38 | // 39 | // /** User wants to open the filter dialog */ 40 | // onFilter: function( event ) { 41 | // var varModel = bgViz.models.variablesConfig.independentVar(); 42 | // var rangeType = varModel.component.range().rangeType(); 43 | // var viewName = rangeType.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(); 44 | // 45 | // bgViz.layouts.filterDialog.showFilter( viewName, varModel ); 46 | // }, 47 | 48 | /** If the model changes, update the summary */ 49 | onModelChange: function( event ) { 50 | // this.ui.summary.html( this.model.independentVar().component.range().summarise() ); 51 | } 52 | 53 | }); 54 | 55 | 56 | return DatasetSelectionListView; 57 | } 58 | ); 59 | -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/js/app/views/dataset-stats.js: -------------------------------------------------------------------------------- 1 | define( 2 | function( require ) { 3 | var Backbone = require( "backbone" ), 4 | _ = require( "underscore" ), 5 | fui = require( "app/fui" ), 6 | datasetStatsViewTpl = require( "plugins/text!app/templates/dataset-stats.tpl" ); 7 | 8 | var DatasetStatsView = Backbone.Marionette.ItemView.extend( { 9 | initialize: function() { 10 | _.bindAll( this, "onShowTab" ); 11 | 12 | fui.vent.on( "shown.bs.tab", this.onShowTab ); 13 | }, 14 | 15 | template: _.template( datasetStatsViewTpl ), 16 | 17 | ui: { 18 | }, 19 | 20 | el: "#statistics", 21 | 22 | modelEvents: { 23 | 'change': "modelChanged" 24 | }, 25 | 26 | modelChanged: function() { 27 | this.render(); 28 | }, 29 | 30 | onShowTab: function( tab ) { 31 | if (tab.attr("href") === "#info") { 32 | this.model.refresh(); 33 | } 34 | } 35 | 36 | }); 37 | 38 | 39 | return DatasetStatsView; 40 | } 41 | ); 42 | -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/js/app/views/datasets-dropdown-list.js: -------------------------------------------------------------------------------- 1 | define( 2 | function( require ) { 3 | var Backbone = require( "backbone" ), 4 | _ = require( "underscore" ), 5 | fui = require( "app/fui" ); 6 | 7 | var DatasetDropDownListView = Backbone.Marionette.ItemView.extend( { 8 | initialize: function(){ 9 | }, 10 | 11 | template:"", 12 | 13 | el: "ul.dropdown-menu.dataset-list", 14 | 15 | ui: { 16 | }, 17 | 18 | events: { 19 | }, 20 | 21 | render: function() { 22 | var e = $(this.el).empty(); 23 | _.each( this.model, function( ds ) { 24 | e.append( sprintf( "
  • %s
  • ", ds.name(), ds.name() )); 25 | } ); 26 | }, 27 | 28 | /** Change the currently selected dataset name. If required, notify other units via an event */ 29 | setCurrentDatasetName: function( dsName, notify ) { 30 | if (dsName) { 31 | $(".current-dataset").text( dsName ); 32 | } 33 | 34 | if (notify) { 35 | fui.vent.trigger( "views.datasets-dropdown-list.dataset-changed", dsName ) 36 | } 37 | } 38 | }); 39 | 40 | 41 | return DatasetDropDownListView; 42 | } 43 | ); 44 | -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/js/app/views/tabbed-view-manager.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Reusable component that encapsulates managing a collection of sub-views as 3 | * tabs, with the active tab being selected via the URL query param `tab`. 4 | **/ 5 | 6 | define( 7 | function( require ) { 8 | "use strict"; 9 | 10 | var Marionette = require( "marionette" ), 11 | Backbone = require( "backbone" ), 12 | _ = require( "underscore" ), 13 | fui = require( "app/fui" ), 14 | sprintf = require( "sprintf" ), 15 | PageUtils = require( "app/util/page-utils" ); 16 | 17 | var TabbedViewManagerView = Backbone.View.extend( { 18 | 19 | initialize: function(){ 20 | this._tab = PageUtils.queryParam( "tab" ); 21 | this._firstRender = false; 22 | }, 23 | 24 | render: function() { 25 | if (!this._firstRender) { 26 | this._firstRender = true; 27 | this.activateCurrentTab(); 28 | 29 | $(".nav-tabs").on( "shown.bs.tab", function( e ) { 30 | fui.vent.trigger( "shown.bs.tab", $(e.target) ); 31 | } ); 32 | } 33 | }, 34 | 35 | /** 36 | * Make the tab named as the current tab active. If no named tab, make 37 | * the first tab active by default. 38 | */ 39 | activateCurrentTab: function() { 40 | var tabs = $(".nav-tabs"); 41 | var tab = tabs.children().first(); 42 | 43 | if (this._tab) { 44 | tab = tabs.find( sprintf( "a[href=#%s]", this._tab ) ) 45 | .parent(); 46 | } 47 | 48 | if (!tab.is(".active")) { 49 | tabs.children( "li" ).removeClass( "active" ); 50 | tabs.parent().children(".tab-pane").removeClass("active"); 51 | 52 | tab.addClass( "active" ); 53 | $( tab.children( "a" ).attr( "href" ) ).addClass("active"); 54 | } 55 | } 56 | 57 | 58 | }); 59 | 60 | 61 | return TabbedViewManagerView; 62 | } 63 | ); 64 | -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/js/app/views/uploadable-file.js: -------------------------------------------------------------------------------- 1 | /** 2 | * This view encapsulates a single uploadable file 3 | */ 4 | 5 | define( 6 | function( require ) { 7 | var Backbone = require( "backbone" ), 8 | _ = require( "underscore" ), 9 | fui = require( "app/fui" ), 10 | uploadableFileTemplate = require( "plugins/text!app/templates/uploadable-file.tpl" ); 11 | 12 | var UploadableFileView = Backbone.Marionette.ItemView.extend( { 13 | initialize: function(){ 14 | }, 15 | 16 | tagName: "li", 17 | 18 | template: _.template( uploadableFileTemplate ), 19 | 20 | events: { 21 | "click .action-remove-upload": "onActionRemoveUpload", 22 | "click .action-upload-file": "onActionUploadFile" 23 | }, 24 | 25 | onActionRemoveUpload: function( e ) { 26 | e.preventDefault(); 27 | fui.vent.trigger( "upload.remove", this.model ); 28 | }, 29 | 30 | onActionUploadFile: function( e ) { 31 | e.preventDefault(); 32 | fui.vent.trigger( "upload.perform", this.model ); 33 | } 34 | 35 | }); 36 | 37 | return UploadableFileView; 38 | } 39 | ); 40 | -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/js/app/views/validation-options.js: -------------------------------------------------------------------------------- 1 | define( 2 | function( require ) { 3 | var Backbone = require( "backbone" ), 4 | _ = require( "underscore" ), 5 | fui = require( "app/fui" ); 6 | 7 | var ValidationOptions = Backbone.Marionette.ItemView.extend( { 8 | initialize: function(){ 9 | _.bindAll( this, "onValidateAs", "onOutputFormat", "onModelChange" ); 10 | this.listenTo( this.model, "change", this.onModelChange, this ); 11 | }, 12 | 13 | el: ".validation", 14 | 15 | events: { 16 | "click .validate-as-options a": "onValidateAs", 17 | "click .output-format-options a": "onOutputFormat", 18 | }, 19 | 20 | templateHelpers: { 21 | }, 22 | 23 | onValidateAs: function( e ) { 24 | e.preventDefault(); 25 | var elem = $(e.currentTarget); 26 | this.model.setValidateAs( elem.data( "validate-as" ) ); 27 | this.$el.find(".validate-as-options a").removeClass("active"); 28 | elem.addClass("active"); 29 | 30 | if (this.model.validateAsQuery()) { 31 | this.$el.find(".output-format-options").removeClass("hidden"); 32 | } 33 | else { 34 | this.$el.find(".output-format-options").addClass("hidden"); 35 | } 36 | }, 37 | 38 | onOutputFormat: function( e ) { 39 | e.preventDefault(); 40 | var elem = $(e.currentTarget); 41 | this.model.setOutputFormat( elem.data( "output-format" ) ); 42 | this.$el.find(".output-format-options a").removeClass("active"); 43 | elem.addClass("active"); 44 | }, 45 | 46 | onModelChange: function( event ) { 47 | } 48 | 49 | }); 50 | 51 | 52 | return ValidationOptions; 53 | } 54 | ); 55 | -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/js/lib/addon/fold/comment-fold.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: http://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.registerGlobalHelper("fold", "comment", function(mode) { 15 | return mode.blockCommentStart && mode.blockCommentEnd; 16 | }, function(cm, start) { 17 | var mode = cm.getModeAt(start), startToken = mode.blockCommentStart, endToken = mode.blockCommentEnd; 18 | if (!startToken || !endToken) return; 19 | var line = start.line, lineText = cm.getLine(line); 20 | 21 | var startCh; 22 | for (var at = start.ch, pass = 0;;) { 23 | var found = at <= 0 ? -1 : lineText.lastIndexOf(startToken, at - 1); 24 | if (found == -1) { 25 | if (pass == 1) return; 26 | pass = 1; 27 | at = lineText.length; 28 | continue; 29 | } 30 | if (pass == 1 && found < start.ch) return; 31 | if (/comment/.test(cm.getTokenTypeAt(CodeMirror.Pos(line, found + 1)))) { 32 | startCh = found + startToken.length; 33 | break; 34 | } 35 | at = found - 1; 36 | } 37 | 38 | var depth = 1, lastLine = cm.lastLine(), end, endCh; 39 | outer: for (var i = line; i <= lastLine; ++i) { 40 | var text = cm.getLine(i), pos = i == line ? startCh : 0; 41 | for (;;) { 42 | var nextOpen = text.indexOf(startToken, pos), nextClose = text.indexOf(endToken, pos); 43 | if (nextOpen < 0) nextOpen = text.length; 44 | if (nextClose < 0) nextClose = text.length; 45 | pos = Math.min(nextOpen, nextClose); 46 | if (pos == text.length) break; 47 | if (pos == nextOpen) ++depth; 48 | else if (!--depth) { end = i; endCh = pos; break outer; } 49 | ++pos; 50 | } 51 | } 52 | if (end == null || line == end && endCh == startCh) return; 53 | return {from: CodeMirror.Pos(line, startCh), 54 | to: CodeMirror.Pos(end, endCh)}; 55 | }); 56 | 57 | }); 58 | -------------------------------------------------------------------------------- /KGServer/Fuseki/webapp/js/lib/html5shiv.js: -------------------------------------------------------------------------------- 1 | /* 2 | HTML5 Shiv v3.6.2pre | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed 3 | */ 4 | (function(l,f){function m(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function i(a){var b=n[a[o]];b||(b={},h++,a[o]=h,n[h]=b);return b}function p(a,b,c){b||(b=f);if(g)return b.createElement(a);c||(c=i(b));b=c.cache[a]?c.cache[a].cloneNode():r.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);return b.canHaveChildren&&!s.test(a)?c.frag.appendChild(b):b}function t(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag(); 5 | a.createElement=function(c){return!e.shivMethods?b.createElem(c):p(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/\w+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(e,b.frag)}function q(a){a||(a=f);var b=i(a);if(e.shivCSS&&!j&&!b.hasCSS){var c,d=a;c=d.createElement("p");d=d.getElementsByTagName("head")[0]||d.documentElement;c.innerHTML="x"; 6 | c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode|| 7 | "undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",version:"3.6.2pre",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f);if(g)return a.createDocumentFragment(); 8 | for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;d . 4 | @prefix fuseki: . 5 | @prefix rdf: . 6 | 7 | @prefix rdfs: . 8 | @prefix tdb: . 9 | @prefix ja: . 10 | 11 | ## --------------------------------------------------------------- 12 | ## Updatable in-memory dataset. 13 | 14 | <#service1> rdf:type fuseki:Service ; 15 | # URI of the dataset -- http://host:port/ds 16 | fuseki:name "test-service" ; 17 | fuseki:serviceQuery "sparql" ; 18 | fuseki:serviceQuery "query" ; 19 | fuseki:serviceUpdate "update" ; 20 | fuseki:serviceUpload "upload" ; 21 | fuseki:serviceReadWriteGraphStore "data" ; 22 | fuseki:serviceReadGraphStore "get" ; 23 | fuseki:dataset <#dataset> ; 24 | . 25 | 26 | ## In-memory, initially empty. 27 | <#dataset> rdf:type ja:RDFDataset . 28 | -------------------------------------------------------------------------------- /KGServer/lib/hanlp-1.6.6-sources.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/lib/hanlp-1.6.6-sources.jar -------------------------------------------------------------------------------- /KGServer/lib/hanlp-1.6.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/lib/hanlp-1.6.6.jar -------------------------------------------------------------------------------- /KGServer/newnode.txt: -------------------------------------------------------------------------------- 1 | zhengzhuang 新症状 2 | zhengzhuang 新症状 3 | zhengzhuang 新症状 4 | -------------------------------------------------------------------------------- /KGServer/src/main/java/NLP/QunN.java: -------------------------------------------------------------------------------- 1 | package NLP; 2 | 3 | import TDB.HandleTDB; 4 | import com.hankcs.hanlp.HanLP; 5 | import com.hankcs.hanlp.corpus.dependency.CoNll.CoNLLSentence; 6 | import com.hankcs.hanlp.dictionary.CustomDictionary; 7 | import com.hankcs.hanlp.seg.Segment; 8 | import org.apache.jena.base.Sys; 9 | import org.apache.jena.query.*; 10 | import org.apache.jena.tdb.TDBFactory; 11 | import org.apache.jena.tdb.base.file.Location; 12 | 13 | import java.util.ArrayList; 14 | import java.util.List; 15 | 16 | public class QunN { 17 | 18 | public static ArrayList getResults(String lines){ 19 | String type=""; 20 | String ans=""; 21 | int num=0; 22 | ArrayList ans2=new ArrayList<>(); 23 | //CustomDictionary.insert("新生儿臂丛神经麻痹", "n 1000"); 24 | 25 | Segment segment =HanLP.newSegment().enableCustomDictionary(true); 26 | List sentence=segment.seg(lines); 27 | for(Object i:sentence) 28 | System.out.println(i.toString()); 29 | 30 | ans2=Show.Showup5(sentence); 31 | 32 | return ans2; 33 | } 34 | 35 | public static ArrayList getResults_S(String lines){ 36 | return Show.Showup_S(lines); 37 | } 38 | 39 | public static void main(String args[]){ 40 | QunN qunN=new QunN(); 41 | //List a=new ArrayList<>(); 42 | //CustomDictionary.reload(); 43 | //qunN.getResults("新生儿臂丛神经麻痹,持续性头晕的症状是什么"); 44 | //qunN.getResults("持续性头晕的疾病吃什么药");//症状相关症状 45 | //qunN.getResults("持续性头晕小儿维生素A"); 46 | // qunN.getResults("持续性头晕"); 47 | // qunN.getResults("持续性头晕要吃什么药"); 48 | //qunN.getResults("持续性头晕是什么病");//症状相关疾病 49 | //qunN.getResults("小儿维生素A缺乏病有什么症状");//疾病相关症状 50 | //qunN.getResults("阳痿,感冒");//症状相关疾病 51 | // Segment segment =HanLP.newSegment().enableCustomDictionary(true); 52 | CoNLLSentence sentence = HanLP.parseDependency("小儿维生素A缺乏病有什么症状"); 53 | // System.out.printf(sentence.toString()); 54 | 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/KGServer.java: -------------------------------------------------------------------------------- 1 | package org.horizon; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | 7 | @SpringBootApplication 8 | @MapperScan("org.horizon.mapper") 9 | public class KGServer { 10 | public static void main(String[] args) { 11 | 12 | SpringApplication.run(KGServer.class, args); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/Neo4j/Util.java: -------------------------------------------------------------------------------- 1 | package org.horizon.Neo4j; 2 | 3 | import jdk.nashorn.internal.runtime.arrays.ArrayLikeIterator; 4 | import org.apache.jena.base.Sys; 5 | import org.neo4j.driver.v1.*; 6 | 7 | import java.util.ArrayList; 8 | 9 | import static org.neo4j.driver.v1.Values.parameters; 10 | //StatementResult result = session.run( "MATCH (a:YiItem) WHERE a.name = {name} " + 11 | // "RETURN a.name AS name, a.type AS type", 12 | // parameters( "name", "腹部透视" ) ); 13 | // StatementResult result = session.run("MATCH p=()-[r:YiRELATION]->() RETURN p as name LIMIT 10"); 14 | // StatementResult result = session.run("match(n:YiItem) where n.name={name}"+ 15 | // "return n.name as name,n.type as type", 16 | // parameters("name","腹部透视")); 17 | public class Util { 18 | public static ArrayList getResult(String name){ 19 | Driver driver = GraphDatabase.driver("bolt://localhost:7687", AuthTokens.basic("neo4j", "root")); 20 | ArrayList arr = new ArrayList<>(); 21 | arr.add(name); 22 | try (Session session = driver.session()) { 23 | StatementResult result = session.run("match(n{name:'感冒'})--(m:YiItem)" + 24 | "return m.name as name,m.type as type,n.name,n.type limit 10"); 25 | 26 | while (result.hasNext() ) 27 | { 28 | Record record = result.next(); 29 | arr.add(record.get("name").asString()); 30 | // System.out.println(record+" "+record.get("name")+" "+record.get("type")); 31 | } 32 | } 33 | driver.close(); 34 | return arr; 35 | } 36 | 37 | public static void main(String args[]){ 38 | ArrayList result = getResult("感冒"); 39 | for(String arr : result){ 40 | System.out.println(arr); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/bean/HrRole.java: -------------------------------------------------------------------------------- 1 | package org.horizon.bean; 2 | 3 | /** 4 | * Created by taos on 2018/3/1. 5 | */ 6 | public class HrRole { 7 | private Role role; 8 | 9 | public Role getRole() { 10 | return role; 11 | } 12 | 13 | public void setRole(Role role) { 14 | this.role = role; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/bean/JobLevel.java: -------------------------------------------------------------------------------- 1 | package org.horizon.bean; 2 | 3 | import java.sql.Timestamp; 4 | 5 | /** 6 | * Created by sang on 2018/1/11. 7 | */ 8 | public class JobLevel { 9 | private Long id; 10 | private String name; 11 | private String titleLevel; 12 | private Timestamp createDate; 13 | 14 | @Override 15 | public boolean equals(Object o) { 16 | if (this == o) return true; 17 | if (o == null || getClass() != o.getClass()) return false; 18 | 19 | JobLevel jobLevel = (JobLevel) o; 20 | 21 | return name != null ? name.equals(jobLevel.name) : jobLevel.name == null; 22 | } 23 | 24 | @Override 25 | public int hashCode() { 26 | return name != null ? name.hashCode() : 0; 27 | } 28 | 29 | public JobLevel() { 30 | 31 | } 32 | 33 | public JobLevel(String name) { 34 | 35 | this.name = name; 36 | } 37 | 38 | public Long getId() { 39 | return id; 40 | } 41 | 42 | public void setId(Long id) { 43 | this.id = id; 44 | } 45 | 46 | public String getName() { 47 | return name; 48 | } 49 | 50 | public void setName(String name) { 51 | this.name = name; 52 | } 53 | 54 | public String getTitleLevel() { 55 | return titleLevel; 56 | } 57 | 58 | public void setTitleLevel(String titleLevel) { 59 | this.titleLevel = titleLevel; 60 | } 61 | 62 | public Timestamp getCreateDate() { 63 | return createDate; 64 | } 65 | 66 | public void setCreateDate(Timestamp createDate) { 67 | this.createDate = createDate; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/bean/MapJ.java: -------------------------------------------------------------------------------- 1 | package org.horizon.bean; 2 | 3 | /** 4 | * Created by thinkpad on 2018/2/28. 5 | */ 6 | public class MapJ { 7 | private String key;//替换的编号 8 | private String value;//值 9 | public String getKey() { 10 | return key; 11 | } 12 | public void setKey(String key) { 13 | this.key = key; 14 | } 15 | public String getValue() { 16 | return value; 17 | } 18 | public void setValue(String value) { 19 | this.value = value; 20 | } 21 | public MapJ(String key, String value) { 22 | super(); 23 | this.key = key; 24 | this.value = value; 25 | } 26 | public MapJ() { 27 | super(); 28 | } 29 | 30 | } -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/bean/MenuMeta.java: -------------------------------------------------------------------------------- 1 | package org.horizon.bean; 2 | 3 | /** 4 | * Created by sang on 2017/12/30. 5 | */ 6 | public class MenuMeta { 7 | 8 | private boolean keepAlive; 9 | private boolean requireAuth; 10 | 11 | public boolean isKeepAlive() { 12 | return keepAlive; 13 | } 14 | 15 | public void setKeepAlive(boolean keepAlive) { 16 | this.keepAlive = keepAlive; 17 | } 18 | 19 | public boolean isRequireAuth() { 20 | return requireAuth; 21 | } 22 | 23 | public void setRequireAuth(boolean requireAuth) { 24 | this.requireAuth = requireAuth; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/bean/Nation.java: -------------------------------------------------------------------------------- 1 | package org.horizon.bean; 2 | 3 | /** 4 | * Created by sang on 2018/1/12. 5 | */ 6 | public class Nation { 7 | private Long id; 8 | private String name; 9 | 10 | public Nation(String name) { 11 | this.name = name; 12 | } 13 | 14 | public Nation() { 15 | } 16 | 17 | @Override 18 | public boolean equals(Object o) { 19 | if (this == o) return true; 20 | if (o == null || getClass() != o.getClass()) return false; 21 | 22 | Nation nation = (Nation) o; 23 | 24 | return name != null ? name.equals(nation.name) : nation.name == null; 25 | } 26 | 27 | @Override 28 | public int hashCode() { 29 | return name != null ? name.hashCode() : 0; 30 | } 31 | 32 | public Long getId() { 33 | return id; 34 | } 35 | 36 | public void setId(Long id) { 37 | this.id = id; 38 | } 39 | 40 | public String getName() { 41 | return name; 42 | } 43 | 44 | public void setName(String name) { 45 | this.name = name; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/bean/Personnel.java: -------------------------------------------------------------------------------- 1 | package org.horizon.bean; 2 | 3 | import java.util.Date; 4 | 5 | /** 6 | * 班级信息 7 | * @author lzd 8 | */ 9 | public class Personnel { 10 | private Long id; 11 | private String name; 12 | private Long num_stu; 13 | private String des; 14 | private Date begin_date; 15 | private Date end_date; 16 | private String beginDate; 17 | private String endDate; 18 | public Long getId() { 19 | return id; 20 | } 21 | 22 | public void setId(Long id) { 23 | this.id = id; 24 | } 25 | 26 | public String getName() { 27 | return name; 28 | } 29 | 30 | public void setName(String name) { 31 | this.name = name; 32 | } 33 | 34 | public Long getNum_stu() { 35 | return num_stu; 36 | } 37 | 38 | public void setNum_stu(Long num_stu) { 39 | this.num_stu = num_stu; 40 | } 41 | 42 | public String getDes() { 43 | return des; 44 | } 45 | 46 | public void setDes(String des) { 47 | this.des = des; 48 | } 49 | 50 | public Date getBegin_date() { 51 | return begin_date; 52 | } 53 | 54 | public void setBegin_date(Date begin_date) { 55 | this.begin_date = begin_date; 56 | } 57 | 58 | public Date getEnd_date() { 59 | return end_date; 60 | } 61 | 62 | public void setEnd_date(Date end_date) { 63 | this.end_date = end_date; 64 | } 65 | 66 | public String getBeginDate() { 67 | return beginDate; 68 | } 69 | 70 | public void setBeginDate(String beginDate) { 71 | this.beginDate = beginDate; 72 | } 73 | 74 | public String getEndDate() { 75 | return endDate; 76 | } 77 | 78 | public void setEndDate(String endDate) { 79 | this.endDate = endDate; 80 | } 81 | } -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/bean/PoliticsStatus.java: -------------------------------------------------------------------------------- 1 | package org.horizon.bean; 2 | 3 | /** 4 | * Created by sang on 2018/1/13. 5 | */ 6 | public class PoliticsStatus { 7 | private Long id; 8 | private String name; 9 | 10 | @Override 11 | public boolean equals(Object o) { 12 | if (this == o) return true; 13 | if (o == null || getClass() != o.getClass()) return false; 14 | 15 | PoliticsStatus that = (PoliticsStatus) o; 16 | 17 | return name != null ? name.equals(that.name) : that.name == null; 18 | } 19 | 20 | @Override 21 | public int hashCode() { 22 | return name != null ? name.hashCode() : 0; 23 | } 24 | 25 | public PoliticsStatus(String name) { 26 | 27 | this.name = name; 28 | } 29 | 30 | public PoliticsStatus() { 31 | 32 | } 33 | 34 | public Long getId() { 35 | return id; 36 | } 37 | 38 | public void setId(Long id) { 39 | this.id = id; 40 | } 41 | 42 | public String getName() { 43 | return name; 44 | } 45 | 46 | public void setName(String name) { 47 | this.name = name; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/bean/Position.java: -------------------------------------------------------------------------------- 1 | package org.horizon.bean; 2 | 3 | import java.sql.Timestamp; 4 | 5 | /** 6 | * Created by sang on 2018/1/10. 7 | */ 8 | public class Position { 9 | private Long id; 10 | private String name; 11 | private Timestamp createDate; 12 | 13 | public Position() { 14 | } 15 | 16 | @Override 17 | public boolean equals(Object o) { 18 | if (this == o) return true; 19 | if (o == null || getClass() != o.getClass()) return false; 20 | 21 | Position position = (Position) o; 22 | 23 | return name != null ? name.equals(position.name) : position.name == null; 24 | } 25 | 26 | @Override 27 | public int hashCode() { 28 | return name != null ? name.hashCode() : 0; 29 | } 30 | 31 | public Position(String name) { 32 | 33 | this.name = name; 34 | } 35 | 36 | public Long getId() { 37 | return id; 38 | } 39 | 40 | public void setId(Long id) { 41 | this.id = id; 42 | } 43 | 44 | public String getName() { 45 | return name; 46 | } 47 | 48 | public void setName(String name) { 49 | this.name = name; 50 | } 51 | 52 | public Timestamp getCreateDate() { 53 | return createDate; 54 | } 55 | 56 | public void setCreateDate(Timestamp createDate) { 57 | this.createDate = createDate; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/bean/RespBean.java: -------------------------------------------------------------------------------- 1 | package org.horizon.bean; 2 | 3 | /** 4 | * Created by sang on 2017/12/29. 5 | */ 6 | public class RespBean { 7 | private String status; 8 | private String msg; 9 | 10 | public RespBean() { 11 | } 12 | 13 | public RespBean(String status, String msg) { 14 | 15 | this.status = status; 16 | this.msg = msg; 17 | } 18 | 19 | public String getStatus() { 20 | 21 | return status; 22 | } 23 | 24 | public void setStatus(String status) { 25 | this.status = status; 26 | } 27 | 28 | public String getMsg() { 29 | return msg; 30 | } 31 | 32 | public void setMsg(String msg) { 33 | this.msg = msg; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/bean/Role.java: -------------------------------------------------------------------------------- 1 | package org.horizon.bean; 2 | 3 | /** 4 | * Created by sang on 2017/12/28. 5 | */ 6 | public class Role { 7 | private Long id; 8 | private String name; 9 | private String nameZh; 10 | 11 | public String getNameZh() { 12 | return nameZh; 13 | } 14 | 15 | public void setNameZh(String nameZh) { 16 | this.nameZh = nameZh; 17 | } 18 | 19 | public Long getId() { 20 | return id; 21 | } 22 | 23 | public void setId(Long id) { 24 | this.id = id; 25 | } 26 | 27 | public String getName() { 28 | return name; 29 | } 30 | 31 | public void setName(String name) { 32 | this.name = name; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/common/DateConverter.java: -------------------------------------------------------------------------------- 1 | package org.horizon.common; 2 | 3 | import org.springframework.core.convert.converter.Converter; 4 | 5 | import java.text.ParseException; 6 | import java.text.SimpleDateFormat; 7 | import java.util.Date; 8 | 9 | /** 10 | * Created by sang on 2018/1/13. 11 | */ 12 | public class DateConverter implements Converter { 13 | private SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); 14 | @Override 15 | public Date convert(String s) { 16 | if ("".equals(s) || s == null) { 17 | return null; 18 | } 19 | try { 20 | return simpleDateFormat.parse(s); 21 | } catch (ParseException e) { 22 | e.printStackTrace(); 23 | } 24 | return null; 25 | } 26 | } -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/common/ErrorCode.java: -------------------------------------------------------------------------------- 1 | package org.horizon.common; 2 | 3 | import com.fasterxml.jackson.annotation.JsonValue; 4 | 5 | /** 6 | * Enumeration of REST Error types. 7 | * 8 | * @author vladimir.stankovic 9 | * 10 | * Aug 3, 2016 11 | */ 12 | public enum ErrorCode { 13 | GLOBAL(2), 14 | 15 | AUTHENTICATION(10), JWT_TOKEN_EXPIRED(11); 16 | 17 | private int errorCode; 18 | 19 | private ErrorCode(int errorCode) { 20 | this.errorCode = errorCode; 21 | } 22 | 23 | @JsonValue 24 | public int getErrorCode() { 25 | return errorCode; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/common/ErrorResponse.java: -------------------------------------------------------------------------------- 1 | package org.horizon.common; 2 | 3 | import org.springframework.http.HttpStatus; 4 | 5 | import java.util.Date; 6 | 7 | /** 8 | * Error model for interacting with client. 9 | * 10 | * @author vladimir.stankovic 11 | * 12 | * Aug 3, 2016 13 | */ 14 | public class ErrorResponse { 15 | // HTTP Response Status Code 16 | private final HttpStatus status; 17 | 18 | // General Error message 19 | private final String message; 20 | 21 | // Error code 22 | private final ErrorCode errorCode; 23 | 24 | private final Date timestamp; 25 | 26 | protected ErrorResponse(final String message, final ErrorCode errorCode, HttpStatus status) { 27 | this.message = message; 28 | this.errorCode = errorCode; 29 | this.status = status; 30 | this.timestamp = new Date(); 31 | } 32 | 33 | public static ErrorResponse of(final String message, final ErrorCode errorCode, HttpStatus status) { 34 | return new ErrorResponse(message, errorCode, status); 35 | } 36 | 37 | public Integer getStatus() { 38 | return status.value(); 39 | } 40 | 41 | public String getMessage() { 42 | return message; 43 | } 44 | 45 | public ErrorCode getErrorCode() { 46 | return errorCode; 47 | } 48 | 49 | public Date getTimestamp() { 50 | return timestamp; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/common/HrUtils.java: -------------------------------------------------------------------------------- 1 | package org.horizon.common; 2 | 3 | import org.horizon.bean.Hr; 4 | import org.horizon.bean.Role; 5 | import org.horizon.common.security.model.UserContext; 6 | import org.springframework.security.core.context.SecurityContextHolder; 7 | 8 | import java.util.ArrayList; 9 | import java.util.HashMap; 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | /** 14 | * Created by sang on 2017/12/30. 15 | */ 16 | public class HrUtils { 17 | public static Hr getCurrentHr() { 18 | UserContext userContext = (UserContext)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); 19 | Hr hr = new Hr(); 20 | hr.setId(userContext.getId()); 21 | return hr; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/common/InMemoryDatabaseConfig.java: -------------------------------------------------------------------------------- 1 | //package org.sang.common; 2 | // 3 | //import org.h2.server.web.WebServlet; 4 | //import org.springframework.boot.web.servlet.ServletRegistrationBean; 5 | //import org.springframework.context.annotation.Bean; 6 | //import org.springframework.context.annotation.Configuration; 7 | // 8 | //@Configuration 9 | //public class InMemoryDatabaseConfig { 10 | // @Bean 11 | // public ServletRegistrationBean h2servletRegistration() { 12 | // ServletRegistrationBean registration = new ServletRegistrationBean(new WebServlet()); 13 | // registration.addUrlMappings("/console/*"); 14 | // return registration; 15 | // } 16 | //} 17 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/common/WebUtil.java: -------------------------------------------------------------------------------- 1 | package org.horizon.common; 2 | 3 | import org.springframework.security.web.savedrequest.SavedRequest; 4 | 5 | import javax.servlet.http.HttpServletRequest; 6 | 7 | /** 8 | * 9 | * @author vladimir.stankovic 10 | * 11 | * Aug 3, 2016 12 | */ 13 | public class WebUtil { 14 | private static final String XML_HTTP_REQUEST = "XMLHttpRequest"; 15 | private static final String X_REQUESTED_WITH = "X-Requested-With"; 16 | 17 | private static final String CONTENT_TYPE = "Content-type"; 18 | private static final String CONTENT_TYPE_JSON = "application/json"; 19 | 20 | public static boolean isAjax(HttpServletRequest request) { 21 | return XML_HTTP_REQUEST.equals(request.getHeader(X_REQUESTED_WITH)); 22 | } 23 | 24 | public static boolean isAjax(SavedRequest request) { 25 | return request.getHeaderValues(X_REQUESTED_WITH).contains(XML_HTTP_REQUEST); 26 | } 27 | 28 | public static boolean isContentTypeJson(SavedRequest request) { 29 | return request.getHeaderValues(CONTENT_TYPE).contains(CONTENT_TYPE_JSON); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/common/security/CustomCorsFilter.java: -------------------------------------------------------------------------------- 1 | package org.horizon.common.security; 2 | 3 | import org.springframework.web.cors.CorsConfiguration; 4 | import org.springframework.web.cors.UrlBasedCorsConfigurationSource; 5 | import org.springframework.web.filter.CorsFilter; 6 | 7 | import java.util.Arrays; 8 | 9 | /** 10 | * CustomCorsFilter 11 | * 12 | * @author vladimir.stankovic 13 | * 14 | * Aug 3, 2016 15 | */ 16 | public class CustomCorsFilter extends CorsFilter { 17 | 18 | public CustomCorsFilter() { 19 | super(configurationSource()); 20 | } 21 | 22 | private static UrlBasedCorsConfigurationSource configurationSource() { 23 | CorsConfiguration config = new CorsConfiguration(); 24 | config.setAllowCredentials(true); 25 | config.addAllowedOrigin("*"); 26 | config.addAllowedHeader("*"); 27 | config.setMaxAge(36000L); 28 | config.setAllowedMethods(Arrays.asList("GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS")); 29 | UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); 30 | source.registerCorsConfiguration("/**", config); 31 | return source; 32 | } 33 | } -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/common/security/RestAuthenticationEntryPoint.java: -------------------------------------------------------------------------------- 1 | package org.horizon.common.security; 2 | 3 | import java.io.IOException; 4 | 5 | import javax.servlet.ServletException; 6 | import javax.servlet.http.HttpServletRequest; 7 | import javax.servlet.http.HttpServletResponse; 8 | 9 | import org.springframework.http.HttpStatus; 10 | import org.springframework.security.core.AuthenticationException; 11 | import org.springframework.security.web.AuthenticationEntryPoint; 12 | import org.springframework.stereotype.Component; 13 | 14 | /** 15 | * 16 | * @author taos 20180301 17 | * 18 | */ 19 | @Component 20 | public class RestAuthenticationEntryPoint implements AuthenticationEntryPoint { 21 | @Override 22 | public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException ex) 23 | throws IOException, ServletException { 24 | response.sendError(HttpStatus.UNAUTHORIZED.value(), "Unauthorized"); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/common/security/auth/JwtAuthenticationToken.java: -------------------------------------------------------------------------------- 1 | package org.horizon.common.security.auth; 2 | 3 | import java.util.Collection; 4 | 5 | import org.springframework.security.authentication.AbstractAuthenticationToken; 6 | import org.springframework.security.core.GrantedAuthority; 7 | 8 | import org.horizon.common.security.model.UserContext; 9 | import org.horizon.common.security.model.token.RawAccessJwtToken; 10 | 11 | /** 12 | * An {@link org.springframework.security.core.Authentication} implementation 13 | * that is designed for simple presentation of JwtToken. 14 | * 15 | * @author vladimir.stankovic 16 | * 17 | * May 23, 2016 18 | */ 19 | public class JwtAuthenticationToken extends AbstractAuthenticationToken { 20 | private static final long serialVersionUID = 2877954820905567501L; 21 | 22 | private RawAccessJwtToken rawAccessToken; 23 | private UserContext userContext; 24 | 25 | public JwtAuthenticationToken(RawAccessJwtToken unsafeToken) { 26 | super(null); 27 | this.rawAccessToken = unsafeToken; 28 | this.setAuthenticated(false); 29 | } 30 | 31 | public JwtAuthenticationToken(UserContext userContext, Collection authorities) { 32 | super(authorities); 33 | this.eraseCredentials(); 34 | this.userContext = userContext; 35 | super.setAuthenticated(true); 36 | } 37 | 38 | @Override 39 | public void setAuthenticated(boolean authenticated) { 40 | if (authenticated) { 41 | throw new IllegalArgumentException( 42 | "Cannot set this token to trusted - use constructor which takes a GrantedAuthority list instead"); 43 | } 44 | super.setAuthenticated(false); 45 | } 46 | 47 | @Override 48 | public Object getCredentials() { 49 | return rawAccessToken; 50 | } 51 | 52 | @Override 53 | public Object getPrincipal() { 54 | return this.userContext; 55 | } 56 | 57 | @Override 58 | public void eraseCredentials() { 59 | super.eraseCredentials(); 60 | this.rawAccessToken = null; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/common/security/auth/ajax/LoginRequest.java: -------------------------------------------------------------------------------- 1 | package org.horizon.common.security.auth.ajax; 2 | 3 | import com.fasterxml.jackson.annotation.JsonCreator; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | 6 | /** 7 | * 8 | * @author taos 20180301 9 | * 10 | */ 11 | 12 | public class LoginRequest { 13 | private String username; 14 | private String password; 15 | 16 | @JsonCreator 17 | public LoginRequest(@JsonProperty("username") String username, @JsonProperty("password") String password) { 18 | this.username = username; 19 | this.password = password; 20 | } 21 | 22 | public String getUsername() { 23 | return username; 24 | } 25 | 26 | public String getPassword() { 27 | return password; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/common/security/auth/jwt/SkipPathRequestMatcher.java: -------------------------------------------------------------------------------- 1 | package org.horizon.common.security.auth.jwt; 2 | 3 | import java.util.List; 4 | import java.util.stream.Collectors; 5 | 6 | import javax.servlet.http.HttpServletRequest; 7 | 8 | import org.springframework.security.web.util.matcher.AntPathRequestMatcher; 9 | import org.springframework.security.web.util.matcher.OrRequestMatcher; 10 | import org.springframework.security.web.util.matcher.RequestMatcher; 11 | import org.springframework.util.Assert; 12 | 13 | /** 14 | * SkipPathRequestMatcher 15 | * 16 | * @author vladimir.stankovic 17 | * 18 | * Aug 19, 2016 19 | */ 20 | public class SkipPathRequestMatcher implements RequestMatcher { 21 | private OrRequestMatcher matchers; 22 | private RequestMatcher processingMatcher; 23 | 24 | public SkipPathRequestMatcher(List pathsToSkip, String processingPath) { 25 | Assert.notNull(pathsToSkip, "List is null"); 26 | List m = pathsToSkip.stream().map(path -> new AntPathRequestMatcher(path)).collect(Collectors.toList()); 27 | matchers = new OrRequestMatcher(m); 28 | processingMatcher = new AntPathRequestMatcher(processingPath); 29 | } 30 | 31 | @Override 32 | public boolean matches(HttpServletRequest request) { 33 | if (matchers.matches(request)) { 34 | return false; 35 | } 36 | return processingMatcher.matches(request) ? true : false; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/common/security/auth/jwt/extractor/JwtHeaderTokenExtractor.java: -------------------------------------------------------------------------------- 1 | package org.horizon.common.security.auth.jwt.extractor; 2 | 3 | import org.apache.commons.lang3.StringUtils; 4 | import org.springframework.security.authentication.AuthenticationServiceException; 5 | import org.springframework.stereotype.Component; 6 | 7 | /** 8 | * An implementation of {@link TokenExtractor} extracts token from 9 | * Authorization: Bearer scheme. 10 | * 11 | * @author vladimir.stankovic 12 | * 13 | * Aug 5, 2016 14 | */ 15 | @Component 16 | public class JwtHeaderTokenExtractor implements TokenExtractor { 17 | public static String HEADER_PREFIX = "Bearer "; 18 | 19 | @Override 20 | public String extract(String header) { 21 | if (StringUtils.isBlank(header)) { 22 | throw new AuthenticationServiceException("Authorization header cannot be blank!"); 23 | } 24 | 25 | if (header.length() < HEADER_PREFIX.length()) { 26 | throw new AuthenticationServiceException("Invalid authorization header size."); 27 | } 28 | 29 | return header.substring(HEADER_PREFIX.length(), header.length()); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/common/security/auth/jwt/extractor/TokenExtractor.java: -------------------------------------------------------------------------------- 1 | package org.horizon.common.security.auth.jwt.extractor; 2 | 3 | /** 4 | * Implementations of this interface should always return raw base-64 encoded 5 | * representation of JWT Token. 6 | * 7 | * @author vladimir.stankovic 8 | * 9 | * Aug 5, 2016 10 | */ 11 | public interface TokenExtractor { 12 | public String extract(String payload); 13 | } 14 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/common/security/auth/jwt/verifier/BloomFilterTokenVerifier.java: -------------------------------------------------------------------------------- 1 | package org.horizon.common.security.auth.jwt.verifier; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | /** 6 | * BloomFilterTokenVerifier 7 | * 8 | * @author vladimir.stankovic 9 | * 10 | * Aug 17, 2016 11 | */ 12 | @Component 13 | public class BloomFilterTokenVerifier implements TokenVerifier { 14 | @Override 15 | public boolean verify(String jti) { 16 | return true; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/common/security/auth/jwt/verifier/TokenVerifier.java: -------------------------------------------------------------------------------- 1 | package org.horizon.common.security.auth.jwt.verifier; 2 | 3 | /** 4 | * 5 | * @author vladimir.stankovic 6 | * 7 | * Aug 17, 2016 8 | */ 9 | public interface TokenVerifier { 10 | public boolean verify(String jti); 11 | } 12 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/common/security/config/JwtSettings.java: -------------------------------------------------------------------------------- 1 | package org.horizon.common.security.config; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | import org.springframework.context.annotation.Configuration; 5 | 6 | @Configuration 7 | @ConfigurationProperties(prefix = "demo.security.jwt") 8 | public class JwtSettings { 9 | /** 10 | * {@link JwtToken} will expire after this time. 11 | */ 12 | private Integer tokenExpirationTime; 13 | 14 | /** 15 | * Token issuer. 16 | */ 17 | private String tokenIssuer; 18 | 19 | /** 20 | * Key is used to sign {@link JwtToken}. 21 | */ 22 | private String tokenSigningKey; 23 | 24 | /** 25 | * {@link JwtToken} can be refreshed during this timeframe. 26 | */ 27 | private Integer refreshTokenExpTime; 28 | 29 | public Integer getRefreshTokenExpTime() { 30 | return refreshTokenExpTime; 31 | } 32 | 33 | public void setRefreshTokenExpTime(Integer refreshTokenExpTime) { 34 | this.refreshTokenExpTime = refreshTokenExpTime; 35 | } 36 | 37 | public Integer getTokenExpirationTime() { 38 | return tokenExpirationTime; 39 | } 40 | 41 | public void setTokenExpirationTime(Integer tokenExpirationTime) { 42 | this.tokenExpirationTime = tokenExpirationTime; 43 | } 44 | 45 | public String getTokenIssuer() { 46 | return tokenIssuer; 47 | } 48 | public void setTokenIssuer(String tokenIssuer) { 49 | this.tokenIssuer = tokenIssuer; 50 | } 51 | 52 | public String getTokenSigningKey() { 53 | return tokenSigningKey; 54 | } 55 | 56 | public void setTokenSigningKey(String tokenSigningKey) { 57 | this.tokenSigningKey = tokenSigningKey; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/common/security/config/PasswordEncoderConfig.java: -------------------------------------------------------------------------------- 1 | package org.horizon.common.security.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; 6 | 7 | /** 8 | * PasswordEncoderConfig 9 | * 10 | * @author vladimir.stankovic 11 | * 12 | * Dec 27, 2016 13 | */ 14 | @Configuration 15 | public class PasswordEncoderConfig { 16 | @Bean 17 | protected BCryptPasswordEncoder passwordEncoder() { 18 | return new BCryptPasswordEncoder(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/common/security/exceptions/AuthMethodNotSupportedException.java: -------------------------------------------------------------------------------- 1 | package org.horizon.common.security.exceptions; 2 | 3 | import org.springframework.security.authentication.AuthenticationServiceException; 4 | 5 | /** 6 | * 7 | * @author taos 20180301 8 | * 9 | */ 10 | public class AuthMethodNotSupportedException extends AuthenticationServiceException { 11 | private static final long serialVersionUID = 3705043083010304496L; 12 | 13 | public AuthMethodNotSupportedException(String msg) { 14 | super(msg); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/common/security/exceptions/InvalidJwtToken.java: -------------------------------------------------------------------------------- 1 | package org.horizon.common.security.exceptions; 2 | 3 | /** 4 | * 5 | * @author taos 20180301 6 | * 7 | */ 8 | public class InvalidJwtToken extends RuntimeException { 9 | private static final long serialVersionUID = -294671188037098603L; 10 | } 11 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/common/security/exceptions/JwtExpiredTokenException.java: -------------------------------------------------------------------------------- 1 | package org.horizon.common.security.exceptions; 2 | 3 | import org.horizon.common.security.model.token.JwtToken; 4 | import org.springframework.security.core.AuthenticationException; 5 | 6 | /** 7 | * 8 | * @author taos 20180301 9 | * 10 | */ 11 | public class JwtExpiredTokenException extends AuthenticationException { 12 | private static final long serialVersionUID = -5959543783324224864L; 13 | 14 | private JwtToken token; 15 | 16 | public JwtExpiredTokenException(String msg) { 17 | super(msg); 18 | } 19 | 20 | public JwtExpiredTokenException(JwtToken token, String msg, Throwable t) { 21 | super(msg, t); 22 | this.token = token; 23 | } 24 | 25 | public String token() { 26 | return this.token.getToken(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/common/security/model/Scopes.java: -------------------------------------------------------------------------------- 1 | package org.horizon.common.security.model; 2 | 3 | /** 4 | * Scopes 5 | * 6 | * @author vladimir.stankovic 7 | * 8 | * Aug 18, 2016 9 | */ 10 | public enum Scopes { 11 | REFRESH_TOKEN; 12 | 13 | public String authority() { 14 | return "ROLE_" + this.name(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/common/security/model/UserContext.java: -------------------------------------------------------------------------------- 1 | package org.horizon.common.security.model; 2 | 3 | import java.util.List; 4 | 5 | import org.apache.commons.lang3.StringUtils; 6 | import org.springframework.security.core.GrantedAuthority; 7 | 8 | /** 9 | * 10 | * @author taos 20180301 11 | * 12 | */ 13 | public class UserContext { 14 | private final String username; 15 | private final List authorities; 16 | private final Long id; 17 | private final String userface; 18 | private final String name; 19 | 20 | private UserContext(String username, List authorities, Long id, String userface, String name) { 21 | this.username = username; 22 | this.authorities = authorities; 23 | this.id = id; 24 | this.userface = userface; 25 | this.name = name; 26 | } 27 | 28 | public static UserContext create(String username, List authorities ,Long id, String userface, String name) { 29 | if (StringUtils.isBlank(username)) throw new IllegalArgumentException("Username is blank: " + username); 30 | return new UserContext(username, authorities, id, userface, name); 31 | } 32 | 33 | public String getUsername() { 34 | return username; 35 | } 36 | 37 | public List getAuthorities() { 38 | return authorities; 39 | } 40 | 41 | public Long getId() { 42 | return id; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/common/security/model/token/AccessJwtToken.java: -------------------------------------------------------------------------------- 1 | package org.horizon.common.security.model.token; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnore; 4 | 5 | import io.jsonwebtoken.Claims; 6 | 7 | /** 8 | * Raw representation of JWT Token. 9 | * 10 | * @author vladimir.stankovic 11 | * 12 | * May 31, 2016 13 | */ 14 | public final class AccessJwtToken implements JwtToken { 15 | private final String rawToken; 16 | @JsonIgnore private Claims claims; 17 | 18 | protected AccessJwtToken(final String token, Claims claims) { 19 | this.rawToken = token; 20 | this.claims = claims; 21 | } 22 | 23 | public String getToken() { 24 | return this.rawToken; 25 | } 26 | 27 | public Claims getClaims() { 28 | return claims; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/common/security/model/token/JwtToken.java: -------------------------------------------------------------------------------- 1 | package org.horizon.common.security.model.token; 2 | 3 | public interface JwtToken { 4 | String getToken(); 5 | } 6 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/common/security/model/token/RawAccessJwtToken.java: -------------------------------------------------------------------------------- 1 | package org.horizon.common.security.model.token; 2 | 3 | import org.horizon.common.security.exceptions.JwtExpiredTokenException; 4 | import org.slf4j.Logger; 5 | import org.slf4j.LoggerFactory; 6 | import org.springframework.security.authentication.BadCredentialsException; 7 | 8 | import io.jsonwebtoken.Claims; 9 | import io.jsonwebtoken.ExpiredJwtException; 10 | import io.jsonwebtoken.Jws; 11 | import io.jsonwebtoken.Jwts; 12 | import io.jsonwebtoken.MalformedJwtException; 13 | import io.jsonwebtoken.SignatureException; 14 | import io.jsonwebtoken.UnsupportedJwtException; 15 | 16 | public class RawAccessJwtToken implements JwtToken { 17 | private static Logger logger = LoggerFactory.getLogger(RawAccessJwtToken.class); 18 | 19 | private String token; 20 | 21 | public RawAccessJwtToken(String token) { 22 | this.token = token; 23 | } 24 | 25 | /** 26 | * Parses and validates JWT Token signature. 27 | * 28 | * @throws BadCredentialsException 29 | * @throws JwtExpiredTokenException 30 | * 31 | */ 32 | public Jws parseClaims(String signingKey) { 33 | try { 34 | return Jwts.parser().setSigningKey(signingKey).parseClaimsJws(this.token); 35 | } catch (UnsupportedJwtException | MalformedJwtException | IllegalArgumentException | SignatureException ex) { 36 | logger.error("Invalid JWT Token", ex); 37 | throw new BadCredentialsException("Invalid JWT token: ", ex); 38 | } catch (ExpiredJwtException expiredEx) { 39 | logger.info("JWT Token is expired", expiredEx); 40 | throw new JwtExpiredTokenException(this, "JWT Token expired", expiredEx); 41 | } 42 | } 43 | 44 | @Override 45 | public String getToken() { 46 | return token; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/common/security/model/token/RefreshToken.java: -------------------------------------------------------------------------------- 1 | package org.horizon.common.security.model.token; 2 | 3 | import java.util.List; 4 | import java.util.Optional; 5 | 6 | import org.horizon.common.security.model.Scopes; 7 | import org.springframework.security.authentication.BadCredentialsException; 8 | 9 | //import com.svlada.security.exceptions.JwtExpiredTokenException; 10 | //import com.svlada.security.model.Scopes; 11 | 12 | import io.jsonwebtoken.Claims; 13 | import io.jsonwebtoken.Jws; 14 | 15 | /** 16 | * RefreshToken 17 | * 18 | * @author vladimir.stankovic 19 | * 20 | * Aug 19, 2016 21 | */ 22 | @SuppressWarnings("unchecked") 23 | public class RefreshToken implements JwtToken { 24 | private Jws claims; 25 | 26 | private RefreshToken(Jws claims) { 27 | this.claims = claims; 28 | } 29 | 30 | /** 31 | * Creates and validates Refresh token 32 | * 33 | * @param token 34 | * @param signingKey 35 | * 36 | * @throws BadCredentialsException 37 | * @throws JwtExpiredTokenException 38 | * 39 | * @return 40 | */ 41 | public static Optional create(RawAccessJwtToken token, String signingKey) { 42 | Jws claims = token.parseClaims(signingKey); 43 | 44 | List scopes = claims.getBody().get("scopes", List.class); 45 | if (scopes == null || scopes.isEmpty() 46 | || !scopes.stream().filter(scope -> Scopes.REFRESH_TOKEN.authority().equals(scope)).findFirst().isPresent()) { 47 | return Optional.empty(); 48 | } 49 | 50 | return Optional.of(new RefreshToken(claims)); 51 | } 52 | 53 | @Override 54 | public String getToken() { 55 | return null; 56 | } 57 | 58 | public Jws getClaims() { 59 | return claims; 60 | } 61 | 62 | public String getJti() { 63 | return claims.getBody().getId(); 64 | } 65 | 66 | public String getSubject() { 67 | return claims.getBody().getSubject(); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/config/AuthenticationAccessDeniedHandler.java: -------------------------------------------------------------------------------- 1 | package org.horizon.config; 2 | 3 | import org.springframework.security.access.AccessDeniedException; 4 | import org.springframework.security.web.access.AccessDeniedHandler; 5 | import org.springframework.stereotype.Component; 6 | 7 | import javax.servlet.ServletException; 8 | import javax.servlet.http.HttpServletRequest; 9 | import javax.servlet.http.HttpServletResponse; 10 | import java.io.IOException; 11 | import java.io.PrintWriter; 12 | 13 | /** 14 | * taos 2018/03/01. 15 | */ 16 | @Component 17 | public class AuthenticationAccessDeniedHandler implements AccessDeniedHandler { 18 | @Override 19 | public void handle(HttpServletRequest httpServletRequest, HttpServletResponse resp, AccessDeniedException e) throws IOException, ServletException { 20 | resp.setStatus(HttpServletResponse.SC_FORBIDDEN); 21 | resp.setContentType("application/json;charset=UTF-8"); 22 | PrintWriter out = resp.getWriter(); 23 | out.write("{\"status\":\"error\",\"msg\":\"权限不足,请联系管理员!\"}"); 24 | out.flush(); 25 | out.close(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/config/UrlAccessDecisionManager.java: -------------------------------------------------------------------------------- 1 | package org.horizon.config; 2 | 3 | import org.springframework.security.access.AccessDecisionManager; 4 | import org.springframework.security.access.AccessDeniedException; 5 | import org.springframework.security.access.ConfigAttribute; 6 | import org.springframework.security.authentication.AnonymousAuthenticationToken; 7 | import org.springframework.security.authentication.BadCredentialsException; 8 | import org.springframework.security.core.Authentication; 9 | import org.springframework.security.core.AuthenticationException; 10 | import org.springframework.security.core.GrantedAuthority; 11 | import org.springframework.stereotype.Component; 12 | 13 | import java.util.Collection; 14 | import java.util.Iterator; 15 | 16 | /** 17 | * Created by sang on 2017/12/28. 18 | */ 19 | @Component 20 | public class UrlAccessDecisionManager implements AccessDecisionManager { 21 | @Override 22 | public void decide(Authentication authentication, Object o, Collection collection) throws AccessDeniedException, AuthenticationException { 23 | Iterator iterator = collection.iterator(); 24 | while (iterator.hasNext()) { 25 | ConfigAttribute ca = iterator.next(); 26 | //当前请求需要的权限 27 | String needRole = ca.getAttribute(); 28 | if ("ROLE_LOGIN".equals(needRole)) { 29 | if (authentication instanceof AnonymousAuthenticationToken) { 30 | throw new BadCredentialsException("未登录"); 31 | } else 32 | return; 33 | } 34 | //当前用户所具有的权限 35 | Collection authorities = authentication.getAuthorities(); 36 | for (GrantedAuthority authority : authorities) { 37 | if (authority.getAuthority().equals(needRole)) { 38 | return; 39 | } 40 | } 41 | } 42 | throw new AccessDeniedException("权限不足!"); 43 | } 44 | 45 | @Override 46 | public boolean supports(ConfigAttribute configAttribute) { 47 | return true; 48 | } 49 | 50 | @Override 51 | public boolean supports(Class aClass) { 52 | return true; 53 | } 54 | } -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/config/UrlFilterInvocationSecurityMetadataSource.java: -------------------------------------------------------------------------------- 1 | package org.horizon.config; 2 | 3 | import org.horizon.bean.Menu; 4 | import org.horizon.bean.Role; 5 | import org.horizon.service.MenuService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.security.access.ConfigAttribute; 8 | import org.springframework.security.access.SecurityConfig; 9 | import org.springframework.security.web.FilterInvocation; 10 | import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource; 11 | import org.springframework.stereotype.Component; 12 | import org.springframework.util.AntPathMatcher; 13 | 14 | import java.util.Collection; 15 | import java.util.List; 16 | 17 | /** 18 | * Created by sang on 2017/12/28. 19 | */ 20 | @Component 21 | public class UrlFilterInvocationSecurityMetadataSource implements FilterInvocationSecurityMetadataSource { 22 | @Autowired 23 | MenuService menuService; 24 | AntPathMatcher antPathMatcher = new AntPathMatcher(); 25 | 26 | @Override 27 | public Collection getAttributes(Object o) throws IllegalArgumentException { 28 | //获取请求地址 29 | String requestUrl = ((FilterInvocation) o).getRequestUrl(); 30 | if ("/login_p".equals(requestUrl)) { 31 | return null; 32 | } 33 | List allMenu = menuService.getAllMenu(); 34 | for (Menu menu : allMenu) { 35 | if (antPathMatcher.match(menu.getUrl(), requestUrl)&&menu.getRoles().size()>0) { 36 | List roles = menu.getRoles(); 37 | int size = roles.size(); 38 | String[] values = new String[size]; 39 | for (int i = 0; i < size; i++) { 40 | values[i] = roles.get(i).getName(); 41 | } 42 | return SecurityConfig.createList(values); 43 | } 44 | } 45 | //没有匹配上的资源,都是登录访问 46 | return SecurityConfig.createList("ROLE_LOGIN"); 47 | } 48 | 49 | @Override 50 | public Collection getAllConfigAttributes() { 51 | return null; 52 | } 53 | 54 | @Override 55 | public boolean supports(Class aClass) { 56 | return FilterInvocation.class.isAssignableFrom(aClass); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/config/WebMvcConfig.java: -------------------------------------------------------------------------------- 1 | package org.horizon.config; 2 | 3 | import org.horizon.common.DateConverter; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.format.FormatterRegistry; 7 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; 8 | 9 | import java.util.concurrent.ExecutorService; 10 | import java.util.concurrent.Executors; 11 | 12 | /** 13 | * Created by sang on 2018/1/2. 14 | */ 15 | @Configuration 16 | public class WebMvcConfig extends WebMvcConfigurerAdapter { 17 | @Override 18 | public void addFormatters(FormatterRegistry registry) { 19 | registry.addConverter(new DateConverter()); 20 | } 21 | 22 | @Bean 23 | public ExecutorService executorService() { 24 | return Executors.newCachedThreadPool(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/controller/ConfigController.java: -------------------------------------------------------------------------------- 1 | package org.horizon.controller; 2 | 3 | import org.horizon.bean.Hr; 4 | import org.horizon.bean.Menu; 5 | import org.horizon.common.HrUtils; 6 | import org.horizon.service.MenuService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.RestController; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | * 这是一个只要登录就能访问的Controller 15 | * 主要用来获取一些配置信息 16 | */ 17 | @RestController 18 | @RequestMapping("/api/config") 19 | public class ConfigController { 20 | @Autowired 21 | MenuService menuService; 22 | @RequestMapping("/sysmenu") 23 | public List sysmenu() { 24 | return menuService.getMenusByHrId(); 25 | } 26 | 27 | @RequestMapping("/hr") 28 | public Hr currentUser() { 29 | return HrUtils.getCurrentHr(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/controller/EmployeeController.java: -------------------------------------------------------------------------------- 1 | package org.horizon.controller; 2 | 3 | import jdk.nashorn.internal.ir.RuntimeNode; 4 | import org.apache.catalina.connector.Request; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | import org.springframework.web.bind.annotation.RequestMethod; 7 | import org.springframework.web.bind.annotation.RestController; 8 | 9 | /** 10 | * Created by sang on 2017/12/29. 11 | */ 12 | @RestController 13 | @RequestMapping("/api/employee") 14 | public class EmployeeController { 15 | @RequestMapping(value = "/basic") 16 | public String basic() { 17 | // str.getRequest(); 18 | System.out.println("14"); 19 | // System.out.println("15" + str); 20 | return "basic"; 21 | } 22 | @RequestMapping("/") 23 | public String hello() { 24 | System.out.println("18"); 25 | return "Hello"; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/controller/RegLoginController.java: -------------------------------------------------------------------------------- 1 | package org.horizon.controller; 2 | 3 | import org.springframework.web.bind.annotation.RestController; 4 | 5 | /** 6 | * Created by sang on 2017/12/29. 7 | */ 8 | @RestController 9 | public class RegLoginController { 10 | // @RequestMapping("/login_p") 11 | // public void login(HttpServletResponse resp) throws IOException { 12 | // resp.setStatus(HttpServletResponse.SC_UNAUTHORIZED); 13 | // resp.setContentType("application/json;charset=UTF-8"); 14 | // PrintWriter out = resp.getWriter(); 15 | // out.write("{\"status\":\"error\",\"msg\":\"尚未登录,请登录!\"}"); 16 | // out.flush(); 17 | // out.close(); 18 | // // return new RespBean("error", "尚未登录,请登录!"); 19 | // } 20 | } 21 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/controller/emp/newnode.txt: -------------------------------------------------------------------------------- 1 | undefined 2 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/controller/emp/newrelation.txt: -------------------------------------------------------------------------------- 1 | undefined undefined undefined 2 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/controller/salary/SalaryController.java: -------------------------------------------------------------------------------- 1 | package org.horizon.controller.salary; 2 | 3 | import org.horizon.bean.RespBean; 4 | import org.horizon.bean.Salary; 5 | import org.horizon.service.EmpService; 6 | import org.horizon.service.SalaryService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.web.bind.annotation.PathVariable; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.springframework.web.bind.annotation.RequestMethod; 11 | import org.springframework.web.bind.annotation.RestController; 12 | 13 | import java.util.List; 14 | 15 | /** 16 | * 工资账套配置 17 | */ 18 | @RestController 19 | @RequestMapping("/salary/sob") 20 | public class SalaryController { 21 | @Autowired 22 | SalaryService salaryService; 23 | @Autowired 24 | EmpService empService; 25 | 26 | @RequestMapping(value = "/salary", method = RequestMethod.POST) 27 | public RespBean addSalaryCfg(Salary salary) { 28 | if (salaryService.addSalary(salary) == 1) { 29 | return new RespBean("success", "添加成功!"); 30 | } 31 | return new RespBean("error", "添加失败!"); 32 | } 33 | 34 | @RequestMapping(value = "/salary", method = RequestMethod.GET) 35 | public List salaries() { 36 | return salaryService.getAllSalary(); 37 | } 38 | 39 | @RequestMapping(value = "/salary", method = RequestMethod.PUT) 40 | public RespBean updateSalary(Salary salary) { 41 | if (salaryService.updateSalary(salary) == 1) { 42 | return new RespBean("success", "更新成功!"); 43 | } 44 | return new RespBean("error", "更新失败!"); 45 | } 46 | 47 | @RequestMapping(value = "/salary/{ids}", method = RequestMethod.DELETE) 48 | public RespBean deleteSalary(@PathVariable String ids) { 49 | if (salaryService.deleteSalary(ids) == 1) { 50 | return new RespBean("success", "删除成功!"); 51 | } 52 | return new RespBean("success", "删除失败!"); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/controller/salary/SalaryEmpController.java: -------------------------------------------------------------------------------- 1 | package org.horizon.controller.salary; 2 | 3 | import org.horizon.bean.Employee; 4 | import org.horizon.bean.RespBean; 5 | import org.horizon.bean.Salary; 6 | import org.horizon.service.EmpService; 7 | import org.horizon.service.SalaryService; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.springframework.web.bind.annotation.RequestMethod; 11 | import org.springframework.web.bind.annotation.RequestParam; 12 | import org.springframework.web.bind.annotation.RestController; 13 | 14 | import java.util.HashMap; 15 | import java.util.List; 16 | import java.util.Map; 17 | 18 | /** 19 | * Created by sang on 2018/1/25. 20 | */ 21 | @RestController 22 | @RequestMapping("/salary/sobcfg") 23 | public class SalaryEmpController { 24 | @Autowired 25 | SalaryService salaryService; 26 | @Autowired 27 | EmpService empService; 28 | 29 | @RequestMapping(value = "/", method = RequestMethod.PUT) 30 | public RespBean updateEmpSalary(Integer sid, Long eid) { 31 | if (salaryService.updateEmpSalary(sid, eid) == 1) { 32 | return new RespBean("success", "修改成功!"); 33 | } 34 | return new RespBean("error", "修改失败!"); 35 | } 36 | 37 | @RequestMapping(value = "/salaries", method = RequestMethod.GET) 38 | public List salaries() { 39 | return salaryService.getAllSalary(); 40 | } 41 | 42 | @RequestMapping(value = "/emp", method = RequestMethod.GET) 43 | public Map getEmployeeByPage(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer size) { 44 | Map map = new HashMap<>(); 45 | List employeeByPage = empService.getEmployeeByPageShort(page, size); 46 | Long count = empService.getCountByKeywords("", null, null, null, null, null, null, null); 47 | map.put("emps", employeeByPage); 48 | map.put("count", count); 49 | return map; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/exception/CustomExceptionResolver.java: -------------------------------------------------------------------------------- 1 | package org.horizon.exception; 2 | 3 | import org.horizon.common.security.auth.ajax.AjaxLoginProcessingFilter; 4 | import org.slf4j.Logger; 5 | import org.slf4j.LoggerFactory; 6 | import org.springframework.dao.DataIntegrityViolationException; 7 | import org.springframework.stereotype.Component; 8 | import org.springframework.web.servlet.HandlerExceptionResolver; 9 | import org.springframework.web.servlet.ModelAndView; 10 | import org.springframework.web.servlet.view.json.MappingJackson2JsonView; 11 | 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | import java.util.HashMap; 15 | import java.util.Map; 16 | 17 | /** 18 | * Created by sang on 2018/1/2. 19 | */ 20 | @Component 21 | public class CustomExceptionResolver implements HandlerExceptionResolver { 22 | private static Logger logger = LoggerFactory.getLogger(CustomExceptionResolver.class); 23 | @Override 24 | public ModelAndView resolveException(HttpServletRequest httpServletRequest, HttpServletResponse response, Object o, Exception e) { 25 | ModelAndView mv = new ModelAndView(new MappingJackson2JsonView()); 26 | Map map = new HashMap<>(); 27 | map.put("status", "error"); 28 | if (e instanceof DataIntegrityViolationException) { 29 | map.put("msg", "该角色尚有关联的资源或用户,删除失败!"); 30 | }else{ 31 | logger.error("CustomExceptionResolver..", e); 32 | map.put("msg", "操作失败!"); 33 | } 34 | mv.addAllObjects(map); 35 | return mv; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/mapper/DepartmentMapper.java: -------------------------------------------------------------------------------- 1 | package org.horizon.mapper; 2 | 3 | import org.apache.ibatis.annotations.Param; 4 | import org.horizon.bean.Department; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Created by sang on 2018/1/7. 10 | */ 11 | public interface DepartmentMapper { 12 | void addDep(@Param("dep") Department department); 13 | 14 | void deleteDep(@Param("dep") Department department); 15 | 16 | List getDepByPid(Long pid); 17 | 18 | List getAllDeps(); 19 | } 20 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/mapper/DepartmentMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 23 | 26 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/mapper/EmpMapper.java: -------------------------------------------------------------------------------- 1 | package org.horizon.mapper; 2 | 3 | import org.apache.ibatis.annotations.Param; 4 | import org.horizon.bean.Employee; 5 | import org.horizon.bean.Nation; 6 | import org.horizon.bean.PoliticsStatus; 7 | 8 | import java.util.Date; 9 | import java.util.List; 10 | 11 | /** 12 | * Created by sang on 2018/1/12. 13 | */ 14 | public interface EmpMapper { 15 | List getAllNations(); 16 | 17 | List getAllPolitics(); 18 | 19 | int addEmp(Employee employee); 20 | 21 | Long getMaxWorkID(); 22 | 23 | List getEmployeeByPage(@Param("start") Integer start, @Param("size") Integer size, @Param("keywords") String keywords, @Param("politicId") Long politicId, @Param("nationId") Long nationId, @Param("posId") Long posId, @Param("jobLevelId") Long jobLevelId, @Param("engageForm") String engageForm, @Param("departmentId")Long departmentId, @Param("startBeginDate") Date startBeginDate, @Param("endBeginDate") Date endBeginDate); 24 | 25 | Long getCountByKeywords(@Param("keywords") String keywords, @Param("politicId") Long politicId, @Param("nationId") Long nationId, @Param("posId") Long posId, @Param("jobLevelId") Long jobLevelId, @Param("engageForm") String engageForm, @Param("departmentId")Long departmentId, @Param("startBeginDate") Date startBeginDate, @Param("endBeginDate") Date endBeginDate); 26 | 27 | int updateEmp(@Param("emp") Employee employee); 28 | 29 | int deleteEmpById(@Param("ids") String[] ids); 30 | 31 | int addEmps(@Param("emps") List emps); 32 | 33 | List getEmployeeByPageShort(@Param("start") int start, @Param("size") Integer size); 34 | } 35 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/mapper/HrMapper.java: -------------------------------------------------------------------------------- 1 | package org.horizon.mapper; 2 | 3 | import org.apache.ibatis.annotations.Param; 4 | import org.horizon.bean.Hr; 5 | import org.horizon.bean.Role; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by sang on 2017/12/28. 11 | */ 12 | public interface HrMapper { 13 | Hr loadUserByUsername(String username); 14 | 15 | List getRolesByHrId(Long id); 16 | 17 | int hrReg(@Param("username") String username, @Param("password") String password); 18 | 19 | List
    getHrsByKeywords(@Param("keywords") String keywords); 20 | 21 | int updateHr(Hr hr); 22 | 23 | int deleteRoleByHrId(Long hrId); 24 | 25 | int addRolesForHr(@Param("hrId") Long hrId, @Param("rids") Long[] rids); 26 | 27 | Hr getHrById(Long hrId); 28 | 29 | int deleteHr(Long hrId); 30 | } 31 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/mapper/JobLevelMapper.java: -------------------------------------------------------------------------------- 1 | package org.horizon.mapper; 2 | 3 | import org.apache.ibatis.annotations.Param; 4 | import org.horizon.bean.JobLevel; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Created by sang on 2018/1/11. 10 | */ 11 | public interface JobLevelMapper { 12 | JobLevel getJobLevelByName(String name); 13 | 14 | int addJobLevel(@Param("jobLevel") JobLevel jobLevel); 15 | 16 | List getAllJobLevels(); 17 | 18 | int deleteJobLevelById(@Param("ids") String[] ids); 19 | 20 | int updateJobLevel(@Param("jobLevel") JobLevel jobLevel); 21 | } 22 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/mapper/JobLevelMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 9 | 10 | INSERT INTO joblevel SET name=#{jobLevel.name},titleLevel=#{jobLevel.titleLevel} 11 | 12 | 15 | 16 | DELETE FROM joblevel WHERE id IN 17 | 18 | #{id} 19 | 20 | 21 | 22 | UPDATE joblevel 23 | 24 | 25 | name=#{jobLevel.name}, 26 | 27 | 28 | titleLevel=#{jobLevel.titleLevel}, 29 | 30 | 31 | WHERE id=#{jobLevel.id} 32 | 33 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/mapper/MenuMapper.java: -------------------------------------------------------------------------------- 1 | package org.horizon.mapper; 2 | 3 | import org.horizon.bean.Menu; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * Created by sang on 2017/12/28. 9 | */ 10 | public interface MenuMapper { 11 | List getAllMenu(); 12 | 13 | List getMenusByHrId(Long hrId); 14 | 15 | List menuTree(); 16 | 17 | List getMenusByRid(Long rid); 18 | } 19 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/mapper/MenuRoleMapper.java: -------------------------------------------------------------------------------- 1 | package org.horizon.mapper; 2 | 3 | import org.apache.ibatis.annotations.Param; 4 | 5 | /** 6 | * Created by sang on 2018/1/2. 7 | */ 8 | public interface MenuRoleMapper { 9 | int deleteMenuByRid(@Param("rid") Long rid); 10 | 11 | int addMenu(@Param("rid") Long rid, @Param("mids") Long[] mids); 12 | } 13 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/mapper/MenuRoleMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | DELETE FROM menu_role WHERE rid=#{rid} 8 | 9 | 10 | INSERT INTO menu_role(mid,rid) VALUES 11 | 12 | (#{mid},#{rid}) 13 | 14 | 15 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/mapper/PersonnelMapper.java: -------------------------------------------------------------------------------- 1 | package org.horizon.mapper; 2 | 3 | import org.apache.ibatis.annotations.Param; 4 | import org.horizon.bean.Personnel; 5 | 6 | import java.util.Date; 7 | import java.util.List; 8 | 9 | /** 10 | * Created by lzd on 2018/2/24. 11 | * 12 | */ 13 | public interface PersonnelMapper { 14 | 15 | List getPersonnelByPage(); 16 | 17 | /** 18 | * 删除 19 | * @param ids id 20 | * @return int 21 | */ 22 | int deletePersonnelById(@Param("ids") String[] ids); 23 | 24 | List getPersonnelByPages(@Param("start") Integer start, @Param("size") Integer size, @Param("keywords") String keywords, @Param("startBeginDate") Date startBeginDate, @Param("endBeginDate") Date endBeginDate); 25 | 26 | Long getCountByKeywords(@Param("keywords") String keywords, @Param("startBeginDate") Date startBeginDate, @Param("endBeginDate") Date endBeginDate); 27 | 28 | /** 29 | * 导出文件 30 | * @param start 31 | * @param size 32 | * @param keywords 33 | * @param startBeginDate 34 | * @param endBeginDate 35 | * @return 36 | */ 37 | List getPersonnelloyeeByPage(@Param("start") Integer start, @Param("size") Integer size, @Param("keywords") String keywords, @Param("startBeginDate") Date startBeginDate, @Param("endBeginDate") Date endBeginDate); 38 | 39 | 40 | /** 41 | * 添加 42 | * @return 43 | */ 44 | int addPersonnel(Personnel personnel); 45 | 46 | /** 47 | * 更新 48 | * @param personnel 49 | * @return 50 | */ 51 | int updatePersonnel(@Param("personnel") Personnel personnel); 52 | } 53 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/mapper/PositionMapper.java: -------------------------------------------------------------------------------- 1 | package org.horizon.mapper; 2 | 3 | import org.apache.ibatis.annotations.Param; 4 | import org.horizon.bean.Position; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Created by sang on 2018/1/10. 10 | */ 11 | public interface PositionMapper { 12 | 13 | int addPos(@Param("pos") Position pos); 14 | 15 | Position getPosByName(String name); 16 | 17 | List getAllPos(); 18 | 19 | int deletePosById(@Param("pids") String[] pids); 20 | 21 | int updatePosById(@Param("pos") Position position); 22 | } 23 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/mapper/PositionMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | INSERT INTO position set name=#{pos.name} 8 | 9 | 12 | 15 | 16 | DELETE FROM position WHERE id IN 17 | 18 | #{pid} 19 | 20 | 21 | 22 | UPDATE position set name=#{pos.name} WHERE id=#{pos.id} 23 | 24 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/mapper/RoleMapper.java: -------------------------------------------------------------------------------- 1 | package org.horizon.mapper; 2 | 3 | import org.apache.ibatis.annotations.Param; 4 | import org.horizon.bean.Role; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Created by sang on 2018/1/1. 10 | */ 11 | public interface RoleMapper { 12 | List roles(); 13 | 14 | int addNewRole(@Param("role") String role, @Param("roleZh") String roleZh); 15 | 16 | int deleteRoleById(Long rid); 17 | } 18 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/mapper/RoleMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 9 | 10 | INSERT INTO role set name=#{role},nameZh=#{roleZh} 11 | 12 | 13 | DELETE FROM role WHERE id=#{rid} 14 | 15 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/mapper/SalaryMapper.java: -------------------------------------------------------------------------------- 1 | package org.horizon.mapper; 2 | 3 | import org.apache.ibatis.annotations.Param; 4 | import org.horizon.bean.Salary; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Created by sang on 2018/1/24. 10 | */ 11 | public interface SalaryMapper { 12 | int addSalary(@Param("salary") Salary salary); 13 | 14 | List getAllSalary(); 15 | 16 | int updateSalary(@Param("salary") Salary salary); 17 | 18 | int deleteSalary(@Param("ids") String[] ids); 19 | 20 | int deleteSalaryByEid(@Param("eid") Long eid); 21 | 22 | int addSidAndEid(@Param("sid") Integer sid, @Param("eid") Long eid); 23 | } 24 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/mapper/StudentMapper.java: -------------------------------------------------------------------------------- 1 | package org.horizon.mapper; 2 | 3 | import org.apache.ibatis.annotations.Param; 4 | import org.horizon.bean.Student; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Created by thinkpad on 2018/2/24. 10 | */ 11 | public interface StudentMapper { 12 | List getAllStudents(@Param("start") int start, @Param("size") int size, @Param("keywords") String keywords); 13 | 14 | List getAllClass(); 15 | 16 | int addStudent(Student student); 17 | 18 | int updateStudent(Student student); 19 | 20 | int deleteStudentById(@Param("ids") String[] ids); 21 | 22 | Long getCount(@Param("keywords") String keywords); 23 | 24 | List getStusByPage(Object o, Object o1, String s, Object o2, Object o3, Object o4, Object o5, Object o6, Object o7, Object o8, Object o9); 25 | 26 | int addStudents(@Param("students") List students); 27 | } 28 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/mapper/SystemMapper.java: -------------------------------------------------------------------------------- 1 | package org.horizon.mapper; 2 | 3 | /** 4 | * Created by sang on 2017/12/29. 5 | */ 6 | public interface SystemMapper { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/service/DepartmentService.java: -------------------------------------------------------------------------------- 1 | package org.horizon.service; 2 | 3 | import org.horizon.bean.Department; 4 | import org.horizon.mapper.DepartmentMapper; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | import org.springframework.transaction.annotation.Transactional; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * Created by sang on 2018/1/7. 13 | */ 14 | @Service 15 | @Transactional 16 | public class DepartmentService { 17 | @Autowired 18 | DepartmentMapper departmentMapper; 19 | public int addDep(Department department) { 20 | department.setEnabled(true); 21 | departmentMapper.addDep(department); 22 | return department.getResult(); 23 | } 24 | 25 | public int deleteDep(Long did) { 26 | Department department = new Department(); 27 | department.setId(did); 28 | departmentMapper.deleteDep(department); 29 | return department.getResult(); 30 | } 31 | 32 | public List getDepByPid(Long pid) { 33 | return departmentMapper.getDepByPid(pid); 34 | } 35 | 36 | public List getAllDeps() { 37 | return departmentMapper.getAllDeps(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/service/HrService.java: -------------------------------------------------------------------------------- 1 | package org.horizon.service; 2 | 3 | import org.horizon.bean.Hr; 4 | import org.horizon.mapper.HrMapper; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.security.core.userdetails.UserDetails; 7 | import org.springframework.security.core.userdetails.UserDetailsService; 8 | import org.springframework.security.core.userdetails.UsernameNotFoundException; 9 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; 10 | import org.springframework.stereotype.Service; 11 | import org.springframework.transaction.annotation.Transactional; 12 | 13 | import java.util.List; 14 | 15 | /** 16 | * Created by sang on 2017/12/28. 17 | */ 18 | @Service 19 | @Transactional 20 | public class HrService implements UserDetailsService { 21 | 22 | @Autowired 23 | HrMapper hrMapper; 24 | 25 | @Override 26 | public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException { 27 | Hr hr = hrMapper.loadUserByUsername(s); 28 | if (hr == null) { 29 | throw new UsernameNotFoundException("用户名不对"); 30 | } 31 | return hr; 32 | } 33 | 34 | public int hrReg(String username, String password) { 35 | //如果用户名存在,返回错误 36 | if (hrMapper.loadUserByUsername(username) != null) { 37 | return -1; 38 | } 39 | BCryptPasswordEncoder encoder = new BCryptPasswordEncoder(); 40 | String encode = encoder.encode(password); 41 | return hrMapper.hrReg(username, encode); 42 | } 43 | 44 | public List
    getHrsByKeywords(String keywords) { 45 | return hrMapper.getHrsByKeywords(keywords); 46 | } 47 | 48 | public int updateHr(Hr hr) { 49 | return hrMapper.updateHr(hr); 50 | } 51 | 52 | public int updateHrRoles(Long hrId, Long[] rids) { 53 | int i = hrMapper.deleteRoleByHrId(hrId); 54 | return hrMapper.addRolesForHr(hrId, rids); 55 | } 56 | 57 | public Hr getHrById(Long hrId) { 58 | return hrMapper.getHrById(hrId); 59 | } 60 | 61 | public int deleteHr(Long hrId) { 62 | return hrMapper.deleteHr(hrId); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/service/JobLevelService.java: -------------------------------------------------------------------------------- 1 | package org.horizon.service; 2 | 3 | import org.horizon.bean.JobLevel; 4 | import org.horizon.mapper.JobLevelMapper; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | import org.springframework.transaction.annotation.Transactional; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * Created by sang on 2018/1/11. 13 | */ 14 | @Service 15 | @Transactional 16 | public class JobLevelService { 17 | @Autowired 18 | JobLevelMapper jobLevelMapper; 19 | 20 | public int addJobLevel(JobLevel jobLevel) { 21 | if (jobLevelMapper.getJobLevelByName(jobLevel.getName()) != null) { 22 | return -1; 23 | } 24 | return jobLevelMapper.addJobLevel(jobLevel); 25 | } 26 | 27 | public List getAllJobLevels() { 28 | return jobLevelMapper.getAllJobLevels(); 29 | } 30 | 31 | public boolean deleteJobLevelById(String ids) { 32 | String[] split = ids.split(","); 33 | return jobLevelMapper.deleteJobLevelById(split) == split.length; 34 | } 35 | 36 | public int updateJobLevel(JobLevel jobLevel) { 37 | return jobLevelMapper.updateJobLevel(jobLevel); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/service/MenuRoleService.java: -------------------------------------------------------------------------------- 1 | package org.horizon.service; 2 | 3 | import org.horizon.mapper.MenuRoleMapper; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.stereotype.Service; 6 | import org.springframework.transaction.annotation.Transactional; 7 | 8 | /** 9 | * Created by sang on 2018/1/2. 10 | */ 11 | @Service 12 | @Transactional 13 | public class MenuRoleService { 14 | @Autowired 15 | MenuRoleMapper menuRoleMapper; 16 | 17 | public int updateMenuRole(Long rid, Long[] mids) { 18 | menuRoleMapper.deleteMenuByRid(rid); 19 | if (mids.length == 0) { 20 | return 0; 21 | } 22 | return menuRoleMapper.addMenu(rid, mids); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/service/MenuService.java: -------------------------------------------------------------------------------- 1 | package org.horizon.service; 2 | 3 | import org.horizon.bean.Menu; 4 | import org.horizon.common.HrUtils; 5 | import org.horizon.mapper.MenuMapper; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | import org.springframework.transaction.annotation.Transactional; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * Created by sang on 2017/12/28. 14 | */ 15 | @Service 16 | @Transactional 17 | public class MenuService { 18 | @Autowired 19 | MenuMapper menuMapper; 20 | 21 | public List getAllMenu(){ 22 | return menuMapper.getAllMenu(); 23 | } 24 | 25 | public List getMenusByHrId() { 26 | return menuMapper.getMenusByHrId(HrUtils.getCurrentHr().getId()); 27 | } 28 | 29 | public List menuTree() { 30 | return menuMapper.menuTree(); 31 | } 32 | 33 | public List getMenusByRid(Long rid) { 34 | return menuMapper.getMenusByRid(rid); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/service/PositionService.java: -------------------------------------------------------------------------------- 1 | package org.horizon.service; 2 | 3 | import org.horizon.bean.Position; 4 | import org.horizon.mapper.PositionMapper; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | import org.springframework.transaction.annotation.Transactional; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * Created by sang on 2018/1/10. 13 | */ 14 | @Service 15 | @Transactional 16 | public class PositionService { 17 | @Autowired 18 | PositionMapper positionMapper; 19 | 20 | public int addPos(Position pos) { 21 | if (positionMapper.getPosByName(pos.getName()) != null) { 22 | return -1; 23 | } 24 | return positionMapper.addPos(pos); 25 | } 26 | 27 | public List getAllPos() { 28 | return positionMapper.getAllPos(); 29 | } 30 | 31 | public boolean deletePosById(String pids) { 32 | String[] split = pids.split(","); 33 | return positionMapper.deletePosById(split) == split.length; 34 | } 35 | 36 | public int updatePosById(Position position) { 37 | return positionMapper.updatePosById(position); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/service/RoleService.java: -------------------------------------------------------------------------------- 1 | package org.horizon.service; 2 | 3 | import org.horizon.bean.Role; 4 | import org.horizon.mapper.RoleMapper; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | import org.springframework.transaction.annotation.Transactional; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * Created by sang on 2018/1/1. 13 | */ 14 | @Service 15 | @Transactional 16 | public class RoleService { 17 | @Autowired 18 | RoleMapper roleMapper; 19 | 20 | public List roles() { 21 | return roleMapper.roles(); 22 | } 23 | 24 | public int addNewRole(String role, String roleZh) { 25 | if (!role.startsWith("ROLE_")) { 26 | role = "ROLE_" + role; 27 | } 28 | return roleMapper.addNewRole(role, roleZh); 29 | } 30 | 31 | public int deleteRoleById(Long rid) { 32 | return roleMapper.deleteRoleById(rid); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/service/SalaryService.java: -------------------------------------------------------------------------------- 1 | package org.horizon.service; 2 | 3 | import org.horizon.bean.Salary; 4 | import org.horizon.mapper.SalaryMapper; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | import org.springframework.transaction.annotation.Transactional; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * Created by sang on 2018/1/24. 13 | */ 14 | @Service 15 | @Transactional 16 | public class SalaryService { 17 | @Autowired 18 | SalaryMapper salaryMapper; 19 | public int addSalary(Salary salary) { 20 | return salaryMapper.addSalary(salary); 21 | } 22 | 23 | public List getAllSalary() { 24 | return salaryMapper.getAllSalary(); 25 | } 26 | 27 | public int updateSalary(Salary salary) { 28 | return salaryMapper.updateSalary(salary); 29 | } 30 | 31 | public int deleteSalary(String ids) { 32 | String[] split = ids.split(","); 33 | return salaryMapper.deleteSalary(split); 34 | } 35 | 36 | public int updateEmpSalary(Integer sid, Long eid) { 37 | salaryMapper.deleteSalaryByEid(eid); 38 | return salaryMapper.addSidAndEid(sid,eid); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /KGServer/src/main/java/org/horizon/service/SystemService.java: -------------------------------------------------------------------------------- 1 | package org.horizon.service; 2 | 3 | import org.horizon.mapper.SystemMapper; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.stereotype.Service; 6 | import org.springframework.transaction.annotation.Transactional; 7 | 8 | /** 9 | * Created by sang on 2017/12/29. 10 | */ 11 | @Service 12 | @Transactional 13 | public class SystemService { 14 | @Autowired 15 | SystemMapper systemMapper; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /KGServer/src/main/java/test.java: -------------------------------------------------------------------------------- 1 | ; 2 | 3 | public class test { 4 | 5 | public static void main(String[] args) { 6 | String s = "0 1"; 7 | System.out.println(s.charAt(0)); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /KGServer/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.type=com.alibaba.druid.pool.DruidDataSource 2 | spring.datasource.url=jdbc:mysql://127.0.0.1:3306/web?useUnicode=true&characterEncoding=UTF-8 3 | spring.datasource.username=root 4 | spring.datasource.password=password 5 | mybatis.config-location=classpath:/mybatis-config.xml 6 | 7 | server.port=8083 -------------------------------------------------------------------------------- /KGServer/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | demo.security.jwt: 2 | tokenExpirationTime: 15 # Number of minutes 3 | refreshTokenExpTime: 60 # Minutes 4 | tokenIssuer: http://svlada.com 5 | tokenSigningKey: xm8EV6Hy5RMFK4EEACIDAwQus -------------------------------------------------------------------------------- /KGServer/src/main/resources/ftl/email.ftl: -------------------------------------------------------------------------------- 1 |

    你好,${name}童鞋,欢迎加入XXX大家庭!您的入职信息如下:

    2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
    工号${workID}
    合同期限${contractTerm}年
    合同起始日期${beginContract?string("yyyy-MM-dd")}
    合同截至日期${endContract?string("yyyy-MM-dd")}
    所属部门${departmentName}
    职位${posName}
    10 |

    希望在未来的日子里,携手共进!

    -------------------------------------------------------------------------------- /KGServer/src/main/resources/hanlp.properties: -------------------------------------------------------------------------------- 1 | #本配置文件中的路径的根目录,根目录+其他路径=完整路径(支持相对路径,请参考:https://github.com/hankcs/HanLP/pull/254) 2 | #Windows用户请注意,路径分隔符统一使用/ 3 | root=F:/kbqa/KGServer 4 | 5 | #好了,以上为唯一需要修改的部分,以下配置项按需反注释编辑。 6 | 7 | #核心词典路径 8 | #CoreDictionaryPath=data/dictionary/CoreNatureDictionary.txt 9 | #2元语法词典路径 10 | #BiGramDictionaryPath=data/dictionary/CoreNatureDictionary.ngram.txt 11 | #停用词词典路径 12 | #CoreStopWordDictionaryPath=data/dictionary/stopwords.txt 13 | #同义词词典路径 14 | #CoreSynonymDictionaryDictionaryPath=data/dictionary/synonym/CoreSynonym.txt 15 | #人名词典路径 16 | #PersonDictionaryPath=data/dictionary/person/nr.txt 17 | #人名词典转移矩阵路径 18 | #PersonDictionaryTrPath=data/dictionary/person/nr.tr.txt 19 | #繁简词典根目录 20 | #tcDictionaryRoot=data/dictionary/tc 21 | #自定义词典路径,用;隔开多个自定义词典,空格开头表示在同一个目录,使用“文件名 词性”形式则表示这个词典的词性默认是该词性。优先级递减。 22 | #另外data/dictionary/custom/CustomDictionary.txt是个高质量的词库,请不要删除。所有词典统一使用UTF-8编码。 23 | CustomDictionaryPath=data/dictionary/custom/CustomDictionary.txt; type.txt; 医疗词汇.txt; 现代汉语补充词库.txt; 全国地名大全.txt ns; 人名词典.txt; 机构名词典.txt; 上海地名.txt ns;data/dictionary/person/nrf.txt nrf; 24 | #CustomDictionaryPath=data/dictionary/custom/CustomDictionary.txt;type.txt;医疗 25 | #HMM分词模型 26 | #HMMSegmentModelPath=data/model/segment/HMMSegmentModel.bin 27 | #分词结果是否展示词性 28 | #ShowTermNature=true 29 | #IO适配器,实现com.hankcs.hanlp.corpus.io.IIOAdapter接口以在不同的平台(Hadoop、Redis等)上运行HanLP 30 | #默认的IO适配器如下,该适配器是基于普通文件系统的。 31 | #IOAdapter=com.hankcs.hanlp.corpus.io.FileIOAdapter 32 | #感知机词法分析器 33 | #PerceptronCWSModelPath=data/model/perceptron/pku199801/cws.bin 34 | #PerceptronPOSModelPath=data/model/perceptron/pku199801/pos.bin 35 | #PerceptronNERModelPath=data/model/perceptron/pku199801/ner.bin 36 | #CRF词法分析器 37 | #CRFCWSModelPath=data/model/crf/pku199801/cws.txt 38 | #CRFPOSModelPath=data/model/crf/pku199801/pos.txt 39 | #CRFNERModelPath=data/model/crf/pku199801/ner.txt 40 | #更多配置项请参考 https://github.com/hankcs/HanLP/blob/master/src/main/java/com/hankcs/hanlp/HanLP.java#L59 自行添加 -------------------------------------------------------------------------------- /KGServer/src/main/resources/mybatis-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /KGServer/src/main/resources/static/index.html: -------------------------------------------------------------------------------- 1 | 微人事
    -------------------------------------------------------------------------------- /KGServer/src/main/resources/static/static/fonts/element-icons.6f0a763.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/src/main/resources/static/static/fonts/element-icons.6f0a763.ttf -------------------------------------------------------------------------------- /KGServer/src/main/resources/static/static/fonts/fontawesome-webfont.674f50d.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/src/main/resources/static/static/fonts/fontawesome-webfont.674f50d.eot -------------------------------------------------------------------------------- /KGServer/src/main/resources/static/static/fonts/fontawesome-webfont.af7ae50.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/src/main/resources/static/static/fonts/fontawesome-webfont.af7ae50.woff2 -------------------------------------------------------------------------------- /KGServer/src/main/resources/static/static/fonts/fontawesome-webfont.b06871f.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/src/main/resources/static/static/fonts/fontawesome-webfont.b06871f.ttf -------------------------------------------------------------------------------- /KGServer/src/main/resources/static/static/fonts/fontawesome-webfont.fee66e7.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGServer/src/main/resources/static/static/fonts/fontawesome-webfont.fee66e7.woff -------------------------------------------------------------------------------- /KGServer/src/main/resources/static/static/js/4.b25d67ddc90d6ac44980.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([4],{"4/RD":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={render:function(){this.$createElement;this._self._c;return this._m(0)},staticRenderFns:[function(){var e=this.$createElement,t=this._self._c||e;return t("div",[t("h1",[this._v("\n 综合信息统计\n ")])])}]},l=n("VU/8")(null,r,!1,null,null,null);t.default=l.exports},"97Ts":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={render:function(){this.$createElement;this._self._c;return this._m(0)},staticRenderFns:[function(){var e=this.$createElement,t=this._self._c||e;return t("div",[t("h1",[this._v("\n 人事信息统计\n ")])])}]},l=n("VU/8")(null,r,!1,null,null,null);t.default=l.exports},Tlrr:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={render:function(){this.$createElement;this._self._c;return this._m(0)},staticRenderFns:[function(){var e=this.$createElement,t=this._self._c||e;return t("div",[t("h1",[this._v("\n 人事记录统计\n ")])])}]},l=n("VU/8")(null,r,!1,null,null,null);t.default=l.exports},nCU1:function(e,t,n){var r={"./StaAll.vue":"4/RD","./StaPers.vue":"97Ts","./StaRecord.vue":"Tlrr","./StaScore.vue":"r3HF"};function l(e){return n(s(e))}function s(e){var t=r[e];if(!(t+1))throw new Error("Cannot find module '"+e+"'.");return t}l.keys=function(){return Object.keys(r)},l.resolve=s,e.exports=l,l.id="nCU1"},r3HF:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={render:function(){this.$createElement;this._self._c;return this._m(0)},staticRenderFns:[function(){var e=this.$createElement,t=this._self._c||e;return t("div",[t("h1",[this._v("\n 员工积分统计\n ")])])}]},l=n("VU/8")(null,r,!1,null,null,null);t.default=l.exports}}); 2 | //# sourceMappingURL=4.b25d67ddc90d6ac44980.js.map -------------------------------------------------------------------------------- /KGServer/src/main/resources/static/static/js/manifest.299d11d1ac656dd1152c.js: -------------------------------------------------------------------------------- 1 | !function(e){var n=window.webpackJsonp;window.webpackJsonp=function(r,c,a){for(var i,u,d,f=0,s=[];f 1%", "last 2 versions", "not ie <= 8"] 7 | } 8 | }], 9 | "stage-2" 10 | ], 11 | "plugins": ["transform-vue-jsx", "transform-runtime"] 12 | } 13 | -------------------------------------------------------------------------------- /KGWeb/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /KGWeb/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | /dist/ 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Editor directories and files 9 | .idea 10 | .vscode 11 | *.suo 12 | *.ntvs* 13 | *.njsproj 14 | *.sln 15 | -------------------------------------------------------------------------------- /KGWeb/.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | "plugins": { 5 | // to edit target browsers: use "browserslist" field in package.json 6 | "postcss-import": {}, 7 | "autoprefixer": {} 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /KGWeb/README.md: -------------------------------------------------------------------------------- 1 | # KGWeb 2 | 3 | > A Vue.js based project 4 | 5 | ## Build Setup 6 | 7 | ``` bash 8 | # install dependencies 9 | npm install 10 | 11 | # serve with hot reload at localhost:8080 12 | npm run dev 13 | 14 | # build for production with minification 15 | npm run build 16 | 17 | # build for production and view the bundle analyzer report 18 | npm run build --report 19 | -------------------------------------------------------------------------------- /KGWeb/build/build.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | require('./check-versions')() 3 | 4 | process.env.NODE_ENV = 'production' 5 | 6 | const ora = require('ora') 7 | const rm = require('rimraf') 8 | const path = require('path') 9 | const chalk = require('chalk') 10 | const webpack = require('webpack') 11 | const config = require('../config') 12 | const webpackConfig = require('./webpack.prod.conf') 13 | 14 | const spinner = ora('building for production...') 15 | spinner.start() 16 | 17 | rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { 18 | if (err) throw err 19 | webpack(webpackConfig, (err, stats) => { 20 | spinner.stop() 21 | if (err) throw err 22 | process.stdout.write(stats.toString({ 23 | colors: true, 24 | modules: false, 25 | children: false, // if you are using ts-loader, setting this to true will make tyescript errors show up during build 26 | chunks: false, 27 | chunkModules: false 28 | }) + '\n\n') 29 | 30 | if (stats.hasErrors()) { 31 | console.log(chalk.red(' Build failed with errors.\n')) 32 | process.exit(1) 33 | } 34 | 35 | console.log(chalk.cyan(' Build complete.\n')) 36 | console.log(chalk.yellow( 37 | ' Tip: built files are meant to be served over an HTTP server.\n' + 38 | ' Opening index.html over file:// won\'t work.\n' 39 | )) 40 | }) 41 | }) 42 | -------------------------------------------------------------------------------- /KGWeb/build/check-versions.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const chalk = require('chalk') 3 | const semver = require('semver') 4 | const packageConfig = require('../package.json') 5 | const shell = require('shelljs') 6 | 7 | function exec (cmd) { 8 | return require('child_process').execSync(cmd).toString().trim() 9 | } 10 | 11 | const versionRequirements = [ 12 | { 13 | name: 'node', 14 | currentVersion: semver.clean(process.version), 15 | versionRequirement: packageConfig.engines.node 16 | } 17 | ] 18 | 19 | if (shell.which('npm')) { 20 | versionRequirements.push({ 21 | name: 'npm', 22 | currentVersion: exec('npm --version'), 23 | versionRequirement: packageConfig.engines.npm 24 | }) 25 | } 26 | 27 | module.exports = function () { 28 | const warnings = [] 29 | 30 | for (let i = 0; i < versionRequirements.length; i++) { 31 | const mod = versionRequirements[i] 32 | 33 | if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) { 34 | warnings.push(mod.name + ': ' + 35 | chalk.red(mod.currentVersion) + ' should be ' + 36 | chalk.green(mod.versionRequirement) 37 | ) 38 | } 39 | } 40 | 41 | if (warnings.length) { 42 | console.log('') 43 | console.log(chalk.yellow('To use this template, you must update following to modules:')) 44 | console.log() 45 | 46 | for (let i = 0; i < warnings.length; i++) { 47 | const warning = warnings[i] 48 | console.log(' ' + warning) 49 | } 50 | 51 | console.log() 52 | process.exit(1) 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /KGWeb/build/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGWeb/build/logo.png -------------------------------------------------------------------------------- /KGWeb/build/vue-loader.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const utils = require('./utils') 3 | const config = require('../config') 4 | const isProduction = process.env.NODE_ENV === 'production' 5 | const sourceMapEnabled = isProduction 6 | ? config.build.productionSourceMap 7 | : config.dev.cssSourceMap 8 | 9 | module.exports = { 10 | loaders: utils.cssLoaders({ 11 | sourceMap: sourceMapEnabled, 12 | extract: isProduction 13 | }), 14 | cssSourceMap: sourceMapEnabled, 15 | cacheBusting: config.dev.cacheBusting, 16 | transformToRequire: { 17 | video: ['src', 'poster'], 18 | source: 'src', 19 | img: 'src', 20 | image: 'xlink:href' 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /KGWeb/build/webpack.base.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | const utils = require('./utils') 4 | const config = require('../config') 5 | const vueLoaderConfig = require('./vue-loader.conf') 6 | 7 | function resolve (dir) { 8 | return path.join(__dirname, '..', dir) 9 | } 10 | 11 | 12 | 13 | module.exports = { 14 | context: path.resolve(__dirname, '../'), 15 | entry: { 16 | app: './src/main.js' 17 | }, 18 | output: { 19 | path: config.build.assetsRoot, 20 | filename: '[name].js', 21 | publicPath: process.env.NODE_ENV === 'production' 22 | ? config.build.assetsPublicPath 23 | : config.dev.assetsPublicPath 24 | }, 25 | resolve: { 26 | extensions: ['.js', '.vue', '.json'], 27 | alias: { 28 | 'vue$': 'vue/dist/vue.esm.js', 29 | '@': resolve('src'), 30 | } 31 | }, 32 | module: { 33 | rules: [ 34 | { 35 | test: /\.vue$/, 36 | loader: 'vue-loader', 37 | options: vueLoaderConfig 38 | }, 39 | { 40 | test: /\.js$/, 41 | loader: 'babel-loader', 42 | include: [resolve('src'), resolve('test')] 43 | }, 44 | { 45 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, 46 | loader: 'url-loader', 47 | options: { 48 | limit: 10000, 49 | name: utils.assetsPath('img/[name].[hash:7].[ext]') 50 | } 51 | }, 52 | { 53 | test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/, 54 | loader: 'url-loader', 55 | options: { 56 | limit: 10000, 57 | name: utils.assetsPath('media/[name].[hash:7].[ext]') 58 | } 59 | }, 60 | { 61 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, 62 | loader: 'url-loader', 63 | options: { 64 | limit: 10000, 65 | name: utils.assetsPath('fonts/[name].[hash:7].[ext]') 66 | } 67 | } 68 | ] 69 | }, 70 | node: { 71 | // prevent webpack from injecting useless setImmediate polyfill because Vue 72 | // source contains it (although only uses it if it's native). 73 | setImmediate: false, 74 | // prevent webpack from injecting mocks to Node native modules 75 | // that does not make sense for the client 76 | dgram: 'empty', 77 | fs: 'empty', 78 | net: 'empty', 79 | tls: 'empty', 80 | child_process: 'empty' 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /KGWeb/config/dev.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const merge = require('webpack-merge') 3 | const prodEnv = require('./prod.env') 4 | 5 | module.exports = merge(prodEnv, { 6 | NODE_ENV: '"development"' 7 | }) 8 | -------------------------------------------------------------------------------- /KGWeb/config/prod.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = { 3 | NODE_ENV: '"production"' 4 | } 5 | -------------------------------------------------------------------------------- /KGWeb/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 中文症状知识图谱 7 | 12 | 13 | 14 | 15 |
    16 |
    17 | 18 |
    19 | 20 | 21 | -------------------------------------------------------------------------------- /KGWeb/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vuehr", 3 | "version": "1.0.0", 4 | "description": "A Vue.js project", 5 | "author": "taos", 6 | "private": true, 7 | "scripts": { 8 | "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js", 9 | "start": "npm run dev", 10 | "build": "node build/build.js" 11 | }, 12 | "dependencies": { 13 | "axios": "^0.17.1", 14 | "d3": "^3.5.17", 15 | "element-ui": "^2.0.9", 16 | "font-awesome": "^4.7.0", 17 | "node-sass": "^4.9.2", 18 | "sass-loader": "^7.0.3", 19 | "vue": "^2.5.2", 20 | "vue-router": "^3.0.1", 21 | "vuex": "^3.0.1" 22 | }, 23 | "devDependencies": { 24 | "autoprefixer": "^7.1.2", 25 | "babel-core": "^6.22.1", 26 | "babel-helper-vue-jsx-merge-props": "^2.0.3", 27 | "babel-loader": "^7.1.1", 28 | "babel-plugin-syntax-jsx": "^6.18.0", 29 | "babel-plugin-transform-runtime": "^6.22.0", 30 | "babel-plugin-transform-vue-jsx": "^3.5.0", 31 | "babel-preset-env": "^1.3.2", 32 | "babel-preset-stage-2": "^6.22.0", 33 | "chalk": "^2.0.1", 34 | "copy-webpack-plugin": "^4.0.1", 35 | "css-loader": "^0.28.0", 36 | "extract-text-webpack-plugin": "^3.0.0", 37 | "file-loader": "^1.1.4", 38 | "friendly-errors-webpack-plugin": "^1.6.1", 39 | "html-webpack-plugin": "^2.30.1", 40 | "node-notifier": "^5.1.2", 41 | "optimize-css-assets-webpack-plugin": "^3.2.0", 42 | "ora": "^1.2.0", 43 | "portfinder": "^1.0.13", 44 | "postcss-import": "^11.0.0", 45 | "postcss-loader": "^2.0.8", 46 | "rimraf": "^2.6.0", 47 | "semver": "^5.3.0", 48 | "shelljs": "^0.7.6", 49 | "uglifyjs-webpack-plugin": "^1.1.1", 50 | "url-loader": "^0.5.8", 51 | "vue-loader": "^13.3.0", 52 | "vue-style-loader": "^3.0.1", 53 | "vue-template-compiler": "^2.5.2", 54 | "webpack": "^3.6.0", 55 | "webpack-bundle-analyzer": "^2.9.0", 56 | "webpack-dev-server": "^2.9.1", 57 | "webpack-merge": "^4.1.0" 58 | }, 59 | "engines": { 60 | "node": ">= 4.0.0", 61 | "npm": ">= 3.0.0" 62 | }, 63 | "browserslist": [ 64 | "> 1%", 65 | "last 2 versions", 66 | "not ie <= 8" 67 | ] 68 | } 69 | -------------------------------------------------------------------------------- /KGWeb/src/App.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | 13 | 25 | -------------------------------------------------------------------------------- /KGWeb/src/components/111.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGWeb/src/components/111.jpg -------------------------------------------------------------------------------- /KGWeb/src/components/emp/AEmpBasic.vue: -------------------------------------------------------------------------------- 1 | 13 | -------------------------------------------------------------------------------- /KGWeb/src/components/emp/EmpAdv.vue: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /KGWeb/src/components/emp/EmpBasic_n.vue: -------------------------------------------------------------------------------- 1 | 24 | 25 | 57 | 58 | -------------------------------------------------------------------------------- /KGWeb/src/components/personnel/PerEmp.vue: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /KGWeb/src/components/personnel/PerMv.vue: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /KGWeb/src/components/salary/SalMonth.vue: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /KGWeb/src/components/salary/SalSearch.vue: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /KGWeb/src/components/salary/SalTable.vue: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /KGWeb/src/components/save.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGWeb/src/components/save.jpg -------------------------------------------------------------------------------- /KGWeb/src/components/statistics/StaAll.vue: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /KGWeb/src/components/statistics/StaPers.vue: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /KGWeb/src/components/statistics/StaRecord.vue: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /KGWeb/src/components/statistics/StaScore.vue: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /KGWeb/src/components/system/SysBasic.vue: -------------------------------------------------------------------------------- 1 | 22 | 44 | -------------------------------------------------------------------------------- /KGWeb/src/components/system/SysCfg.vue: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /KGWeb/src/components/system/SysData.vue: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /KGWeb/src/components/system/SysInit.vue: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /KGWeb/src/components/system/SysLog.vue: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /KGWeb/src/components/system/basic/ECMana.vue: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /KGWeb/src/components/system/basic/JobTitleMana.vue: -------------------------------------------------------------------------------- 1 | 6 | 9 | -------------------------------------------------------------------------------- /KGWeb/src/main.js: -------------------------------------------------------------------------------- 1 | // The Vue build version to load with the `import` command 2 | // (runtime-only or standalone) has been set in webpack.base.conf with an alias. 3 | import Vue from 'vue' 4 | import App from './App' 5 | import router from './router' 6 | import ElementUI from 'element-ui' 7 | import 'element-ui/lib/theme-chalk/index.css' 8 | import store from './store' 9 | import {getRequest} from './utils/api' 10 | import {postRequest} from './utils/api' 11 | import {deleteRequest} from './utils/api' 12 | import {putRequest} from './utils/api' 13 | import {initMenu} from './utils/utils' 14 | import {isNotNullORBlank} from './utils/utils' 15 | import './utils/filter_utils' 16 | import 'font-awesome/css/font-awesome.min.css' 17 | 18 | Vue.config.productionTip = false 19 | Vue.use(ElementUI) 20 | 21 | Vue.prototype.getRequest = getRequest; 22 | Vue.prototype.postRequest = postRequest; 23 | Vue.prototype.deleteRequest = deleteRequest; 24 | Vue.prototype.putRequest = putRequest; 25 | Vue.prototype.isNotNullORBlank = isNotNullORBlank; 26 | 27 | router.beforeEach((to, from, next)=> { 28 | if (to.name == 'Login') { 29 | next(); 30 | return; 31 | } 32 | var name = store.state.user.name; 33 | if (name == '未登录') { 34 | if (to.meta.requireAuth || to.name == null) { 35 | next({path: '/', query: {redirect: to.path}}) 36 | } else { 37 | next(); 38 | } 39 | } else { 40 | initMenu(router, store); 41 | next(); 42 | } 43 | } 44 | ) 45 | 46 | new Vue({ 47 | el: '#app', 48 | router, 49 | store, 50 | template: '', 51 | components: {App} 52 | }) 53 | -------------------------------------------------------------------------------- /KGWeb/src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Router from 'vue-router' 3 | import Login from '@/components/Login' 4 | import Home from '@/components/Home' 5 | // import EmpAdv from '@/components/emp/EmpAdv' 6 | // import EmpBasic from '@/components/emp/EmpBasic' 7 | // import PerEc from '@/components/personnel/PerEc' 8 | // import PerEmp from '@/components/personnel/PerEmp' 9 | // import PerMv from '@/components/personnel/PerMv' 10 | // import PerSalary from '@/components/personnel/PerSalary' 11 | // import PerTrain from '@/components/personnel/PerTrain' 12 | // import SalMonth from '@/components/salary/SalMonth' 13 | // import SalSearch from '@/components/salary/SalSearch' 14 | // import SalSob from '@/components/salary/SalSob' 15 | // import SalSobCfg from '@/components/salary/SalSobCfg' 16 | // import SalTable from '@/components/salary/SalTable' 17 | // import StaAll from '@/components/statistics/StaAll' 18 | // import StaPers from '@/components/statistics/StaPers' 19 | // import StaRecord from '@/components/statistics/StaRecord' 20 | // import StaScore from '@/components/statistics/StaScore' 21 | // import SysBasic from '@/components/system/SysBasic' 22 | // import SysCfg from '@/components/system/SysCfg' 23 | // import SysData from '@/components/system/SysData' 24 | // import SysHr from '@/components/system/SysHr' 25 | // import SysInit from '@/components/system/SysInit' 26 | // import SysLog from '@/components/system/SysLog' 27 | 28 | Vue.use(Router) 29 | 30 | export default new Router({ 31 | routes: [ 32 | { 33 | path: '/', 34 | name: 'Login', 35 | component: Login, 36 | hidden:true 37 | },{ 38 | path: '/home', 39 | name: '主页', 40 | component: Home, 41 | hidden:true, 42 | meta:{ 43 | requireAuth:true 44 | } 45 | } 46 | ] 47 | }) 48 | -------------------------------------------------------------------------------- /KGWeb/src/store/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Vuex from 'vuex' 3 | 4 | Vue.use(Vuex) 5 | 6 | export default new Vuex.Store({ 7 | state: { 8 | user: { 9 | name: window.localStorage.getItem('user' || '[]') == null ? '未登录' : JSON.parse(window.localStorage.getItem('user' || '[]')).name, 10 | userface: window.localStorage.getItem('user' || '[]') == null ? '' : JSON.parse(window.localStorage.getItem('user' || '[]')).userface 11 | }, 12 | token: "", 13 | routes: [] 14 | }, 15 | mutations: { 16 | initMenu(state, menus){ 17 | state.routes = menus; 18 | }, 19 | login(state, user){ 20 | state.user = user; 21 | window.localStorage.setItem('user', JSON.stringify(user)); 22 | }, 23 | logout(state){ 24 | window.localStorage.removeItem('user'); 25 | state.routes = []; 26 | }, 27 | token(state, token){ 28 | state.token = token; 29 | window.localStorage.setItem('token', token); 30 | } 31 | }, 32 | actions: { 33 | } 34 | }); 35 | -------------------------------------------------------------------------------- /KGWeb/src/utils/filter_utils.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | Vue.filter("formatDate", formatDate); 3 | Vue.prototype.formatDate = formatDate; 4 | function formatDate(value) { 5 | var date = new Date(value); 6 | var year = date.getFullYear(); 7 | var month = date.getMonth() + 1; 8 | var day = date.getDate(); 9 | if (month < 10) { 10 | month = "0" + month; 11 | } 12 | if (day < 10) { 13 | day = "0" + day; 14 | } 15 | return year + "-" + month + "-" + day; 16 | } 17 | Vue.filter("formatDateTime", function formatDateTime(value) { 18 | var date = new Date(value); 19 | var year = date.getFullYear(); 20 | var month = date.getMonth() + 1; 21 | var day = date.getDate(); 22 | var hours = date.getHours(); 23 | var minutes = date.getMinutes(); 24 | if (month < 10) { 25 | month = "0" + month; 26 | } 27 | if (day < 10) { 28 | day = "0" + day; 29 | } 30 | return year + "-" + month + "-" + day + " " + hours + ":" + minutes; 31 | }); 32 | 33 | -------------------------------------------------------------------------------- /KGWeb/src/utils/utils.js: -------------------------------------------------------------------------------- 1 | import {getRequest} from './api' 2 | import {Message} from 'element-ui' 3 | 4 | export const isNotNullORBlank = (...args)=> { 5 | for (var i = 0; i < args.length; i++) { 6 | var argument = args[i]; 7 | if (argument == null || argument == '' || argument == undefined) { 8 | Message.warning({message: '数据不能为空!'}) 9 | return false; 10 | } 11 | } 12 | return true; 13 | } 14 | export const initMenu = (router, store)=> { 15 | if (store.state.routes.length > 0) { 16 | return; 17 | } 18 | getRequest("/api/config/sysmenu").then(resp=> { 19 | if (resp && resp.status == 200) { 20 | var fmtRoutes = formatRoutes(resp.data); 21 | router.addRoutes(fmtRoutes); 22 | store.commit('initMenu', fmtRoutes); 23 | } 24 | }) 25 | } 26 | export const formatRoutes = (routes)=> { 27 | let fmRoutes = []; 28 | routes.forEach(router=> { 29 | let { 30 | path, 31 | component, 32 | name, 33 | meta, 34 | iconCls, 35 | children 36 | } = router; 37 | if (children && children instanceof Array) { 38 | children = formatRoutes(children); 39 | } 40 | let fmRouter = { 41 | path: path, 42 | component(resolve){ 43 | if (component.startsWith("Home")) { 44 | require(['../components/' + component + '.vue'], resolve) 45 | } else if (component.startsWith("Emp")) { 46 | // alert(component); 47 | require(['../components/emp/' + component + '.vue'], resolve) 48 | } else if (component.startsWith("Per")) { 49 | require(['../components/personnel/' + component + '.vue'], resolve) 50 | } else if (component.startsWith("Sal")) { 51 | require(['../components/salary/' + component + '.vue'], resolve) 52 | } else if (component.startsWith("Sta")) { 53 | require(['../components/statistics/' + component + '.vue'], resolve) 54 | } else if (component.startsWith("Sys")) { 55 | require(['../components/system/' + component + '.vue'], resolve) 56 | } 57 | }, 58 | name: name, 59 | iconCls: iconCls, 60 | meta: meta, 61 | children: children 62 | }; 63 | fmRoutes.push(fmRouter); 64 | }) 65 | return fmRoutes; 66 | } 67 | -------------------------------------------------------------------------------- /KGWeb/static/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuanninesuns/kbqa/60e4e4f7fe178f32428aefe326b4115cea13ec33/KGWeb/static/.gitkeep -------------------------------------------------------------------------------- /KGWeb/static/test.html: -------------------------------------------------------------------------------- 1 |

    Hello World!

    -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # kbqa,欢迎大家star,@tao2years tao2years是我们的共同开发者 2 | 基于知识图谱的中文症状问答系统,前端vue.js,后端springboot 3 | 开发语言是java,运行环境是windows 4 | 5 | 用到的技术:word2vec,doc2vec,编辑距离,词性标注,依存句法分析,scrapy,sparql 6 | 7 | 用到的工具:jena,Neo4j,Protégé,mysql,D2RQ,TDB,drools,Fuseki 8 | 9 | 涉及的知识:知识表示,知识建模,知识抽取,知识存储,知识融合,知识问答,知识推理,RDF 10 | 11 | 算法逻辑目录:kbqa/KGServer/src/main/java/NLP/ 12 | 13 | 图数据库处理目录:kbqa/KGServer/src/main/java/TDB/ 14 | 15 | **如果只想简单的做实验可以查看kbqa/KGServer目录** 16 | 17 | **如果想跑通整个项目,则需要安装Neo4j,mysql等第三方软件,且需要以下数据文件** 18 | 19 | 有data文件,放在KGServer/data下:https://pan.baidu.com/s/1QnKgE80pkmSxo4YtkFTqtA 20 | 21 | 爬虫相关数据和文件:https://pan.baidu.com/s/1kRP4GikB5QiBMd_oaelSJw 22 | 23 | !!!!!!更新!!!!!!! 24 | 25 | 由于百度网盘被屏蔽了 现更新数据地址 26 | 27 | 另有data文件,放在KGServer/data下:链接:https://pan.baidu.com/s/1Mo2zeqnjXL7_7xTjcwUlkg 28 | 提取码:rf0r 29 | 30 | 31 | 另有爬虫相关数据和文件:链接:https://pan.baidu.com/s/1GWv7S_HHOKk5hsoYLhKdrg 32 | 提取码:cle1 33 | 34 | 35 | 36 | --------------------------------------------------------------------------------