Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@tpluscode/sparql-builder
Advanced tools
Changelog
2.0.2
*Executable
typesReadme
@tpluscode/sparql-builder
Simple library to create SPARQL queries with tagged ES Template Strings
@zazuko/prefixes
npm i -S @tpluscode/sparql-builder
To be able to execute queries against a remote endpoint install a peer dependency:
npm i -S sparql-http-client
import rdf from '@zazuko/env'
import { SELECT } from '@tpluscode/sparql-builder'
const ex = rdf.namespace('http://example.com/')
const { foaf } = rdf.ns
/*
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?person ?name
FROM <http://example.com/People>
WHERE
{
?person a foaf:Person ;
foaf:name ?name .
}
*/
const person = rdf.variable('person')
const query =
SELECT`${person} ?name`
.FROM(ex.People)
.WHERE`
${person} a ${foaf.Person} ;
${foaf.name} ?name .
`.build()
Using sparql-http-client
import rdf from '@zazuko/env'
import SparqlHttp from 'sparql-http-client'
import { ASK } from '@tpluscode/sparql-builder'
const { dbo } = rdf.ns
const dbr = rdf.namespace('http://dbpedia.org/resource/')
const client = new SparqlHttp({
factory: rdf,
endpointUrl: 'http://dbpedia.org/sparql',
})
const scoobyDoo = dbr('Scooby-Doo')
/*
PREFIX dbo: <http://dbpedia.org/ontology/>
ASK {
<http://dbpedia.org/resource/Scooby-Doo> a dbo:Person .
}
*/
ASK`${scoobyDoo} a ${dbo.Person}`
.execute(client)
.then(isScoobyAPerson => {
// Fun fact: DBpedia seems to claim that Scooby-Doo is indeed a Person...
return isScoobyAPerson
})
The example in docs/examples
can be executed locally. To do so, first replace the package import to point to the repository root.
-const { /* */ } = require('@tpluscode/sparql-builder')
+const { /* */ } = require('../..')
Then simply npm run example
.
FAQs
Simple JS library to build SPARQL queries
The npm package @tpluscode/sparql-builder receives a total of 924 weekly downloads. As such, @tpluscode/sparql-builder popularity was classified as not popular.
We found that @tpluscode/sparql-builder 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.