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.
@rdfjs/score
Advanced tools
Scores RDF/JS terms inside a dataset
npm install @rdfjs/score --save
This package provides a factory that can be used with @rdfjs/environment
.
import DataFactory from '@rdfjs/environment/DataFactory.js'
import DatasetFactory from '@rdfjs/environment/DatasetFactory.js'
import Environment from '@rdfjs/environment'
import ScoreFactory from '@rdfjs/score/Factory.js'
const env = new Environment([DataFactory, DatasetFactory, ScoreFactory])
Combines the result of multiple score functions of the same term into a single result and calculates the average score.
import combine from '@rdfjs/score/combine.js'
const results = combine([score1, score2])(ptrs)
Combines the result of multiple score functions of the same term into a single result. The new score is a combined value of the results of all score functions for the same term. Priorities are used where the first function has the highest priority and the last one the lowest.
import combine from '@rdfjs/score/combine.js'
const results = combine.prioritized([score1, score2])(ptrs)
Concatenates the results of multiple score functions.
import concat from '@rdfjs/score/concat.js'
const results = concat([score1, score2])(ptrs)
Scores all given terms based on their occurrence.
The parts of the triple that should be taken into account must be given as boolean true
.
By default, only the subject is taken into account.
import count from '@rdfjs/score/count.js'
const results = count()(ptrs)
Reduces the list of results to unique terms. The highest score for each term is used.
import distinct from '@rdfjs/score/distinct.js'
const results = distinct(results)
Scores a quad with 1, if one of the given parts matches. At least one part must be given.
import exists from '@rdfjs/score/exists.js'
const results = exists({ subject: ns.ex.resource })(ptrs)
Calls one score function after another until a score function returns a result that is not empty.
import fallback from '@rdfjs/score/fallback.js'
const results = fallback([score1, score2])(ptrs)
Scores the term that matches the given term with 1.
import fixed from '@rdfjs/score/fixed.js'
const results = fixed(ns.ex.resource)(ptrs)
Score language literals based on the order of the given languages.
The *
wildcard can be used to match any language.
import language from '@rdfjs/score/language.js'
const results = language(['en', 'de', '*'])(ptrs)
Scores the given terms with the PageRank algorithm. Edges are only processed subject to object direction.
import pageRank from '@rdfjs/score/pageRank.js'
const results = pageRank()(ptrs)
Scores the given terms by the level of the path. Shorter path depths get scored better than deeper ones.
import pathDepth from '@rdfjs/score/pathDepth.js'
const results = pathDepth()(ptrs)
Runs all score functions of the given list and prioritizes the score based on the position of the score function in the array. Priorities are used where the first function has the highest priority and the last one the lowest.
import prioritized from '@rdfjs/score/prioritized.js'
const results = prioritized([score1, score2])(ptrs)
Runs all score functions of the given list, combines the results with the same term, and scores it with the product of the individual results.
import product from '@rdfjs/score/product.js'
const results = product()(ptrs)
Calls the given score function and multiplies the score of the results with the given factor.
import scale from '@rdfjs/score/scale.js'
const results = scale()(ptrs)
Sorts the given results descending by score (best matches first).
import sort from '@rdfjs/score/sort.js'
const sortedResults = sort(results)
Scores and sorts the given objects, which must have a term attached.
The dataset must be given as an argument.
Optional a termCallback
function can be given that extracts the term from the object.
By default, the term is expected as a property named term
.
import sortObjects from '@rdfjs/score/sortObjects.js'
const sortedObjects = sortObjects({
dataset,
objects,
score,
termCallback: object => object.ptr.term
})
Runs all score functions of the given list, combines the results with the same term, and scores it with the sum of the individual results.
import sum from '@rdfjs/score/sum.js'
const results = sum([score1, score2])(ptrs)
Scores all terms that are subjects of a resource with the given type with 1.
import type from '@rdfjs/score/type.js'
const results = type(ns.schema.Person)(ptrs)
FAQs
Scores RDF/JS terms inside a dataset
We found that @rdfjs/score 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.
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.