Skip to content

Commit

Permalink
Merge branch 'main' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
pmcb55 authored Oct 1, 2023
2 parents c87106a + 434d71a commit 95d39db
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html

## Unreleased

## 1.2.0 2023/10/01

- Fix RDF and RDFS term IRIs.

## 1.1.0 2023/10/01

- Add the ability to retrieve all the RDF:type values for any vocab term.
Expand Down
6 changes: 3 additions & 3 deletions src/VocabTerm.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -627,8 +627,8 @@ describe("VocabTerm tests", () => {
});

it("should handle rdf:type of Class", () => {
const RDF_CLASS = rdfFactory.namedNode(
"http://www.w3.org/1999/02/22-rdf-syntax-ns#Class",
const RDFS_CLASS = rdfFactory.namedNode(
"http://www.w3.org/2000/01/rdf-schema#Class",
);
const myTerm = buildBasicTerm(
"http://some.vocab#myTerm",
Expand All @@ -637,7 +637,7 @@ describe("VocabTerm tests", () => {
);

expect(myTerm.isClass).toBe(false);
myTerm.addType(RDF_CLASS);
myTerm.addType(RDFS_CLASS);
expect(myTerm.isClass).toBe(true);
});

Expand Down
20 changes: 10 additions & 10 deletions src/VocabTerm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ const DEFAULT_LOCALE = "en";
// We need an instance of an RDF Factory to instantiate a Named Node, but we
// only want to create instances of these RDF types if we are checking for the
//
let LAZY_TYPE_RDF_CLASS: NamedNode | undefined = undefined;
let LAZY_TYPE_RDFS_CLASS: NamedNode | undefined = undefined;
let LAZY_TYPE_OWL_CLASS: NamedNode | undefined = undefined;

let LAZY_TYPE_RDFS_PROPERTY: NamedNode | undefined = undefined;
let LAZY_TYPE_RDF_PROPERTY: NamedNode | undefined = undefined;
let LAZY_TYPE_OWL_DATATYPE_PROPERTY: NamedNode | undefined = undefined;
let LAZY_TYPE_OWL_OBJECT_PROPERTY: NamedNode | undefined = undefined;
let LAZY_TYPE_OWL_ANNOTATION_PROPERTY: NamedNode | undefined = undefined;
Expand Down Expand Up @@ -266,8 +266,8 @@ class VocabTerm implements NamedNode {
}

createNamedNodeConstantsClass(): void {
LAZY_TYPE_RDF_CLASS = this.rdfFactory.namedNode(
"http://www.w3.org/1999/02/22-rdf-syntax-ns#Class",
LAZY_TYPE_RDFS_CLASS = this.rdfFactory.namedNode(
"http://www.w3.org/2000/01/rdf-schema#Class",
);

LAZY_TYPE_OWL_CLASS = this.rdfFactory.namedNode(
Expand All @@ -276,8 +276,8 @@ class VocabTerm implements NamedNode {
}

createNamedNodeConstantsProperty(): void {
LAZY_TYPE_RDFS_PROPERTY = this.rdfFactory.namedNode(
"http://www.w3.org/2000/01/rdf-schema#Property",
LAZY_TYPE_RDF_PROPERTY = this.rdfFactory.namedNode(
"http://www.w3.org/1999/02/22-rdf-syntax-ns#Property",
);
LAZY_TYPE_OWL_DATATYPE_PROPERTY = this.rdfFactory.namedNode(
"http://www.w3.org/2002/07/owl#Property",
Expand All @@ -303,23 +303,23 @@ class VocabTerm implements NamedNode {
}

get isClass(): boolean {
if (!LAZY_TYPE_RDF_CLASS) {
if (!LAZY_TYPE_RDFS_CLASS) {
this.createNamedNodeConstantsClass();
}

return (
(this._type?.has(LAZY_TYPE_RDF_CLASS!) ||
(this._type?.has(LAZY_TYPE_RDFS_CLASS!) ||
this._type?.has(LAZY_TYPE_OWL_CLASS!)) !== undefined
);
}

get isProperty(): boolean {
if (!LAZY_TYPE_RDFS_PROPERTY) {
if (!LAZY_TYPE_RDF_PROPERTY) {
this.createNamedNodeConstantsProperty();
}

return (
(this._type?.has(LAZY_TYPE_RDFS_PROPERTY!) ||
(this._type?.has(LAZY_TYPE_RDF_PROPERTY!) ||
this._type?.has(LAZY_TYPE_OWL_OBJECT_PROPERTY!) ||
this._type?.has(LAZY_TYPE_OWL_DATATYPE_PROPERTY!) ||
this._type?.has(LAZY_TYPE_OWL_ANNOTATION_PROPERTY!) ||
Expand Down

0 comments on commit 95d39db

Please sign in to comment.