change url

111 views
Skip to first unread message

John Shaver

unread,
Jan 19, 2017, 1:41:46 AM1/19/17
to ProfilesRNS
We're wanting to go from profiles.tsi.wakehealth.edu to profiles.wakehealth.edu 

I got everything configured and changed the baseURI and basePath in Framework.Parameter. 

I also ran the script that was posted here in profile's google group.

now when i click on a user profile I get a 404 error..

any suggestions?

John Shaver

unread,
Jan 19, 2017, 8:23:34 AM1/19/17
to ProfilesRNS

looks like as long as I use the [Framework.].[ChangeBaseURI] everything should work. Has anyone else had any success changing the url?

Brown, Nicholas William

unread,
Jan 19, 2017, 9:17:29 AM1/19/17
to profi...@googlegroups.com

John

 

To change the URL in the database you have to run the [Framework.].[ChangeBaseURI] stored procedure and then update the basepath value in [Framework.].Parameter

 

The script I use for this is:

declare @newPath nvarchar(max)

select @newPath = 'http://localhost:55956'

 

declare @old nvarchar(max)

declare @newURI nvarchar(max)

select @newURI = @newPath + '/profile/'

select @old = value from [Framework.].Parameter where parameterID = 'BaseURI'

 

DECLARE              @return_value int

 

EXEC      @return_value = [Framework.].[ChangeBaseURI]

                                @oldBaseURI = @old,

                                @newBaseURI = @newURI

 

SELECT  'Return Value' = @return_value

 

update [Framework.].Parameter set Value = @newPath where ParameterID = 'basePath'

 

Nick

--
You received this message because you are subscribed to the Google Groups "ProfilesRNS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to profilesrns...@googlegroups.com.
To post to this group, send email to profi...@googlegroups.com.
Visit this group at https://groups.google.com/group/profilesrns.
For more options, visit https://groups.google.com/d/optout.

John Shaver

unread,
Jan 19, 2017, 11:59:28 PM1/19/17
to ProfilesRNS
Thanks for the script but I'm getting the following error:

Cannot insert duplicate key row in object 'RDF..Node' with unique index 'idx_ValueHash'. The duplicate key value is

when I run the script.

any suggestions?

Joshua Lease

unread,
Jan 20, 2017, 8:16:21 AM1/20/17
to ProfilesRNS
I usually change the unique index to a regular index and then run the ChangeBaseURI job. Then I run the following query to identify duplicates.
SELECT FROM [RDF.].[Node] INNER JOIN (SELECT [ValueHash] FROM [RDF.].[Node] GROUP BY [ValueHash] HAVING COUNT(*) > 1) AS tmp ON [RDF.].[Node].[ValueHash] = tmp.ValueHash;

For each set of duplicates, I then update the triples to no longer point to the duplicates:
UPDATE [RDF.].[Triple] SET [Object] = <nodeid1> WHERE [Object] = <nodeid2>;
DELETE FROM [RDF.].[Node] WHERE [NodeID] = <nodeid2>

Then I change the index back to a unique index. You may also need to rerun some of the caching jobs.

Note that this procedure may not be complete as I do not know profiles very well. We use it to set up development environments.

John Shaver

unread,
Jan 20, 2017, 8:55:08 AM1/20/17
to profi...@googlegroups.com

Just tested this in the dev environment and it worked great!

 

-Nick, can you confirm this best practice before I run it in production?

 

John

Brown, Nicholas William

unread,
Jan 20, 2017, 9:48:54 AM1/20/17
to profi...@googlegroups.com

I think that process should work. Run EXEC [Framework.].[RunJobGroup] @JobGroup = 3 afterwards to update the cache.


I have run into the same issue a couple of times. When I have seen it, it has been caused by the nightly job updating the URLs for photos to the new url, which causes the duplicates.


In the past I have solved the issue by looking for the duplicates and removing them, and updating any triples pointing to them, then running the change URI script. I'm pretty sure that is functionally equivalent to the code Joshua sent, just performing the steps in a different order. To identify the duplicates I use:

declare @oldBaseURI varchar(1000)

declare @newBaseURI varchar(1000)

select @oldBaseURI = 'http://connects.catalyst.harvard.edu/profiles/profile/'

select @newBaseURI = 'http://dev.connects.catalyst.harvard.edu/profiles/profile/'

select * from [RDF.].[Node] a join [RDF.].[Node] b

on a.Value = @newBaseURI + substring(b.value,len(@oldBaseURI)+1,len(b.value))


Nick



From: profi...@googlegroups.com <profi...@googlegroups.com> on behalf of John Shaver <jsh...@wakehealth.edu>
Sent: Friday, January 20, 2017 8:55:06 AM
To: profi...@googlegroups.com
Subject: RE: [ProfilesRNS] Re: change url
 
Reply all
Reply to author
Forward
0 new messages