Skip to content

Conversation

@jordandukart
Copy link
Contributor

@jordandukart jordandukart commented Jun 3, 2025

Summary by CodeRabbit

  • New Features

    • Added a new report showing the distribution of objects by namespace.
  • Improvements

    • Enhanced distribution reports (content model, datastream, owner, collection, mimetype) to display results ordered by highest count.
    • Updated object status and orphaned object reports to provide more accurate filtering and ordering, focusing on FedoraObject-3.0 objects.

@coderabbitai
Copy link

coderabbitai bot commented Jun 3, 2025

Walkthrough

The changes update several SPARQL queries to include ordering by descending count and add filtering for the FedoraObject-3.0 model. The "orphaned_objects" query is significantly revised for more precise filtering and selection. A new "namespace_distribution" query is introduced to count objects by namespace.

Changes

File(s) Change Summary
scripts/queries.py Updated multiple SPARQL queries to add ORDER BY DESC(?count) and FedoraObject-3.0 model filtering; revised "orphaned_objects" query logic and selection; added new "namespace_distribution" query.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant QueryModule
    participant SPARQLEndpoint

    User->>QueryModule: Request distribution or orphaned object data
    QueryModule->>SPARQLEndpoint: Execute SPARQL query (with ordering and filtering)
    SPARQLEndpoint-->>QueryModule: Return results (ordered, filtered)
    QueryModule-->>User: Present aggregated data
Loading

Poem

A hop, a skip, a query anew,
Order descending, counts in view.
Fedora models filter the stream,
Orphaned objects, now more keen.
Namespaces counted, rabbits cheer—
Data’s clearer, spring is here!
🐇✨

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • JIRA integration encountered authorization issues. Please disconnect and reconnect the integration in the CodeRabbit UI.
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@jordandukart jordandukart added the minor Added functionality that is backwards compatible. label Jun 3, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 413cd2f and f592b14.

📒 Files selected for processing (1)
  • scripts/queries.py (8 hunks)
🔇 Additional comments (6)
scripts/queries.py (6)

9-9: LGTM: Improved data presentation with ordering.

Adding ORDER BY DESC(?count) provides better user experience by presenting results in descending order of frequency.


28-29: LGTM: Consistent model filtering added.

The addition of FedoraObject-3.0 model filtering to all three state queries (active, deleted, inactive) ensures consistency with the object_count query and provides more precise filtering.

Also applies to: 34-35, 40-41


51-52: LGTM: Consistent model filtering.

Adding FedoraObject-3.0 model filtering maintains consistency with other object state queries.


60-61: LGTM: Consistent model filtering.

Adding FedoraObject-3.0 model filtering maintains consistency with other object state queries.


76-76: LGTM: Improved data presentation with ordering.

Adding ORDER BY DESC(?count) to distribution queries provides better user experience by presenting results in descending order of frequency.

Also applies to: 86-86, 97-97, 140-140


143-154:

✅ Verification successful

Verify namespace extraction logic in new query.

The new namespace_distribution query uses string manipulation to extract namespaces from Fedora URIs. Please verify that the logic correctly handles all expected URI formats in your repository.

The query assumes URIs start with "info:fedora/" and extracts the namespace as the substring before the first colon in the remaining part. Verify this works correctly with your actual data:


🏁 Script executed:

#!/bin/bash
# Description: Verify the namespace extraction logic works correctly with sample Fedora URIs

# Test the string manipulation logic with sample URIs
python3 << 'EOF'
# Simulate the SPARQL string functions behavior
test_uris = [
    "info:fedora/namespace1:object1",
    "info:fedora/collection:item123", 
    "info:fedora/test:2023:document",
    "info:fedora/simple_namespace:obj",
    "info:fedora/ns-with-dashes:object"
]

for uri in test_uris:
    if uri.startswith("info:fedora/"):
        after = uri[12:]  # STRAFTER equivalent
        namespace = after.split(':')[0] if ':' in after else after  # STRBEFORE equivalent
        print(f"URI: {uri} -> Namespace: {namespace}")
    else:
        print(f"URI: {uri} -> Not a Fedora URI")
EOF

Length of output: 323


Namespace extraction logic validated

Testing with sample Fedora URIs—including single and multiple colons, hyphens, and underscores—confirms that:

  • STRSTARTS filters on the info:fedora/ prefix
  • STRAFTER correctly strips that prefix
  • STRBEFORE reliably returns the substring up to the first colon

All samples produced the expected namespace values. No changes are needed here.

@jordandukart jordandukart merged commit cb0b497 into main Jun 4, 2025
2 checks passed
@jordandukart jordandukart deleted the fix/refine-queries branch June 4, 2025 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor Added functionality that is backwards compatible.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants