Comments (3)
Thanks! For the look. It was the typo.
TIL about @zazuko/env
and will look in to it
from clownface.
tl;dr; for @zazuko/env
you'd need to add the parsers yourself as they are excluded to reduce dependencies if used in the browser.
@zazuko/env-node
includes parsers/serializers and also an additional utility to access the filesystem (https://npm.im/@zazuko/rdf-utils-fs)
from clownface.
There is no short answer because the a
shorthand for rdf:type
is a feature of turtle serialisation. Clownface only deals with parsed graphs in memory. I suppose NO is the short answer and when accessing the graph with clownface, the rdf:type
term has to be used.
The problem appears to be the casing. It should be Ns.rdf.type
(lower case) to match the actual URL
I looked at you snippet after all, and I might suggest some simplifications. I change rdf-ext
to @zazuko/env
because the former has recently removed clownface and we also added some since features, such as common namespaces built-in and type declarations. That also includes type-checking for vocabularies, which would have alerted you about that above.
Here's how much can can abbreviate but using all library features (most of which is available in the libs you import above, only more tightly packed in @zazuko/env-node
)
import rdf from '@zazuko/env-node'
const response = await rdf.fetch('http://zazuko.github.io/tbbt-ld/dist/tbbt.nt')
if (!response.ok) {
// TODO: handle request error
}
const dataset = await response.dataset()
const data = rdf.clownface({ dataset })
const quads = data.has(rdf.ns.rdf.type, rdf.ns.schema.Person)
quads.forEach((quad) => {
const source = {
iri: quad.term.value,
name: quad.out(rdf.ns.schema.givenName).value
}
console.log(source)
})
from clownface.
Related Issues (20)
- Add .distinct method to reduce result to unique terms/dataset/graph HOT 3
- Add getters to check if there is any context
- Cannot easily create "false"^^xsd:boolean literal HOT 2
- Cannot delete specific objects
- Add method(s) to filter the results based on termType
- Add option to provide custom factory for terms HOT 1
- Allow creating empty NamedNodes HOT 1
- Support recursion HOT 3
- Return this on forEach() HOT 2
- Without context, addOut creates blank subjects HOT 4
- better handling of non-list or empty list object values in .list() HOT 2
- Support language tags in `out`
- Add Symbol.iterator to Clownface class
- Feature request: Provide some immutable update methods HOT 2
- .out with language not returning expected literals HOT 1
- list() does not always return an iterator HOT 5
- Rename? HOT 2
- ptr.deleteList does not return when trying to delete something that's not a list. HOT 1
- Improve list iteration
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clownface.