Am new to Ontotext. I understand similarity index of ontotext. It creates vectors of the index data and we can do search upon it. Is there a way to create vectors by other embedding models? Please advice.
i have created similarity index upon the data and could see the search results are less acurate than openaiembedding model vectors. So expecting any possible way to add other embedding model into the similarity index creation in Ontotext.
I am creating similarity index in ontotext using below query. But is there a way to specify the embedding model with this the index vector have to be created..?
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX ex: <http://example.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX : <http://www.ontotext.com/graphdb/similarity/>
PREFIX similarity-index: <http://www.ontotext.com/graphdb/similarity/instance/>
PREFIX pred: <http://www.ontotext.com/graphdb/similarity/psi/>
insert {
similarity-index:PRODUCTS_INDEX pred:createPredicationIndex "-termweight idf" ;
pred:subject ?subject .
?subject pred:predicate ?predicate .
?subject pred:object ?object .
} where {
SELECT ?documentID (GROUP_CONCAT(?finalText; SEPARATOR=" ") AS ?combinedText)
WHERE {
# Ensure the result is of type PRODUCTS
?documentID rdf:type ex:PRODUCTS ;
?p ?documentText .
# Filter for literals and resources (URI)
FILTER(isLiteral(?documentText) || isURI(?documentText))
# If the object is a resource, fetch its label
OPTIONAL {
?documentText rdfs:label ?label .
FILTER(isLiteral(?label))
BIND(?label AS ?finalText)
}
# If the object is not a resource, use the literal as the final text
BIND(IF(isLiteral(?documentText), ?documentText, ?finalText) AS ?finalText)
}
GROUP BY ?documentID
}
1 Answer 1
GraphDB's similarity index leverages the SemanticVectors library to build vector representations for semantic similarity searches using the RDF graph structure and metadata. However, it does not natively support the integration of external embedding models, such as OpenAI's embeddings, for vector creation within the similarity index framework.
But in GraphDB 10.8 version we've introduced https://graphdb.ontotext.com/documentation/10.8/talk-to-graph.html#talk-to-your-graph feature which probably will be useful for your usecase.