Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
rdf-isomorphic
Advanced tools
Determines if two RDF graphs are isomorphic, i.e., if two RDF graphs are equal while ignoring quad order and ignoring non-equal blank node labels between the graphs.
This package is can be useful within unit/spec tests.
This library accepts RDFJS-compliant quads.
The following examples assume the following imports:
import { DataFactory } from "rdf-data-factory"; // External library
import { isomorphic } from "rdf-isomorphic";
const factory = new DataFactory();
const graphA = [
factory.quad(
factory.blankNode('s1'),
factory.namedNode('p'),
factory.blankNode('o1'),
),
];
const graphB = [
factory.quad(
factory.blankNode('s2'),
factory.namedNode('p'),
factory.blankNode('o2'),
),
];
isomorphic(graphA, graphB); // Outputs true
const graphA = [
factory.quad(
factory.blankNode('s1'),
factory.namedNode('p1'),
factory.blankNode('o1'),
),
];
const graphB = [
factory.quad(
factory.blankNode('s2'),
factory.namedNode('p2'),
factory.blankNode('o2'),
),
];
isomorphic(graphA, graphB); // Outputs false
const graphA = [
factory.quad(
factory.quad(
factory.blankNode('sInner'),
factory.namedNode('pInner'),
factory.blankNode('o1'),
),
factory.namedNode('pOuter'),
factory.namedNode('oOuter'),
)
];
const graphB = [
factory.quad(
factory.quad(
factory.blankNode('sInner'),
factory.namedNode('pInner'),
factory.blankNode('o2'),
),
factory.namedNode('pOuter'),
factory.namedNode('oOuter'),
)
];
isomorphic(graphA, graphB); // Outputs true
This algorithm is based on the RDF isomorphism checker in RDF.rb, which in its turn is based on the algorithm described by Jeremy Carrol.
In summary, the algorithm generates a hash for each blank node based on the connected resources. These hashes are then compared between the two given graphs, and a bijection is attempted to be created. If no such bijection can be found, then the graphs are considered non-isomorphic.
The implementation of this package is inspired by the Ruby RDF::Isomorphic gem.
The algorithm has been adapted to work this nested quads by Ruben Taelman.
This software is written by Ruben Taelman.
This code is released under the MIT license.
FAQs
Determines if two RDF graphs are isomorphic
The npm package rdf-isomorphic receives a total of 7,024 weekly downloads. As such, rdf-isomorphic popularity was classified as popular.
We found that rdf-isomorphic demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.