Skip to content

Commit 3f9715d

Browse files
committed
feat: new tests
1 parent 42cb5f8 commit 3f9715d

File tree

5 files changed

+2027
-4
lines changed

5 files changed

+2027
-4
lines changed

dev/ontology-v2-json-response/a-001/test.sh

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,29 @@ else
107107
echo " Install with: pip install pyshacl rdflib"
108108
fi
109109

110-
# Test 4: Generate visualization HTML
110+
# Test 4: TTL-Schema Semantic Alignment (if rdflib is available)
111+
echo ""
112+
echo -e "${YELLOW}Checking for rdflib...${NC}"
113+
if python -c "import rdflib" 2>/dev/null; then
114+
run_test "TTL-Schema Semantic Alignment" \
115+
"python $SCRIPTS_DIR/test_ttl_alignment.py" || true
116+
else
117+
echo -e "${YELLOW}⚠ Skipping alignment test - rdflib not installed${NC}"
118+
echo " Install with: pip install rdflib"
119+
fi
120+
121+
# Test 5: Round-Trip Test (if rdflib is available)
122+
echo ""
123+
echo -e "${YELLOW}Checking for rdflib (round-trip)...${NC}"
124+
if python -c "import rdflib" 2>/dev/null; then
125+
run_test "JSON-LD Round-Trip Test" \
126+
"python $SCRIPTS_DIR/test_roundtrip.py" || true
127+
else
128+
echo -e "${YELLOW}⚠ Skipping round-trip test - rdflib not installed${NC}"
129+
echo " Install with: pip install rdflib"
130+
fi
131+
132+
# Test 6: Generate visualization HTML
111133
echo ""
112134
echo -e "${YELLOW}Generating visualization...${NC}"
113135
run_test "Generate Visualization HTML" \

dev/ontology-v2-json-response/scripts/build_jsonld.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@
204204
re.IGNORECASE,
205205
)
206206
ORCID_PATTERN = re.compile(r"^\d{4}-\d{4}-\d{4}-\d{3}[\dX]$")
207-
ROR_PATTERN = re.compile(r"^https://ror\.org/\w+$")
207+
ROR_PATTERN = re.compile(r"^https://ror\.org/[0-9a-z]{9}$")
208208
DOI_PATTERN = re.compile(r"^10\.\d{4,9}/[-._;()/:a-zA-Z0-9]+$")
209209

210210

@@ -236,8 +236,9 @@ def is_hierarchical_id(value: str, target_shape: str) -> bool:
236236
if value.startswith("http"): # URLs like ROR
237237
return True
238238

239-
# GitHub usernames, composite IDs, etc.
240-
return True
239+
# Non-UUID, non-URL values: GitHub usernames, composite IDs, etc.
240+
# Any non-empty, non-UUID string is treated as a hierarchical ID.
241+
return len(value) > 0
241242

242243

243244
def load_json(filepath: Path) -> Any:

0 commit comments

Comments
 (0)