Skip to content

Extract a graph from a model or a repository #2764

@hmottestad

Description

@hmottestad

Summary

Essentially a kind of custom describe function where the user provides a node and the algorithm follows any outbound links. For each link the user would get to decide on if that link should be followed or not.

Algorithms

  • depth first (less memory)
  • breadth first (eaiser to batch or run in parallel)

Example

@prefix ex: <http://example.com/ns#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

ex:report1 a sh:ValidationReport;
  sh:conforms false;
  <http://rdf4j.org/schema/rdf4j#truncated> false;
  sh:result [ a sh:ValidationResult;
      sh:focusNode ex:bigCo;
      sh:value ex:bigCo;
      sh:sourceConstraintComponent sh:NotConstraintComponent;
      sh:resultSeverity sh:Violation;
      sh:sourceShape ex:PersonShape
    ] .

ex:PersonShape a sh:NodeShape;
  sh:targetClass ex:Company;
  sh:not [ a sh:PropertyShape;
      sh:path rdfs:label;
      sh:uniqueLang true
    ] .

If the user specifies the following:

  • Start on ex:report1
  • For sh:sourceShape include the link but don't traverse it
  • Exclude the namespace http://rdf4j.org/schema/rdf4j#

Result

ex:report1 a sh:ValidationReport;
  sh:conforms false;
  sh:result [ a sh:ValidationResult;
      sh:focusNode ex:bigCo;
      sh:value ex:bigCo;
      sh:sourceConstraintComponent sh:NotConstraintComponent;
      sh:resultSeverity sh:Violation;
      sh:sourceShape ex:PersonShape
    ] .

Things to consider

  • How much memory should we use?
  • Network latency if we connect to a remote repo
  • Will running it in parallel make it faster?

Metadata

Metadata

Assignees

No one assigned

    Labels

    📶 enhancementissue is a new feature or improvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions