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

SDNA/Prolog bugs uncovered by Perspect3vism fixed #353

Merged
merged 7 commits into from
Apr 3, 2023
Merged
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
3 changes: 2 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This project _loosely_ adheres to [Semantic Versioning](https://semver.org/spec/

### Added
- bootstrap languages to mono repo [PR#328](https://github.com/perspect3vism/ad4m/pull/328)
- Support for new UI oriented Subject class predicates (property_named_option, p3_class_icon, etc). [PR#353](https://github.com/perspect3vism/ad4m/pull/353)

### Changed

Expand All @@ -15,7 +16,7 @@ This project _loosely_ adheres to [Semantic Versioning](https://semver.org/spec/
### Removed

### Fixed

- Expression -> get would fail when executed on a Literal expression. [PR#353](https://github.com/perspect3vism/ad4m/pull/353)
## [0.3.4] - 27/03/2023

### Added
Expand Down
8 changes: 8 additions & 0 deletions executor/src/core/LanguageController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1007,6 +1007,14 @@ export default class LanguageController {
try {
if(ref.language.address == "literal" || ref.language.name == 'literal') {
expr = Literal.fromUrl(`literal://${ref.expression}`).get()
if(! (typeof expr === 'object')) {
expr = {
author: '<unknown>',
timestamp: '<unknown>',
data: expr,
proof: {}
}
}
} else {
const lang = this.languageForExpression(ref);
if (!lang.expressionAdapter) {
Expand Down
12 changes: 12 additions & 0 deletions executor/src/core/Perspective.ts
Original file line number Diff line number Diff line change
Expand Up @@ -868,17 +868,29 @@ export default class Perspective {
lines.push(":- dynamic property/2.")
lines.push(":- dynamic property_getter/4.")
lines.push(":- dynamic property_setter/3.")
lines.push(":- dynamic property_resolve/2.")
lines.push(":- dynamic property_resolve_language/3.")
lines.push(":- dynamic property_named_option/4.")
lines.push(":- dynamic collection_getter/4.")
lines.push(":- dynamic collection_setter/3.")
lines.push(":- dynamic p3_class_icon/2.")
lines.push(":- dynamic p3_class_color/2.")
lines.push(":- dynamic p3_instance_color/3.")

lines.push(":- discontiguous subject_class/2.")
lines.push(":- discontiguous constructor/2.")
lines.push(":- discontiguous instance/2.")
lines.push(":- discontiguous property/2.")
lines.push(":- discontiguous property_getter/4.")
lines.push(":- discontiguous property_setter/3.")
lines.push(":- discontiguous property_resolve/2.")
lines.push(":- discontiguous property_resolve_language/3.")
lines.push(":- discontiguous property_named_option/4.")
lines.push(":- discontiguous collection_getter/4.")
lines.push(":- discontiguous collection_setter/3.")
lines.push(":- discontiguous p3_class_icon/2.")
lines.push(":- discontiguous p3_class_color/2.")
lines.push(":- discontiguous p3_instance_color/3.")

for(let linkExpression of allLinks) {
let link = linkExpression.data
Expand Down
5 changes: 5 additions & 0 deletions executor/src/core/graphQL-interface/GraphQL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -947,6 +947,11 @@ function createResolvers(core: PerspectivismCore, config: OuterConfig) {
language: async (expression) => {
//console.log("GQL LANGUAGE", expression)
let lang

if(expression.ref.language.address === "literal") {
return { address: "literal", name: "literal" }
}

try {
lang = await core.languageController.languageForExpression(expression.ref) as any
} catch(e) {
Expand Down