-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
79edc87
commit e68914b
Showing
8 changed files
with
501 additions
and
373 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
@prefix fts: <https://prez.dev/ont/fts#> . | ||
@prefix dcterms: <http://purl.org/dc/terms/> . | ||
@prefix dwc: <http://rs.tdwg.org/dwc/terms/> . | ||
@prefix ex: <http://example.com/> . | ||
@prefix sh: <http://www.w3.org/ns/shacl#> . | ||
@prefix sname: <https://fake-scientific-name-id.com/name/afd/> . | ||
@prefix sosa: <http://www.w3.org/ns/sosa/> . | ||
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | ||
@prefix prez: <https://prez.dev/> . | ||
|
||
|
||
ex:FTSSequenceShape | ||
a sh:PropertyShape ; | ||
a fts:PropertyShape ; | ||
sh:path | ||
( | ||
ex:hasSimpleResult ex:hasFeatureOfInterest ex:testProp ex:testProp2 | ||
) ; | ||
. | ||
|
||
ex:FTSInverseShape | ||
a sh:PropertyShape ; | ||
a fts:PropertyShape ; | ||
sh:path [ sh:inversePath ex:hasFeatureOfInterest ] ; | ||
sh:name "Inverse" ; | ||
dcterms:identifier "inv" ; | ||
. | ||
|
||
ex:FTSSequenceShape | ||
a sh:PropertyShape ; | ||
a fts:PropertyShape ; | ||
sh:path | ||
( | ||
ex:hasSimpleResult ex:hasFeatureOfInterest ex:testProp ex:testProp2 | ||
) ; | ||
sh:name "Sequence" ; | ||
dcterms:identifier "seq" ; | ||
. | ||
|
||
ex:FTSInverseSequenceShape | ||
a sh:PropertyShape ; | ||
a fts:PropertyShape ; | ||
sh:path ( ex:hasSimpleResult [ sh:inversePath ex:hasFeatureOfInterest ] ) ; | ||
sh:name "Sequence Inverse" ; | ||
dcterms:identifier "seqinv" ; | ||
. |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from pathlib import Path | ||
|
||
from rdflib import RDFS, URIRef, Graph | ||
from sparql_grammar_pydantic import Var | ||
|
||
from prez.services.query_generation.search_fuseki_fts import SearchQueryFusekiFTS | ||
from prez.services.query_generation.shacl import PropertyShape | ||
|
||
|
||
def test_query_gen(): | ||
query_obj = SearchQueryFusekiFTS(term="test", limit=10, offset=0, predicates=[RDFS.label, RDFS.comment]) | ||
query_string = query_obj.to_string() | ||
print(query_string) | ||
|
||
def test_combo_query_gen(): | ||
file = Path(__file__).parent.parent / "test_data" / "fts_property_shapes.ttl" | ||
ps_g = Graph().parse(file) | ||
ps1 = PropertyShape( | ||
uri=URIRef("FTSInverseSequenceShape"), | ||
graph=ps_g, | ||
kind="fts", # "profile" would expand these out to plain triple pattern matches | ||
focus_node=Var(value="focus_node"), | ||
shape_number=100 | ||
) | ||
ps2 = PropertyShape( | ||
uri=URIRef("FTSInverseSequenceShape"), | ||
) | ||
query = SearchQueryFusekiFTS( | ||
term="test", | ||
limit=10, | ||
offset=0, | ||
predicates=[RDFS.label, RDFS.comment], | ||
gpnt_list=gpnt_list | ||
) | ||
print('') |