Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aleksamagicka/ot-llm
https://github.com/aleksamagicka/ot-llm
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/aleksamagicka/ot-llm
- Owner: aleksamagicka
- Created: 2024-02-21T12:02:03.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2024-03-07T08:23:43.000Z (10 months ago)
- Last Synced: 2024-10-16T15:05:46.547Z (3 months ago)
- Language: Python
- Size: 471 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
Awesome Lists containing this project
README
# SPARQL generation for DKG Artworks using GPT models
The main file is `main_system.py`, which uses GPT to generate SPARQL queries for the artwork data in the OriginTrail DKG.
## How to run
In a Terminal, assuming packages are installed:
```bash
python main.py
```The server should be up at `127.0.0.1:5000`.
## Examples of outputs
```
Give me all artworks whose name contains 'aleksa':SELECT ?artwork ?name ?description ?image ?author
WHERE {
?artwork rdf:type schema:VisualArtwork;
schema:name ?name;
schema:description ?description;
schema:image ?image;
schema:author ?author.
FILTER(CONTAINS(?name, "aleksa"))
}
------------------------
[]
------------------------------------------------------------------
Give me all artworks where author is 'aleksa':SELECT ?artwork ?name ?author
WHERE {
?artwork rdf:type schema:VisualArtwork;
schema:author ?author.
FILTER(CONTAINS(?author, "aleksa"))
}
------------------------
[]
------------------------------------------------------------------
Give me all artworks related to fairies:SELECT ?artwork ?name ?description ?image ?author
WHERE {
?artwork rdf:type schema:VisualArtwork;
schema:keywords ?keywords;
schema:name ?name;
schema:description ?description;
schema:image ?image;
schema:author ?author.
FILTER (CONTAINS(?keywords, "fairy"))
}
------------------------
[]
------------------------------------------------------------------
Give me all artworks related to fairies and elves, and their locations:SELECT ?artwork ?name ?description ?image ?author ?location WHERE {
?artwork rdf:type schema:VisualArtwork;
schema:keywords ?keyword;
schema:name ?name;
schema:description ?description;
schema:image ?image;
schema:author ?author.
FILTER (CONTAINS(?keyword, "fairy") || CONTAINS(?keyword, "elf"))
OPTIONAL { ?artwork schema:location ?location }
}
------------------------
[]
------------------------------------------------------------------
Show me artworks containing humans:SELECT ?artwork ?name ?image ?author
WHERE {
?artwork rdf:type schema:VisualArtwork;
schema:name ?name;
schema:image ?image;
schema:author ?author;
schema:keywords ?keywords.
FILTER (CONTAINS(?keywords, "human")).
}
------------------------
[]
------------------------------------------------------------------
Show me artworks containing humans with black hair:SELECT ?artwork ?name ?image ?author
WHERE {
?artwork rdf:type schema:VisualArtwork;
schema:additionalProperty/schema:name "hair";
schema:additionalProperty/schema:value "black";
schema:additionalProperty/schema:name "attires";
schema:additionalProperty/schema:value ?attires;
schema:image ?image;
schema:author ?author;
FILTER(CONTAINS(?attires, "human"))
}
------------------------
[]
------------------------------------------------------------------
Show me artworks that are related to anime:SELECT ?artwork ?name ?description ?image ?author
WHERE {
?artwork rdf:type schema:VisualArtwork;
schema:keywords ?keyword;
schema:name ?name;
schema:description ?description;
schema:image ?image;
schema:author ?author.
FILTER (CONTAINS(?keyword, "anime"))
}
------------------------
[{'artwork': 'https://t.co/gCHdCKJl75', 'author': '_:t1977794', 'image': 'https://t.co/gCHdCKJl75', 'name': '"anime guy"', 'description': '"wow cool"'}]
------------------------------------------------------------------
Show me some artwork on DKG with a flower motive:SELECT ?artwork ?name ?image
WHERE {
?artwork rdf:type schema:VisualArtwork;
schema:keywords ?keywords.
FILTER (CONTAINS(?keywords, "flower")).
?artwork schema:name ?name;
schema:image ?image.
}
------------------------
[]
------------------------------------------------------------------
Show me some artwork that can be described as 'cool':SELECT ?artwork ?name ?description ?image ?author
WHERE {
?artwork rdf:type schema:VisualArtwork;
schema:keywords ?keywords;
schema:name ?name;
schema:description ?description;
schema:image ?image;
schema:author ?author.
FILTER (CONTAINS(?keywords, "cool"))
}
------------------------
[]
------------------------------------------------------------------
Give me all artworks, their names, and descriptions from author with name Leonardo Da Vinci:SELECT ?artwork ?name ?description
WHERE {
?artwork rdf:type schema:VisualArtwork;
schema:author [
rdf:type schema:Person;
schema:name "Leonardo Da Vinci"
];
schema:name ?name;
schema:description ?description.
}
------------------------
[]
------------------------------------------------------------------
```