Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix circular dependency & expose a basic namespace map #240

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var $rdf = {
N3Parser: require('./n3parser'),
NamedNode: require('./named-node'),
Namespace: require('./namespace'),
ns: require('./ns'),
Node: require('./node'),
parse: require('./parse'),
Query: require('./query').Query,
Expand Down
4 changes: 1 addition & 3 deletions src/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,8 @@ Node.fromValue = function fromValue (value) {
return Literal.fromValue(value)
}

const Namespace = require('./namespace')
const ns = { xsd: Namespace('http://www.w3.org/2001/XMLSchema#') }

Node.toJS = function toJS (term) {
const ns = require('./ns')
if (term.elements) {
return term.elements.map(Node.toJS) // Array node (not standard RDFJS)
}
Expand Down
61 changes: 61 additions & 0 deletions src/ns.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
const Namespace = require('./namespace')

const ns = {
adms: Namespace("http://www.w3.org/ns/adms#"),
as: Namespace("https://www.w3.org/ns/activitystreams#"),
bibo: Namespace("http://purl.org/ontology/bibo/"),
cc: Namespace("http://creativecommons.org/ns#"),
dbo: Namespace("http://dbpedia.org/ontology/"),
dbp: Namespace("http://dbpedia.org/property/"),
dbpedia: Namespace("http://dbpedia.org/resource/"),
dcat: Namespace("http://www.w3.org/ns/dcat#"),
dcterms: Namespace("http://purl.org/dc/terms/"),
dctype: Namespace("http://purl.org/dc/dcmitype/"),
dce: Namespace("http://purl.org/dc/elements/1.1/"),
doap: Namespace("http://usefulinc.com/ns/doap#"),
event: Namespace("http://purl.org/NET/c4dm/event.owl#"),
ex: Namespace("http://example.com/"),
exNS: Namespace("http://example.com/ns#"),
fhir: Namespace("http://hl7.org/fhir/"),
fhir3: Namespace("http://hl7.org/fhir/STU3"),
foaf: Namespace("http://xmlns.com/foaf/0.1/"),
geo: Namespace("http://www.w3.org/2003/01/geo/wgs84_pos#"),
gsp: Namespace("http://www.opengis.net/ont/geosparql#"),
gr: Namespace("http://purl.org/goodrelations/v1#"),
http: Namespace("http://www.w3.org/2011/http#"),
http07: Namespace("http://www.w3.org/2007/ont/http#"),
httph: Namespace("http://www.w3.org/2007/ont/httph#"),
hydra: Namespace("http://www.w3.org/ns/hydra/core#"),
ianalr: Namespace("http://www.w3.org/ns/iana/link-relations/relation#"),
ianamt: Namespace("http://www.w3.org/ns/iana/media-types/"),
ldp: Namespace("http://www.w3.org/ns/ldp#"),
link: Namespace("http://www.w3.org/2007/ont/link#"),
org: Namespace("http://www.w3.org/ns/org#"),
owl: Namespace("http://www.w3.org/2002/07/owl#"),
p: Namespace("http://www.wikidata.org/prop/"),
prov: Namespace("http://www.w3.org/ns/prov#"),
qb: Namespace("http://purl.org/linked-data/cube#"),
rdf: Namespace("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),
rdfs: Namespace("http://www.w3.org/2000/01/rdf-schema#"),
schema: Namespace("http://schema.org/"),
sh: Namespace("http://www.w3.org/ns/shacl#"),
sioc: Namespace("http://rdfs.org/sioc/ns#"),
skos: Namespace("http://www.w3.org/2004/02/skos/core#"),
ssn: Namespace("http://www.w3.org/ns/ssn/"),
sosa: Namespace("http://www.w3.org/ns/sosa/"),
time: Namespace("http://www.w3.org/2006/time#"),
vann: Namespace("http://purl.org/vocab/vann/"),
vcard: Namespace("http://www.w3.org/2006/vcard/ns#"),
void: Namespace("http://rdfs.org/ns/void#"),
vs: Namespace("http://www.w3.org/2003/06/sw-vocab-status/ns#"),
wd: Namespace("http://www.wikidata.org/entity/"),
wdata: Namespace("https://www.wikidata.org/wiki/Special:EntityData/"),
wdref: Namespace("http://www.wikidata.org/reference/"),
wds: Namespace("http://www.wikidata.org/entity/statement/"),
wdt: Namespace("http://www.wikidata.org/prop/direct/"),
wdv: Namespace("http://www.wikidata.org/value/"),
xmlns: Namespace("http://www.w3.org/2000/xmlns/"),
xsd: Namespace("http://www.w3.org/2001/XMLSchema#"),
}

module.exports = ns