0

I have an application that processes the .pins file generated by a Protege (3.5, Frames) project.

I'd like to be able to process the file from within Protege. The trouble I'm having is getting a pins representation of the project (or even an instance) from within the API.

Is there something within the API that will allow me to get the .pins representation or will I have to roll my own parser of the project / instances to generate it manually?

Rich
  • 141
  • 1
  • 6
  • This is a specialized enough question that you might have better luck asking on the Protégé mailing list. Additionally, "Questions asking us to **recommend or find a tool, library** or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." However, since there's probably only one easy way to do this, I don't think that answers will be all that opinionated. But questions asking for tools often get closed for that reason. – Joshua Taylor Nov 20 '13 at 12:58
  • Thanks for your comments @JoshuaTaylor and I appreciate the question is rather specialized - that said, I wasn't actually looking for suggestions of a tool or library, I wanted a solution from within the Protege API. Something I have managed to achieve but not in the most elegant of ways. – Rich Nov 21 '13 at 10:16
  • And that's why I did mention that this isn't a general "grab-bag" of recommendations; there are probably only a few, if that, good ways to do this. That leads us to "Questions concerning problems **with code you've written** must describe the **specific problem — and include valid code** to reproduce it — in the question itself." and "Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include **attempted solutions**, why they didn't work, and the expected results." Showing your existing code might make it easier to find alternatives… – Joshua Taylor Nov 21 '13 at 10:21
  • Fair points - I shall edit the question to include my initial coding attempts if I can rescue them an get time. – Rich Nov 21 '13 at 10:30

1 Answers1

0

I've been able to achieve what I wanted by instantiating a ClipsFilesExportProjectPlugin object within my own plugin. With this you can specify the name of the pins and pont files and execute the export so you have a copy of the file on disk and do what you need with it. Pretty ugly but achieves what I needed it for.

            ClipsFilesExportProjectPlugin p = new ClipsFilesExportProjectPlugin();
            p.setFiles("temp.pont", "temp.pins");
            p.exportProject(getKnowledgeBase().getProject());

            File pontFile = new File("temp.pont");
            File pinsFile = new File("temp.pins");

            // do what you require with the pins (and / or pont) file

            pontFile.delete();
            pinsFile.delete();
Rich
  • 141
  • 1
  • 6