Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
elf Pavlik
@elf-pavlik
i don't think this repo has changeset as dependency
Tomasz Pluskiewicz
@tpluscode
aha, that's still unmerged PR
sorry about that. please rebase and proceed
elf Pavlik
@elf-pavlik
based on Ruben's comment I will mark those changes major ...
Tomasz Pluskiewicz
@tpluscode
:+1:
elf Pavlik
@elf-pavlik
done, thanks for help @tpluscode
elf Pavlik
@elf-pavlik
@fletcher91 I was looking at https://github.com/ontola/ontologies, In TS project I'm working on I wouldn't want to include full ontologies for the runtime but only use TS definition for the compiler to catch any typo in my code during the build
for the runtime I would still use something tiny like https://github.com/rdfjs-base/namespace/blob/master/index.js
Tomasz Pluskiewicz
@tpluscode
ATM it does not provide strict type checking but I could export an alternative like import { schema } from '@tpluscode/rdf-ns-builders/strict' which would be typed to only allow declared terms from an ontology
elf Pavlik
@elf-pavlik
cool! i'll take a look

BTW what would you see as best pattern for not including default factory? https://github.com/rdf-esm/namespace/blob/master/index.js#L1

Would we rely on tree shaking or maybe have two separate exports: 1 includes default data factory 2 expects you to provide data factory - one could wrap it in one's own code to have equivalent of 1 but with data factory of their choice)

Tomasz Pluskiewicz
@tpluscode
the factories are all over the place and I don't think there's a good way about the right now. unless everyone exports without using any explicit factory, it doesn't really matter what you do. and then without a focal point, which @bergos plans as "RDF Environment" you'd be stuck with passing a factory instance everywhere. hardly ergonomic
elf Pavlik
@elf-pavlik

you'd be stuck with passing a factory instance everywhere

in case of namespace builder, i would simply

  • import factory free version in one place
  • import factory of my choice in the same place
  • export namespace builder that uses that factory
  • use it in the rest of my codebase
Tomasz Pluskiewicz
@tpluscode
well yes, but you're already looking at rdf-ns-builders package which itself import the namespace builder. already hitting that very problem
and then any 3rd party package which imports from @tpluscode/rdf-ns-builders. how do you make it use your factory? or you namespace builder if it changes anything
elf Pavlik
@elf-pavlik
I would look for something in lines:
import { rawBuilder } from '@rdf-esm/namespace'
import * as Vocabs from '@ontologies/types'
import * as Prefixes from '@ontologies/prefixes'
import { DataFactory } from 'n3'

function buildNamespace (prefix) {
  return rawBuilder (prefix, { factory: DataFactory })
}

export const SCHEMA: Vocabs.schema = buildNamespace(Prefixes.schema)
export const XSD: Vocabs.xsd = buildNamespace(Prefixes.xsd)
// more vocabs
Tomasz Pluskiewicz
@tpluscode
then again, you achieve nothing, because there are a ton of packages, every one of which imports some factory
elf Pavlik
@elf-pavlik
@tpluscode I'm following conversation in https://github.com/DefinitelyTyped/DefinitelyTyped/pull/53415#issuecomment-850444384
Do you have all the access required to publish @rdfjs/types?
Tomasz Pluskiewicz
@tpluscode
yes. should be done today. then the next step is DefinitelyTyped/DefinitelyTyped#51756
elf Pavlik
@elf-pavlik
Great! What has to be done in there?
Tomasz Pluskiewicz
@tpluscode
it requires microsoft/DefinitelyTyped-tools#217 so that DT allows external dependency on rdf-js
and hopefully it should be easy to complete. right now though the @rdfjs/types failed to publish because my token was not good. pinged @bergos
elf Pavlik
@elf-pavlik

https://github.com/microsoft/DefinitelyTyped-tools/pull/217#issuecomment-833728862

@tpluscode please ping me when DefinitelyTyped/DefinitelyTyped#51756 is no longer a draft.

What is needed for DefinitelyTyped/DefinitelyTyped#51756 to change from Draft to regular PR ?

1 reply
elf Pavlik
@elf-pavlik
BTW what is the benefit of having rdf-js over depending on @rdfjs/types directly ?
9 replies
it says we can disable this rule in tsconfig
Ruben Taelman
@rubensworks
Let's just stick with the n3 major/minor version as you suggested.
Tomasz Pluskiewicz
@tpluscode
very well
Iwan Aucamp
@aucampia
I'm working on an RDF library for go, and I am looking at your data model, and want to understand some of the choices. Is there a reason why a Quad can take a blank node as predicate for example when RDF says it should only be NamedNodes?
I guess it is because you have variable as a term, and typing would become quite hairy then
Ruben Taelman
@rubensworks
Probably to also support generalized RDF use cases, as that allows quad terms to be of any type.
@tpluscode thank you for taking care of all the Definitely Typed maneuvers :tada:
Tomasz Pluskiewicz
@tpluscode
:bow:
Tomasz Pluskiewicz
@tpluscode
do you all find it awkward every time there is a need to compare a literal against true? is there any package which exports "true"^^xsd:boolean and "false"^^xsd:boolean? would there even be anything else in such a package?
Tim Berners-Lee
@timbl
You need rdib’s higher level api with store.anyJS
Tim Berners-Lee
@timbl
If (store.anyJS(proj, ns.ex(‘currentlyActive’))  {
  console.log(‘Project is active’)
}
console.log(store.anyJS(proj, ns.ex(‘currentlyActive’)) // true
So no, not awkward so long as developers don’t ahve to use the low level standard interface.
3 replies
Tomasz Pluskiewicz
@tpluscode

well, it's that developers "have to". but given the lowest denominator which is a literal object, there should be an easy way to check that it equals an RDF true/false.

if anything, I would argue that requiring the users to use a higher level API just for that is not ideal

speaking of standard interface, is rdflib actually compatible with RDF/JS?
Tim Berners-Lee
@timbl
It is a superset of RDF/JS functionality, and @megoth worked hard to try to get that expressed in typescript, but it seemed to be really hard. I’m not the expert but it looks as though there as set of conversion types which provide shim. https://github.com/linkeddata/rdflib.js/blob/main/src/node-internal.ts seems to be shim type. @megoth worked on it for a but but then had to do other things IIRC.
Blake Regalia
@blake-regalia
@tpluscode do you mean something like this? https://graphy.link/core.data.factory#class_literal-boolean
2 replies
peeja
@peeja:matrix.org
[m]

Broad question: I'm working on a tool that will need to (if I can make it work sensibly) make statements about resources that aren't super RDF-aware, but do have good URLs (like, say, various entities in a GitHub repo). I'd like to implement that by applying some statements or rules to resources/statements/graphs by some kind of IRI wildcard pattern. For instance, I'd want a custom Comunica agent to handle resolving certain things based on that wildcard. (This is all very vague, but I'm just ideating and looking for some missing conceptual pieces at this point.)

Triple patterns are a thing, but they require matching on entire elements of triples. The IRIs are opaque. Hydra can construct IRIs with IriTemplates, but not (AFAIK) destructure them or match them as patterns. Is there any prior work that does destructure or pattern-match IRIs in some way that I could read up on? Or is that new territory? Or is it old territory the community has decided is a bad idea to pursue? 😀

Adrian Gschwend
@ktk
not sure if @bergos has some remarks here?
elf Pavlik
@elf-pavlik
@RubenVerborgh I PRd tiny fix for DatasetCore support in N3Store rdfjs/N3.js#251
elf Pavlik
@elf-pavlik

Or is it old territory the community has decided is a bad idea to pursue?

In general clients should treat IRIs as opaque identifiers. So destructuring them sounds like anti pattern. I think URI Templates provide some middle ground where structure of IRI can be communicated.

Maybe you could provide more concrete example demonstrating what exactly are you trying to acomplish?

4 replies
Tomasz Pluskiewicz
@tpluscode
I did a little bit backwards IRI matching in .NET to created routing from templates. last I checked JS did not have a library which implemented the reverse operation on templates
and agreed on the anti-pattern
Ruben Verborgh
@RubenVerborgh
@elf-pavlik Thanks, will check asap!
Martynas Jusevicius
@namedgraph_twitter
@peeja:matrix.org sounds like a case for GRDDL: https://www.w3.org/TR/grddl/
elf Pavlik
@elf-pavlik

@elf-pavlik Thanks, will check asap!

@RubenVerborgh it literally adds one line of implementation and one line of corresponding test. I don't mean to rush just emphasize that it's a very tiny fix.