Coder Social home page Coder Social logo

rdflint's People

Contributors

foooomio avatar kiridaruma avatar takemikami avatar u-cauda-elongata avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rdflint's Issues

vscode-rdflint: Support rdflint-config.yml at custom (non-default) path

Present

Support rdflint-config.yml at default path only.

default path is following.

  • rdflint-config.yml,
  • .rdflint-config.yml
  • .rdflint/rdflint-config.yml
  • config/rdflint/rdflint-config.yml
  • .circleci/rdflint-config.yml

Better

Support rdflint-config.yml at custom path.

TODO:
Add custom configuration path to vscode settings.
and start language server with rdflint-config.yml at custom path.

Interactive Mode での DESCRIBE の実行

// execute query
try {
Query query = QueryFactory.create(line);
QueryExecution qe = QueryExecutionFactory.create(query, m);
ResultSet results = qe.execSelect();
ResultSetFormatter.out(System.out, results, query);
} catch (Exception ex) {

QueryExecution#execSelect() は DESCRIBE が実行できずにエラーが投げられます。

Query#getQueryType() でクエリタイプを取得して分岐し、 QueryExecution#execDescribe() を実行するのがいいかと思います(返り値も異なります)。

undefinedSubjectの設定で指定したURLが取得できないとき、RiotNotFoundExceptionで落ちる

validation/undefinedSubject[]/url で指定したURLからデータを取得できないときに
RiotNotFoundExceptionが発生して異常終了する。

設定例: rdflint-config.yml

validation:
  undefinedSubject:
    - url: https://www.w3.org/2002/07/owl
      startswith: http://www.w3.org/2002/07/owl#
      langtype: turtle

発生エラー:

Exception in thread "main" org.apache.jena.riot.RiotNotFoundException: Not found: https://www.w3.org/2002/07/owlx
	at org.apache.jena.riot.RDFParser.openTypedInputStream(RDFParser.java:394)
	at org.apache.jena.riot.RDFParser.parseURI(RDFParser.java:301)
	at org.apache.jena.riot.RDFParser.parse(RDFParser.java:295)
	at org.apache.jena.riot.RDFParser.parse(RDFParser.java:237)
	at org.apache.jena.riot.RDFParserBuilder.parse(RDFParserBuilder.java:518)
	at com.github.imas.rdflint.validator.impl.UndefinedSubjectValidator.loadSubjects(UndefinedSubjectValidator.java:89)
	at com.github.imas.rdflint.validator.impl.UndefinedSubjectValidator.setParameters(UndefinedSubjectValidator.java:79)
	at com.github.imas.rdflint.ValidationRunner.lambda$execute$2(ValidationRunner.java:70)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
	at com.github.imas.rdflint.ValidationRunner.execute(ValidationRunner.java:69)
	at com.github.imas.rdflint.RdfLint.lintRdfDataSet(RdfLint.java:223)
	at com.github.imas.rdflint.RdfLint.main(RdfLint.java:140)

add shacl comment to shacl violation message

現状のメッセージは汎用的な内容なので、
その制約がある背景なども分かるように、対応するShapeのコメントを出力するとわかりやすいと思われる。
(im@sparqlの場合、Shapeのrdfs:comment,rdfs:labelに説明があるので)

現状のメッセージの例

SHACLで定義された制約に違反しています: "Value has 2 shapes out of 2 in the sh:xone enumeration" (http://www.w3.org/ns/shacl#XoneConstraintComponent) (line: 37, col: 1, triple: https://sparql.crssnky.xyz/imasrdf/RDFs/detail/Amami_Haruka - http://xmlns.com/foaf/0.1/age - "-17"^^http://www.w3.org/2001/XMLSchema#integer)

対応するShape

imas-shape:IdolShape a sh:NodeShape;
    sh:targetClass imas:Idol;
    sh:property [
        rdfs:label "年齢の制約";
        rdfs:comment "何人かのアイドルは年齢が数値じゃない";
        sh:path foaf:age;
        sh:xone (
            [
                sh:datatype xsd:integer;
                sh:minInclusive 0;
            ]
            [
                sh:datatype rdf:langString;
                sh:languageIn ("ja")
            ]
        );
        sh:maxCount 1;
    ];

Unit_memberOfがうまく機能していない

手元に0.1.3を持ってきて、-config Unit_memberOf.ymlするとnoctchillのメンバーからの逆参照が生成されるが、GitHubActionsで動かしてる方は生成されていない(いつからうまく機能していないかはわからない)

SHACLのShapeに記述誤りがある場合にNullPointerExceptionが発生する

以下のようなケースでNullPointerExceptionとなるので、
Shapeの構文エラーであることがわかるようにしたい。

例: sh:pathとすべきところが、sh:passとなっている

imas-shape:IdolShape a sh:NodeShape;
    sh:targetClass imas:Idol;
    sh:property [
        rdfs:label "アイドルの登場するコンテンツのタイトルの制約";
        sh:pass imas:Title;
        sh:datatype rdf:langString;
        sh:minCount 1;
    ];

発生するエラー

Exception in thread "main" java.lang.NullPointerException
	at org.topbraid.shacl.validation.java.ClosedConstraintExecutor.<init>(ClosedConstraintExecutor.java:34)
	at org.topbraid.shacl.validation.java.JavaConstraintExecutors.lambda$static$2(JavaConstraintExecutors.java:20)
	at org.topbraid.shacl.validation.ConstraintExecutors.getExecutor(ConstraintExecutors.java:81)
	at org.topbraid.shacl.engine.Constraint.getExecutor(Constraint.java:98)
	at org.topbraid.shacl.validation.ValidationEngine.validateNodesAgainstConstraint(ValidationEngine.java:488)
	at org.topbraid.shacl.validation.ValidationEngine.validateAll(ValidationEngine.java:368)
	at org.topbraid.shacl.validation.ValidationUtil.validateModel(ValidationUtil.java:121)
	at org.topbraid.shacl.validation.ValidationUtil.validateModel(ValidationUtil.java:102)
	at com.github.imas.rdflint.validator.impl.ShaclValidator.prepareValidationResource(ShaclValidator.java:41)
	at com.github.imas.rdflint.ValidationRunner.lambda$execute$6(ValidationRunner.java:93)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
	at com.github.imas.rdflint.ValidationRunner.execute(ValidationRunner.java:92)
	at com.github.imas.rdflint.RdfLint.lintRdfDataSet(RdfLint.java:201)
	at com.github.imas.rdflint.RdfLint.main(RdfLint.java:116)

NullPointerException for invalid ttl file

Hi, maybe I am still confused what this linter is supposed to do, but I thought it would show me errors in ttl files. I just inserted an invalid ttl file to test and as a result I get a NullPointerException and there seems no way to actually find the incorrect ttl file in the log.

https://github.com/dbpedia/format-mappings/runs/554543342?check_suite_focus=true

Run rdflint
  rdflint
  shell: /bin/bash -e {0}
  env:
    JAVA_HOME: /opt/hostedtoolcache/jdk/11.0.6/x64
    JAVA_HOME_11.0.6_x64: /opt/hostedtoolcache/jdk/11.0.6/x64
Exception in thread "main" java.lang.NullPointerException
	at org.apache.jena.riot.system.RiotLib.isBNodeIRI(RiotLib.java:86)
	at org.apache.jena.riot.system.ParserProfileStd.createURI(ParserProfileStd.java:152)
	at org.apache.jena.riot.system.ParserProfileStd.create(ParserProfileStd.java:216)
	at org.apache.jena.riot.lang.LangTurtleBase.tokenAsNode(LangTurtleBase.java:498)
	at org.apache.jena.riot.lang.LangTurtleBase.node(LangTurtleBase.java:343)
	at org.apache.jena.riot.lang.LangTurtleBase.triples(LangTurtleBase.java:245)
	at org.apache.jena.riot.lang.LangTurtleBase.triplesSameSubject(LangTurtleBase.java:191)
	at org.apache.jena.riot.lang.LangTurtle.oneTopLevelElement(LangTurtle.java:46)
	at org.apache.jena.riot.lang.LangTurtleBase.runParser(LangTurtleBase.java:91)
	at org.apache.jena.riot.lang.LangBase.parse(LangBase.java:41)
	at org.apache.jena.riot.RDFParserRegistry$ReaderRIOTLang.read(RDFParserRegistry.java:191)
	at org.apache.jena.riot.RDFParser.read(RDFParser.java:352)
	at org.apache.jena.riot.RDFParser.parseURI(RDFParser.java:321)
	at org.apache.jena.riot.RDFParser.parse(RDFParser.java:295)
	at org.apache.jena.riot.RDFParser.parse(RDFParser.java:237)
	at com.github.imas.rdflint.validator.impl.RdfSyntaxValidator.validateFile(RdfSyntaxValidator.java:65)
	at com.github.imas.rdflint.ValidationRunner.lambda$null$4(ValidationRunner.java:77)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
	at com.github.imas.rdflint.ValidationRunner.lambda$execute$5(ValidationRunner.java:77)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)

vscode-rdflintに関連したWindows環境での不具合のシューティング

vscode-rdflintがmacOS上ではある程度動作しているが、
Windows環境ではかなり怪しい挙動が多いため。
このissueで見つけた不具合を列挙して、対処を進めていく。

不具合リスト(随時更新):

  • Interactive Modeの検証メッセージ日本語文字化け
    • 検証メッセージの出力をUTF-8に固定していたため、環境に合わせるよう変更
  • SHACLの指摘が一部抜けているような挙動がある(要調査)
    • 意図しない主語未定義エラーが大量に発生しており、処理が遅かっただけと思われる
  • LSPの起動時に設定ファイルの読み込みに失敗する場合がある (要調査)
    • 他のホスト上にファイルを置いている場合(¥¥host¥dir1¥dir2)、一旦制限とする
  • 意図しない主語未定義のエラーが多数発生する
    • サブディレクトリにある定義のprefix付与が出来ていない(パス区切り文字の違い)
  • generation実行時に NoClassDefFoundErrorエラー
    • thymeleaf-layout-dialectのbundleが必要

rdflintのverup時、導入しているrepositoryにrdflintをverupさせるPullRequestを自動で上げる仕組みの検討

rdflintの最新versionは以下で取得可能なので、circleciのcronjobとかで対応は可能と考えられる

$ curl -s https://jitpack.io/api/builds/com.github.imas/rdflint/latestOk | jq -r '.version'
0.0.9

see. https://jitpack.io/docs/API/#latest-build

導入しているリポジトリ側で対応して貰う想定で、
設定方法のドキュメント、スクリプト提供などを検討する。

Language Server Protocol の実装 (vscodeと連携した検証結果の表示)

Visual Studio Codeでの検証結果表示を想定した、
Language Server Protocol による検証処理の実装

イメージ

2019-12-21 21-42-37 2019-12-21 21_44_19

参考情報

Language Server Protocol
https://microsoft.github.io/language-server-protocol/

Language Server Extension Guide | Visual Studio Code
https://code.visualstudio.com/api/language-extensions/language-server-extension-guide

LSP4JでLanguage Server Protocol入門
https://qiita.com/minebreaker/items/c53e4dddb0709492d362

SHACL制約の与え方について

初めまして。有益なツールの提供をどうもありがとうございます。
ところで、SHACL制約の与え方について、ドキュメントを読んだ限りでは分かりませんでしたので、追加していただけますか?

検証ルール除外指定機能の実装(suppress機能)

データ型チェック・外れ値チェックは統計的に出しているので、必ず誤りと扱うことは出来ないので、除外設定できるようにしたい

使用する・しないvalidatorを指定もできるようにしたい

警告文で表示されるURIに `/undefined` という余計なパスが追加されてしまう

警告文で表示されるURIに /undefined というパスがくっついてしまいます.
baseUri の後ろに /undefined が入っているように感じます.

警告文の例

WARN  Undefined URI: https://prismdb.takanakahiko.me/undefined/prism-schema.ttl#member (triple: https://prismdb.takanakahiko.me/undefined/rdfs/team/tricolore - https://prismdb.takanakahiko.me/undefined/prism-schema.ttl#member - https://prismdb.takanakahiko.me/undefined/rdfs/character/midorikaze_fuwari)

この場合,例えば https://prismdb.takanakahiko.me/undefined/rdfs/team/tricolore は,本来は https://prismdb.takanakahiko.me/rdfs/team/tricolore です.

確認できる場所 : https://github.com/prickathon/prismdb/runs/251908036

設定ファイル「rdflint-config.yml」の探索パスの追加

rdflintの設定ファイルについて、
rdflint-config.yml以外にも、
generationのテンプレートなどが存在するケースがあるので、
標準的な配置ディレクトリを決め、rdflint-config.ymlの探索パスに加えたい。

現状の探索パス:

  • rdflint-config.yml
  • .rdflint-config.yml
  • .circleci/rdflint-config.yml

追加する探索パス:

  • config/rdflint/rdflint-config.yml
  • .rdflint/rdflint-config.yml

SHACL制約「Value must be an instance of」のエラーで指摘箇所が正しくない場合がある

SHACL制約「Value must be an instance of」のエラーで指摘箇所が正しくない場合がある。
実際にim@sparqlで発生した問題と、期待結果を示す。

発生エラーのCIリンク:
https://circleci.com/gh/imas/imasparql/231?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link

発生エラー:

RDFs/Clothes.rdf
  WARN  SHACL violation: (https://sparql.crssnky.xyz/imasrdf/RDFs/detail/Glory_Monochrome_Another2 @https://sparql.crssnky.xyz/imasrdf/URIs/imas-schema.ttl#Whose https://sparql.crssnky.xyz/imasrdf/RDFs/detail/Watanabe_Minori) "Value must be an instance of <https://sparql.crssnky.xyz/imasrdf/URIs/imas-schema.ttl#Idol>" (http://www.w3.org/ns/shacl#ClassConstraintComponent) (triple: https://sparql.crssnky.xyz/imasrdf/RDFs/detail/Glory_Monochrome_Another2 - https://sparql.crssnky.xyz/imasrdf/URIs/imas-schema.ttl#Whose - https://sparql.crssnky.xyz/imasrdf/RDFs/detail/Watanabe_Minori)

制約:

  • Glory_Monochrome_Another2(Clothe)のwhoseはIdolでなければならない

データの状態:

  • Glory_Monochrome_Another2 → whose → Watanabe_Minori
  • Glory_Monochrome_Another2 → whose → Akizuki_Ryo
  • Watanabe_MinoriはIdolとして定義
  • Akizuki_Ryoは未定義
  • Akizuki_Ryo_315, Akizuki_Ryo_876でIdolとして定義

発生しているエラー:

期待されるエラー:

インタラクティブモード補完機能、読み込んだ RDF 中のプレフィックスの補完

読み込んだ RDF 中のプレフィックスの補完
PREFIX_MAP を固定で持っていますが、読み込んだ RDF に記述されているプレフィックスも補完できるようになると更に便利になるなと思いました。

チラッと見てみたところ、loadRdfSet() で parse した Graph は、getPrefixMapping() を呼ぶことでプレフィックスを取れるようです。

see. #62 (comment)

Add statical check threshold to configuration

95% of following explanation.

Literal Value of Same predicate judge string, real number, integer or natual number.
Data type of 95% over data is valid type of prediate.

3 of following explanation.

when a distance between last combined cluster is less 3times of before combined distance, jedge is ok.

WSL版のvscodeにて、spawn ENOTDIRエラー

[Error - 12:30:00 AM] Starting client failed
Error: spawn ENOTDIR
	at ChildProcess.spawn (internal/child_process.js:407:11)
	at Object.spawn (child_process.js:548:9)
	at /home/<UserName>/.vscode-server/extensions/takemikami.vscode-rdflint-0.1.4/node_modules/vscode-languageclient/lib/main.js:354:40

(Linuxユーザー名はに変更しています)

また、関係があるかは不明ですが、インタラクティブモードをCtrl+Shift+Pから起動しようとすると

ターミナル プロセス "/usr/lib/jvm/java-11-openjdk-amd64/bin/java/bin/java '-jar', '/home/<UserName>/.vscode-server/extensions/takemikami.vscode-rdflint-0.1.4/rdflint-0.1.4.jar', '-i'" が起動に失敗しました (終了コード: 1)。

と、vscodeのデスクトップ通知が出て起動しません。
(自前でjava -jar <rdflintのパス> -iをTerminalで打つと起動します)

Getting internal error in vscode extension

Hello,
I get an internal error whilst using the extension, but I can not find any log/description of the issue. No syntax highlight is seem.
Could anyone help?
Thank you very much

schema.org等の未定義主語チェックは「baseUri」を指定していなくてもチェックすべき

現状、設定ファイルに「baseUri」を指定していない場合は、
未定義主語のチェックを行わない仕様となっている。
(baseUriで始まるURIが、データセット内に定義されているべきと言う前提で、未定義主語チェックが走る)

#65 で加えたschema.org等の一般的なスキーマの場合は、定義範囲の前提が不要なので、
schema.org等の未定義主語チェックは、baseUriを指定していなくてもチェックすべきと考えられる。

Java11を利用した際にWARNINGが発生

rdflint で使用している Groovy 2.5.4 を Java 11 で動かすと発生する WARNING のようですね?

これかな。3.0.0-beta-1 で直ってるみたいですけど最新版が未だ 3.0.0-rc-3 ですね・・・
https://issues.apache.org/jira/browse/GROOVY-8339

Run rdflint -config .rdflint/rdflint-config.yml
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 (file:/opt/hostedtoolcache/rdflint/0.1.2/x64/rdflint.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v7.Java7$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

パス関連のコマンドラインパラメータ・設定ファイル項目の整理

パス関連のコマンドラインパラメータ・設定ファイル項目を整理したい。
im@sparqlのパスを前提に開発をしてきたので、
データセットがリポジトリ直下に無い場合の挙動が分かりにくい。

リポジトリの例:

(im@sparqlなどの場合)

  • リポジトリルート=データセットの格納先 (<- targetdir)
    • 設定ファイルのパス (<- config)

(prismdbなどの場合)

  • リポジトリルート (<- ?)
    • データセットの格納先 (<- targetdir)
    • 設定ファイルのパス (<- config)

コマンドラインのパラメータにリポジトリルートを指定出来るようにして、
cdで移動して実行した場合と、パラメータで指定した場合
それぞれの挙動を一致させるのが好ましいと考えている。

cd リポジトリルート
java -jar rdflint-0.0.9-all.jar
java -jar rdflint-0.0.9-all.jar -パス指定 リポジトリルート

generationの名称指定実行機能の実装

generation処理のみ(generation処理の一部のみも)を実行できるように実行パラメータを追加する

背景として、
imasparqlではgenerationのみをおこなうために、複数の設定を作っているため、
その複雑さを解消したい。

DataTypeValidator で decimal な値が NATURAL として扱われる場合がある

BASE <http://example.com/>
PREFIX : <http://schema.org/>

<a> :height 160.0 .
<b> :height 160.0 .
<c> :height 160.0 .
<d> :height 160.0 .
<e> :height 160.0 .
<f> :height 160.0 .
<g> :height 160.0 .
<h> :height 160.0 .
<i> :height 160.0 .
<j> :height 160.0 .
<k> :height 160.0 .
<l> :height 160.0 .
<m> :height 160.0 .
<n> :height 160.0 .
<o> :height 160.0 .
<p> :height 160.0 .
<q> :height 160.0 .
<r> :height 160.0 .
<s> :height 160.0 .
<t> :height 160.0 .
<u> :height 160.0 .
<v> :height 160.0 .
<w> :height 160.0 .
<x> :height 160.0 .
<y> :height 160.0 .
<z> :height 160.0 .
<error> :height 160.1 .
$ rdflint
example.ttl
  INFO  データ型が揃っていません: NATURALが予測されましたがFLOATです (triple: http://example.com/error - http://schema.org/height - "160.1"^^http://www.w3.org/2001/XMLSchema#decimal)

Expected Behavior: 160.0 のような値が FLOAT として扱われること。

Recommend Projects

  • React photo React

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

  • Vue.js photo Vue.js

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

  • Typescript photo Typescript

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

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

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

Recommend Topics

  • javascript

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

  • web

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

  • server

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

  • Machine learning

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

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

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

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.