Instalação -> https://franz.com/agraph/support/documentation/current/python/install.html
pip install agraph-python
Guia de Referência da API -> https://franz.com/agraph/support/documentation/current/python/api.html
Tutorial -> https://franz.com/agraph/support/documentation/current/python/tutorial.html
No notebook jupyter tem exemplos dos comandos para abrir conexão, preparar comandos, executar comandos, setar variável de ambiente, etc ...
addTriple Add a single triple to the repository.
getStatements Get all statements with a specific subject, predicate and/or object from the repository.
prepareBooleanQuery Parse query into a boolean query object which can be executed against the triple store.
prepareGraphQuery Parse query into a graph query object which can be executed against the triple store.
prepareTupleQuery Parse query into a tuple query object which can be executed against the triple stroe.
prepareUpdate Parse query into an update query object which can be executed against the triple store.
executeBooleanQuery Prepare and immediately evaluate a query that returns a boolean.
executeGraphQuery Prepare and immediately evaluate a query that returns RDF.
executeTupleQuery Prepare and immediately evaluate a query that returns tuples.
executeUpdate Prepare and immediately evaluate a SPARQL update query.
evalFreeTextSearch Return a list of statements for the given free-text pattern search.
To insert the data we have to iterate over the result and add each triple using addStatement() (or use an INSERT query).
SELECT: This kind of query returns a sequence of tuples, binding variables to matching elements of a search pattern. SELECT queries are created using prepareTupleQuery() and return results of type TupleQueryResult.
The CONSTRUCT query creates triples by substantiating provided templates with values resulting from matching a pattern. Queries of this kind are created using prepareGraphQuery() and return a RepositoryResult - which is an iterator over the constructed triples.
The DESCRIBE query returns triples that ‘describe’ a given set of resources. Such queries are created using prepareGraphQuery() and return RepositoryResult objects.
Reasoner
conn.getStatements(s, p, o, includeInferred=True)
RDFS++ (rdfs e owl)
owl:inverseOf, subPropertyOf, inverseOf with subPropertyOf, sameAs, sameAs with inverseOf and subPropertyOf, type with subClassOf, type with range, type with domain, Transitivity with sameAs
Fiz vários testes com essas opções, inclusive inferencias
ResponderExcluir