
Product
Introducing Scala and Kotlin Support in Socket
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
shaclc-parse
Advanced tools
A parser for files written with SHACL compact syntax
import { parse } from 'shaclc-parse'
const quads = parse(`
PREFIX ex: <http://example.org/test#>
shape ex:TestShape -> ex:TestClass1 ex:TestClass2 {
targetNode=ex:TestNode targetSubjectsOf=ex:subjectProperty targetObjectsOf=ex:objectProperty .
}
`, { baseIRI: "http://example.org/basic-shape-with-targets" })
The SHACL Compact Syntax specification is not expressive enough to
make any RDF 1.0 statement. This package includes an opt-in extended syntax that allows users to make any RDF 1.0 statement. Parsing of this extended syntax can be enabled via an option in the parse
function
const quads = parse(/*shaclc extended string*/, { extendedSyntax: true })
NodeShape
Additional statements can be made about NodeShapes by using a turtle-like syntax before the body of the shape. For instance we can add the following statements to the above ex:TestShape
.
ex:TestShape ex:myCustomAnnotation ex:myCustomValue ;
ex:myCustomBlankNodeAnnotation [
ex:myCustomList ( 1 ex:myCustomValue )
] .
by doing the following:
shape ex:TestShape -> ex:TestClass1 ex:TestClass2 ;
ex:myCustomAnnotation ex:myCustomValue ;
ex:myCustomBlankNodeAnnotation [
ex:myCustomList ( 1 ex:myCustomValue )
] {
targetNode=ex:TestNode targetSubjectsOf=ex:subjectProperty targetObjectsOf=ex:objectProperty .
}
sh:property
additional statements can be made about each blank node property as follows:
shape ex:TestShape -> ex:TestClass1 ex:TestClass2 {
ex:myPath [0..1] %
ex:myCustomPropertyAnnotation ex:myCustomPropertyValue ;
ex:myCustomPropertyAnnotation2 ex:myCustomPropertyValue2 ;
% .
}
Finally we permit the use of turtle syntax at the end of the file to make any additional statements
shape ex:TestShape -> ex:TestClass1 ex:TestClass2 {
targetNode=ex:TestNode targetSubjectsOf=ex:subjectProperty targetObjectsOf=ex:objectProperty .
}
ex:bob a ex:Person .
©2022–present Jesse Wright, MIT License.
FAQs
A parser for files written with SHACL compact syntax
The npm package shaclc-parse receives a total of 4,702 weekly downloads. As such, shaclc-parse popularity was classified as popular.
We found that shaclc-parse demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
Application Security
/Security News
Socket CEO Feross Aboukhadijeh and a16z partner Joel de la Garza discuss vibe coding, AI-driven software development, and how the rise of LLMs, despite their risks, still points toward a more secure and innovative future.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.