Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
],
"license": "MIT",
"dependencies": {
"rdfjs-wrapper": "^0.15.0"
"rdfjs-wrapper": "^0.29.0"
},
"devDependencies": {
"@rdfjs/types": "^2",
Expand Down
8 changes: 8 additions & 0 deletions src/solid/AccessControlPolicy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { ValueMapping, TermMapping, TermWrapper, ObjectMapping } from "rdfjs-wrapper";

export class AccessControlPolicy extends TermWrapper {

get type(): Set<string> {
return this.objects("http://www.w3.org/1999/02/22-rdf-syntax-ns#type", ValueMapping.literalToString, TermMapping.stringToLiteral);
}
}
15 changes: 15 additions & 0 deletions src/solid/AccessControlResource.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { AcpAccessControl } from './AcpAccessControl';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need .js at the end of these imports?

import { ValueMapping, TermMapping, TermWrapper, ObjectMapping } from "rdfjs-wrapper";

export class AccessControlResource extends TermWrapper {

get accessControl(): Set<AcpAccessControl> {
return this.objects("http://www.w3.org/ns/solid/acp#accessControl", ObjectMapping.as(AcpAccessControl), ObjectMapping.as(AcpAccessControl));
}
get resource(): string | undefined {
return this.singularNullable("http://www.w3.org/ns/solid/acp#resource", ValueMapping.iriToString);
}
set resource(value: string) {
this.overwriteNullable("http://www.w3.org/ns/solid/acp#resource", value, TermMapping.stringToIri);
}
}
9 changes: 9 additions & 0 deletions src/solid/AcpAccessControl.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { AccessControlPolicy } from './AccessControlPolicy';
import { ValueMapping, TermMapping, TermWrapper, ObjectMapping } from "rdfjs-wrapper";

export class AcpAccessControl extends TermWrapper {

get apply(): Set<AccessControlPolicy> {
return this.objects("http://www.w3.org/ns/solid/acp#apply", ObjectMapping.as(AccessControlPolicy), ObjectMapping.as(AccessControlPolicy));
}
}
8 changes: 8 additions & 0 deletions src/solid/AcpMatcher.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { ValueMapping, TermMapping, TermWrapper, ObjectMapping } from "rdfjs-wrapper";

export class AcpMatcher extends TermWrapper {

get agent(): Set<string> {
return this.objects("http://www.w3.org/ns/solid/acp#agent", ValueMapping.literalToString, TermMapping.stringToLiteral);
}
}
35 changes: 35 additions & 0 deletions src/solid/Address.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { ValueMapping, TermMapping, TermWrapper, ObjectMapping } from "rdfjs-wrapper";

export class Address extends TermWrapper {

get streetAddress(): string | undefined {
return this.singularNullable("http://www.w3.org/2006/vcard/ns#street-address", ValueMapping.literalToString);
}
set streetAddress(value: string) {
this.overwriteNullable("http://www.w3.org/2006/vcard/ns#street-address", value, TermMapping.stringToLiteral);
}
get locality(): string | undefined {
return this.singularNullable("http://www.w3.org/2006/vcard/ns#locality", ValueMapping.literalToString);
}
set locality(value: string) {
this.overwriteNullable("http://www.w3.org/2006/vcard/ns#locality", value, TermMapping.stringToLiteral);
}
get postalCode(): string | undefined {
return this.singularNullable("http://www.w3.org/2006/vcard/ns#postal-code", ValueMapping.literalToString);
}
set postalCode(value: string) {
this.overwriteNullable("http://www.w3.org/2006/vcard/ns#postal-code", value, TermMapping.stringToLiteral);
}
get region(): string | undefined {
return this.singularNullable("http://www.w3.org/2006/vcard/ns#region", ValueMapping.literalToString);
}
set region(value: string) {
this.overwriteNullable("http://www.w3.org/2006/vcard/ns#region", value, TermMapping.stringToLiteral);
}
get countryName(): string | undefined {
return this.singularNullable("http://www.w3.org/2006/vcard/ns#country-name", ValueMapping.literalToString);
}
set countryName(value: string) {
this.overwriteNullable("http://www.w3.org/2006/vcard/ns#country-name", value, TermMapping.stringToLiteral);
}
}
26 changes: 26 additions & 0 deletions src/solid/AddressBook.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { ValueMapping, TermMapping, TermWrapper, ObjectMapping } from "rdfjs-wrapper";

export class AddressBook extends TermWrapper {

get formattedName(): Set<string> {
return this.objects("http://www.w3.org/2006/vcard/ns#fn", ValueMapping.literalToString, TermMapping.stringToLiteral);
}
get nameEmailIndex(): Set<string> {
return this.objects("http://www.w3.org/2006/vcard/ns#nameEmailIndex", ValueMapping.iriToString, TermMapping.stringToIri);
}
get groupIndex(): string {
return this.singular("http://www.w3.org/2006/vcard/ns#groupIndex", ValueMapping.iriToString);
}
set groupIndex(value: string) {
this.overwrite("http://www.w3.org/2006/vcard/ns#groupIndex", value, TermMapping.stringToIri);
}
get includesGroup(): Set<string> {
return this.objects("http://www.w3.org/2006/vcard/ns#includesGroup", ValueMapping.iriToString, TermMapping.stringToIri);
}
get inAddressBook(): string {
return this.singular("http://www.w3.org/2006/vcard/ns#inAddressBook", ValueMapping.iriToString);
}
set inAddressBook(value: string) {
this.overwrite("http://www.w3.org/2006/vcard/ns#inAddressBook", value, TermMapping.stringToIri);
}
}
5 changes: 5 additions & 0 deletions src/solid/Agent.ts
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any justification for generating mapping classes that lack properties.

When a shape would result in such then we should probably throw.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added check with latest commit ce4907d - doesn't throw error but doesn't create class

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { ValueMapping, TermMapping, TermWrapper, ObjectMapping } from "rdfjs-wrapper";

export class Agent extends TermWrapper {

}
17 changes: 17 additions & 0 deletions src/solid/Bookmark.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { ValueMapping, TermMapping, TermWrapper, ObjectMapping } from "rdfjs-wrapper";

export class Bookmark extends TermWrapper {

get label(): Set<string> {
return this.objects("http://www.w3.org/2000/01/rdf-schema#label", ValueMapping.literalToString, TermMapping.stringToLiteral);
}
get url(): Set<string> {
return this.objects("http://www.w3.org/2002/01/bookmark#recalls", ValueMapping.iriToString, TermMapping.stringToIri);
}
get topic(): Set<string> {
return this.objects("http://www.w3.org/2002/01/bookmark#hasTopic", ValueMapping.literalToString, TermMapping.stringToLiteral);
}
get description(): Set<string> {
return this.objects("http://www.w3.org/2000/01/rdf-schema#comment", ValueMapping.literalToString, TermMapping.stringToLiteral);
}
}
14 changes: 14 additions & 0 deletions src/solid/ChatAction.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { ValueMapping, TermMapping, TermWrapper, ObjectMapping } from "rdfjs-wrapper";

export class ChatAction extends TermWrapper {

get type(): Set<string> {
return this.objects("http://www.w3.org/1999/02/22-rdf-syntax-ns#type", ValueMapping.literalToString, TermMapping.stringToLiteral);
}
get agent(): string | undefined {
return this.singularNullable("https://schema.org/agent", ValueMapping.literalToString);
}
set agent(value: string) {
this.overwriteNullable("https://schema.org/agent", value, TermMapping.stringToLiteral);
}
}
31 changes: 31 additions & 0 deletions src/solid/ChatChannel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { ChatSharedPreferences } from './ChatSharedPreferences';
import { Participation } from './Participation';
import { ValueMapping, TermMapping, TermWrapper, ObjectMapping } from "rdfjs-wrapper";

export class ChatChannel extends TermWrapper {

get type(): Set<string> {
return this.objects("http://www.w3.org/1999/02/22-rdf-syntax-ns#type", ValueMapping.literalToString, TermMapping.stringToLiteral);
}
get author(): Set<string> {
return this.objects("http://purl.org/dc/elements/1.1/author", ValueMapping.literalToString, TermMapping.stringToLiteral);
}
get title(): string {
return this.singular("http://purl.org/dc/elements/1.1/title", ValueMapping.literalToString);
}
set title(value: string) {
this.overwrite("http://purl.org/dc/elements/1.1/title", value, TermMapping.stringToLiteral);
}
get createdDate(): Date {
return this.singular("http://purl.org/dc/elements/1.1/created", ValueMapping.literalToDate);
}
set createdDate(value: Date) {
this.overwrite("http://purl.org/dc/elements/1.1/created", value, TermMapping.dateToLiteral);
}
get sharedPreferences(): Set<ChatSharedPreferences> {
return this.objects("http://www.w3.org/ns/ui#sharedPreferences", ObjectMapping.as(ChatSharedPreferences), ObjectMapping.as(ChatSharedPreferences));
}
get participation(): Set<Participation> {
return this.objects("http://www.w3.org/2005/01/wf/flow#participation", ObjectMapping.as(Participation), ObjectMapping.as(Participation));
}
}
26 changes: 26 additions & 0 deletions src/solid/ChatMessage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { ValueMapping, TermMapping, TermWrapper, ObjectMapping } from "rdfjs-wrapper";

export class ChatMessage extends TermWrapper {

get createdDate(): Date {
return this.singular("http://purl.org/dc/terms/created", ValueMapping.literalToDate);
}
set createdDate(value: Date) {
this.overwrite("http://purl.org/dc/terms/created", value, TermMapping.dateToLiteral);
}
get author(): string {
return this.singular("http://xmlns.com/foaf/0.1/maker", ValueMapping.literalToString);
}
set author(value: string) {
this.overwrite("http://xmlns.com/foaf/0.1/maker", value, TermMapping.stringToLiteral);
}
get content(): string {
return this.singular("http://rdfs.org/sioc/ns#content", ValueMapping.literalToString);
}
set content(value: string) {
this.overwrite("http://rdfs.org/sioc/ns#content", value, TermMapping.stringToLiteral);
}
get relatedChatChannel(): Set<string> {
return this.objects("n3-52", ValueMapping.literalToString, TermMapping.stringToLiteral);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The string used as predicate looks like a blank node label. I'm sure this is unintentional. It would not work.

It probably highlights some fundamental parser/generator problem in the converter.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unresolved - the SHACL shape property from SolidOS uses [ sh:path [ sh:inversePath flow:message ]

[ sh:path [ sh:inversePath flow:message ] ;
          sh:minCount 1 ; 
          rdfs:label "Related Chat" ;
          rdfs:comment "The chat channel or conversation to which this message belongs." ;
          sh:codeIdentifier "relatedChatChannel";
        ] 

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for all your feedback @langsamu :-)

}
}
23 changes: 23 additions & 0 deletions src/solid/ChatSharedPreferences.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { ValueMapping, TermMapping, TermWrapper, ObjectMapping } from "rdfjs-wrapper";

export class ChatSharedPreferences extends TermWrapper {

get expandImagesInline(): boolean | undefined {
return this.singularNullable("http://www.w3.org/ns/solid/terms#expandImagesInline", ValueMapping.literalToString);
}
set expandImagesInline(value: boolean) {
this.overwriteNullable("http://www.w3.org/ns/solid/terms#expandImagesInline", value, TermMapping.stringToLiteral);
}
get inlineImageHeight(): number | undefined {
return this.singularNullable("http://www.w3.org/ns/solid/terms#inlineImageHeightEms", ValueMapping.literalToNumber);
}
set inlineImageHeight(value: number) {
this.overwriteNullable("http://www.w3.org/ns/solid/terms#inlineImageHeightEms", value, TermMapping.numberToLiteral);
}
get newestFirst(): boolean | undefined {
return this.singularNullable("http://www.w3.org/ns/solid/terms#newestFirst", ValueMapping.literalToString);
}
set newestFirst(value: boolean) {
this.overwriteNullable("http://www.w3.org/ns/solid/terms#newestFirst", value, TermMapping.stringToLiteral);
}
}
29 changes: 29 additions & 0 deletions src/solid/ContactDetailsOrganization.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Address } from './Address';
import { EmailWithType } from './EmailWithType';
import { Telephone } from './Telephone';
import { ValueMapping, TermMapping, TermWrapper, ObjectMapping } from "rdfjs-wrapper";

export class ContactDetailsOrganization extends TermWrapper {

get organizationType(): Set<string> {
return this.objects("http://www.w3.org/1999/02/22-rdf-syntax-ns#type", ValueMapping.literalToString, TermMapping.stringToLiteral);
}
get name(): Set<string> {
return this.objects("http://schema.org/name", ValueMapping.literalToString, TermMapping.stringToLiteral);
}
get homepageURL(): Set<string> {
return this.objects("http://schema.org/url", ValueMapping.literalToString, TermMapping.stringToLiteral);
}
get hasAddress(): Set<Address> {
return this.objects("http://www.w3.org/2006/vcard/ns#hasAddress", ObjectMapping.as(Address), ObjectMapping.as(Address));
}
get hasEmailAddress(): Set<EmailWithType> {
return this.objects("http://www.w3.org/2006/vcard/ns#hasEmail", ObjectMapping.as(EmailWithType), ObjectMapping.as(EmailWithType));
}
get hasTelephoneNumber(): Set<Telephone> {
return this.objects("http://www.w3.org/2006/vcard/ns#hasTelephone", ObjectMapping.as(Telephone), ObjectMapping.as(Telephone));
}
get notes(): Set<string> {
return this.objects("http://www.w3.org/2006/vcard/ns#note", ValueMapping.literalToString, TermMapping.stringToLiteral);
}
}
47 changes: 47 additions & 0 deletions src/solid/ContactDetailsPerson.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { Address } from './Address';
import { EmailWithType } from './EmailWithType';
import { Telephone } from './Telephone';
import { ValueMapping, TermMapping, TermWrapper, ObjectMapping } from "rdfjs-wrapper";

export class ContactDetailsPerson extends TermWrapper {

get fullName(): string | undefined {
return this.singularNullable("http://www.w3.org/2006/vcard/ns#fn", ValueMapping.literalToString);
}
set fullName(value: string) {
this.overwriteNullable("http://www.w3.org/2006/vcard/ns#fn", value, TermMapping.stringToLiteral);
}
get role(): string | undefined {
return this.singularNullable("http://www.w3.org/2006/vcard/ns#role", ValueMapping.literalToString);
}
set role(value: string) {
this.overwriteNullable("http://www.w3.org/2006/vcard/ns#role", value, TermMapping.stringToLiteral);
}
get organizationName(): string | undefined {
return this.singularNullable("http://www.w3.org/2006/vcard/ns#organization-name", ValueMapping.literalToString);
}
set organizationName(value: string) {
this.overwriteNullable("http://www.w3.org/2006/vcard/ns#organization-name", value, TermMapping.stringToLiteral);
}
get address(): Set<Address> {
return this.objects("http://www.w3.org/2006/vcard/ns#hasAddress", ObjectMapping.as(Address), ObjectMapping.as(Address));
}
get email(): Set<EmailWithType> {
return this.objects("http://www.w3.org/2006/vcard/ns#hasEmail", ObjectMapping.as(EmailWithType), ObjectMapping.as(EmailWithType));
}
get telephone(): Set<Telephone> {
return this.objects("http://www.w3.org/2006/vcard/ns#hasTelephone", ObjectMapping.as(Telephone), ObjectMapping.as(Telephone));
}
get dateOfBirth(): Date | undefined {
return this.singularNullable("http://www.w3.org/2006/vcard/ns#bday", ValueMapping.literalToDate);
}
set dateOfBirth(value: Date) {
this.overwriteNullable("http://www.w3.org/2006/vcard/ns#bday", value, TermMapping.dateToLiteral);
}
get notes(): string | undefined {
return this.singularNullable("http://www.w3.org/2006/vcard/ns#note", ValueMapping.literalToString);
}
set notes(value: string) {
this.overwriteNullable("http://www.w3.org/2006/vcard/ns#note", value, TermMapping.stringToLiteral);
}
}
17 changes: 17 additions & 0 deletions src/solid/ContactOrganization.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { ValueMapping, TermMapping, TermWrapper, ObjectMapping } from "rdfjs-wrapper";

export class ContactOrganization extends TermWrapper {

get name(): string | undefined {
return this.singularNullable("http://schema.org/name", ValueMapping.literalToString);
}
set name(value: string) {
this.overwriteNullable("http://schema.org/name", value, TermMapping.stringToLiteral);
}
get homepageURL(): Set<string> {
return this.objects("http://schema.org/url", ValueMapping.literalToString, TermMapping.stringToLiteral);
}
get typeCategory(): Set<string> {
return this.objects("http://www.w3.org/1999/02/22-rdf-syntax-ns#type", ValueMapping.literalToString, TermMapping.stringToLiteral);
}
}
Loading
Loading