assemblee-virtuelle / assemblee-virtuelle/semantizer-typescript
Generate simple SPARQL SELECT queries
- Dominant language
- TypeScript
- Stars
- 3
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
In order to query and find data, we should be able to generate a simple SPARQL SELECT query.
This query should support WHERE parameters constructed from the semantic properties.
To do so, we could define a `SparqlQueryParameter` interface like:
```ts
interface SparqlQueryParameter {
property: string;
values: string[] | Semanticable[];
}
```
Then the method could take the form of a static method `getSparqlSelectQuery(parameters?: SparqlQueryParameter[])`.
Maybe this should not be part of the `SemanticObject` class? The Decorator design pattern could also be used.
Note: we don't to generate SPARQL queries in the connector codegen to keep it simple. It's better to have this is Semantizer.
# Use object as criteria
In the `SemanticObject` class we could have a `find` method:
```ts
SemanticObject.find() {
// 1. Generate the SPARQL from all the semantic properties of the object.
// 2. Create a cancel-able command containing the SPARQL.
// 3. Send the command to the query planner.
}
```
Then we can create semantic objects for finding:
```ts
new SemanticObject(params...).find()
```
--> PB when we want to query several values for a property with only one value allowed.
# Use findBy methods
Create `findBy...` methods like:
```ts
public static async Catalog.findByMaintainer(connector: IConnector, maintainer: Semanticable callback: Function): Promise {
return connector.find(Catalog.TYPE, maintainer, callback);
}
public async Connector.findCatalogByMaintainer(maintainer: Semanticable, callback: Function): Promise {
return this.getSemantizer().find("dfc-b:Catalog", "dfc-b:maintainedBy", maintainer, callback);
}
// Or with collections:
Connector.catalog.findByMaintainer();
Connector.address.findByCountry();
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating the SemanticObject class and the Semantizer, connector, and query-planner entry points referenced in the issue. Compare the proposed getSparqlSelectQuery, find, and findBy methods, then clarify which API and ownership model is intended. Done means an agreed design and implementation for simple SELECT queries with semantic-property WHERE parameters.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100